@semiont/react-ui 0.2.33-build.84 → 0.2.33-build.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +9 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +300 -0
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +2 -0
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +11 -11
- package/src/styles/core/checkboxes.css +8 -0
package/dist/index.mjs
CHANGED
|
@@ -57296,38 +57296,36 @@ function ResourceViewerPage({
|
|
|
57296
57296
|
console.error("[RealTime] Event stream error:", error);
|
|
57297
57297
|
}, [])
|
|
57298
57298
|
});
|
|
57299
|
+
const updateMutation = resources.update.useMutation();
|
|
57300
|
+
const generateCloneTokenMutation = resources.generateCloneToken.useMutation();
|
|
57299
57301
|
const handleResourceArchive = useCallback35(async () => {
|
|
57300
57302
|
try {
|
|
57301
|
-
await
|
|
57303
|
+
await updateMutation.mutateAsync({ rUri, data: { archived: true } });
|
|
57302
57304
|
await refetchDocument();
|
|
57303
|
-
showSuccess("Document archived");
|
|
57304
57305
|
} catch (err) {
|
|
57305
57306
|
console.error("Failed to archive document:", err);
|
|
57306
57307
|
showError("Failed to archive document");
|
|
57307
57308
|
}
|
|
57308
|
-
}, [
|
|
57309
|
+
}, [updateMutation, rUri, refetchDocument, showError]);
|
|
57309
57310
|
const handleResourceUnarchive = useCallback35(async () => {
|
|
57310
57311
|
try {
|
|
57311
|
-
await
|
|
57312
|
+
await updateMutation.mutateAsync({ rUri, data: { archived: false } });
|
|
57312
57313
|
await refetchDocument();
|
|
57313
|
-
showSuccess("Document unarchived");
|
|
57314
57314
|
} catch (err) {
|
|
57315
57315
|
console.error("Failed to unarchive document:", err);
|
|
57316
57316
|
showError("Failed to unarchive document");
|
|
57317
57317
|
}
|
|
57318
|
-
}, [
|
|
57318
|
+
}, [updateMutation, rUri, refetchDocument, showError]);
|
|
57319
57319
|
const handleResourceClone = useCallback35(async () => {
|
|
57320
57320
|
try {
|
|
57321
|
-
const result2 = await
|
|
57321
|
+
const result2 = await generateCloneTokenMutation.mutateAsync(rUri);
|
|
57322
57322
|
const token = result2.token;
|
|
57323
|
-
|
|
57324
|
-
await navigator.clipboard.writeText(cloneUrl);
|
|
57325
|
-
showSuccess("Clone link copied to clipboard");
|
|
57323
|
+
eventBus.emit("navigation:router-push", { path: `/know/compose?mode=clone&token=${token}`, reason: "clone" });
|
|
57326
57324
|
} catch (err) {
|
|
57327
57325
|
console.error("Failed to generate clone token:", err);
|
|
57328
57326
|
showError("Failed to generate clone link");
|
|
57329
57327
|
}
|
|
57330
|
-
}, [
|
|
57328
|
+
}, [generateCloneTokenMutation, rUri, showError]);
|
|
57331
57329
|
const handleAnnotationSparkle = useCallback35(({ annotationId }) => {
|
|
57332
57330
|
triggerSparkleAnimation(annotationId);
|
|
57333
57331
|
}, [triggerSparkleAnimation]);
|