diff --git a/code/components/room-components/overlay/operations-overlay.tsx b/code/components/room-components/overlay/operations-overlay.tsx
index 3177b56..d56b929 100644
--- a/code/components/room-components/overlay/operations-overlay.tsx
+++ b/code/components/room-components/overlay/operations-overlay.tsx
@@ -1,9 +1,21 @@
"use client";
import React from "react";
-import { Clipboard, Copy, Trash2, Redo2, Undo2, Group, Ungroup, MonitorDown, ImageDown } from "lucide-react";
+import {
+ Clipboard,
+ Copy,
+ Trash2,
+ Group,
+ Ungroup,
+ MonitorDown,
+ ImageDown,
+} from "lucide-react";
import { useWeave } from "@inditextech/weavejs-react";
-import { WeaveCopyPasteNodesPlugin, WeaveExportNodeActionParams, WeaveExportStageActionParams } from "@inditextech/weavejs-sdk";
+import {
+ WeaveCopyPasteNodesPlugin,
+ WeaveExportNodeActionParams,
+ WeaveExportStageActionParams,
+} from "@inditextech/weavejs-sdk";
import { ToolbarButton } from "../toolbar/toolbar-button";
export function OperationsOverlay() {
@@ -16,9 +28,6 @@ export function OperationsOverlay() {
const canCopy = useWeave((state) => state.copyPaste.canCopy);
const canPaste = useWeave((state) => state.copyPaste.canPaste);
- const canUndo = useWeave((state) => state.undoRedo.canUndo);
- const canRedo = useWeave((state) => state.undoRedo.canRedo);
-
return (
@@ -46,14 +55,17 @@ export function OperationsOverlay() {
tooltipSide="top"
/>
}
disabled={isActionActive || !canCopy}
onClick={() => {
if (instance) {
- const weaveCopyPasteNodesPlugin = instance.getPlugin
("copyPasteNodes");
+ const weaveCopyPasteNodesPlugin =
+ instance.getPlugin(
+ "copyPasteNodes"
+ );
if (weaveCopyPasteNodesPlugin) {
return weaveCopyPasteNodesPlugin.copy();
}
@@ -67,7 +79,10 @@ export function OperationsOverlay() {
disabled={isActionActive || !canPaste}
onClick={() => {
if (instance) {
- const weaveCopyPasteNodesPlugin = instance.getPlugin("copyPasteNodes");
+ const weaveCopyPasteNodesPlugin =
+ instance.getPlugin(
+ "copyPasteNodes"
+ );
if (weaveCopyPasteNodesPlugin) {
return weaveCopyPasteNodesPlugin.paste();
}
@@ -77,47 +92,23 @@ export function OperationsOverlay() {
tooltipSide="top"
/>
- }
- disabled={isActionActive || !canUndo}
- onClick={() => {
- if (instance) {
- const actualStore = instance.getStore();
- actualStore.undoStateStep();
- }
- }}
- label="Undo"
- tooltipSide="top"
- />
- }
- disabled={isActionActive || !canRedo}
- onClick={() => {
- if (instance) {
- const actualStore = instance.getStore();
- actualStore.redoStateStep();
- }
- }}
- label="Redo"
- tooltipSide="top"
- />
-
}
disabled={selectedNodes.length !== 1}
onClick={() => {
if (instance && selectedNodes.length === 1) {
- instance.triggerAction("exportNodeTool", {
- node: selectedNodes[0].instance,
- options: {
- padding: 20,
- pixelRatio: 2,
- },
- });
+ instance.triggerAction(
+ "exportNodeTool",
+ {
+ node: selectedNodes[0].instance,
+ options: {
+ padding: 20,
+ pixelRatio: 2,
+ },
+ }
+ );
}
}}
tooltipSide="top"
@@ -127,19 +118,22 @@ export function OperationsOverlay() {
icon={}
onClick={() => {
if (instance) {
- instance.triggerAction("exportStageTool", {
- options: {
- padding: 20,
- pixelRatio: 2,
- },
- });
+ instance.triggerAction(
+ "exportStageTool",
+ {
+ options: {
+ padding: 20,
+ pixelRatio: 2,
+ },
+ }
+ );
}
}}
tooltipSide="top"
label="Export canvas as image"
/>
}
diff --git a/code/components/room-components/overlay/room-information-overlay.tsx b/code/components/room-components/overlay/room-information-overlay.tsx
index 4bd969f..f84b9d8 100644
--- a/code/components/room-components/overlay/room-information-overlay.tsx
+++ b/code/components/room-components/overlay/room-information-overlay.tsx
@@ -11,8 +11,10 @@ export function RoomInformationOverlay() {
-
-
{room}
+
+
+ {room}
+
);
diff --git a/code/components/room-components/overlay/tools-overlay.tsx b/code/components/room-components/overlay/tools-overlay.tsx
index e014618..5406932 100644
--- a/code/components/room-components/overlay/tools-overlay.tsx
+++ b/code/components/room-components/overlay/tools-overlay.tsx
@@ -2,7 +2,17 @@
import React from "react";
import { ToolbarButton } from "../toolbar/toolbar-button";
-import { Brush, ImagePlus, PenTool, Presentation, Square, SwatchBook, Type } from "lucide-react";
+import {
+ Brush,
+ ImagePlus,
+ PenTool,
+ Presentation,
+ Square,
+ SwatchBook,
+ Type,
+ Redo2,
+ Undo2,
+} from "lucide-react";
import { useWeave } from "@inditextech/weavejs-react";
import { Toolbar } from "../toolbar/toolbar";
@@ -12,6 +22,9 @@ export function ToolsOverlay() {
const isActionActive = useWeave((state) => state.actions.active);
const actualAction = useWeave((state) => state.actions.actual);
+ const canUndo = useWeave((state) => state.undoRedo.canUndo);
+ const canRedo = useWeave((state) => state.undoRedo.canRedo);
+
const triggerRectangleTool = React.useCallback(() => {
if (instance && actualAction !== "rectangleTool") {
instance.triggerAction("rectangleTool");
@@ -76,7 +89,7 @@ export function ToolsOverlay() {
}, [instance, actualAction]);
return (
-
+
}
@@ -113,9 +126,8 @@ export function ToolsOverlay() {
onClick={triggerImageTool}
label="Add an image"
/>
-
+
+
}
active={actualAction === "pantoneTool"}
@@ -131,6 +143,32 @@ export function ToolsOverlay() {
label="Create a workspace"
/>
+
+ }
+ disabled={isActionActive || !canUndo}
+ onClick={() => {
+ if (instance) {
+ const actualStore = instance.getStore();
+ actualStore.undoStateStep();
+ }
+ }}
+ label="Undo"
+ tooltipSide="top"
+ />
+ }
+ disabled={isActionActive || !canRedo}
+ onClick={() => {
+ if (instance) {
+ const actualStore = instance.getStore();
+ actualStore.redoStateStep();
+ }
+ }}
+ label="Redo"
+ tooltipSide="top"
+ />
+
);
}