Skip to content

Commit d574521

Browse files
authored
Update dependencies (#96)
* feat: added support to edit text properties before create it * chore: update dependencies
1 parent 65d8d2d commit d574521

File tree

4 files changed

+308
-272
lines changed

4 files changed

+308
-272
lines changed

code/components/room-components/node-properties/stroke-properties.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export function StrokeProperties() {
2929
const actualAction = useWeave((state) => state.actions.actual);
3030

3131
const nodePropertiesAction = useCollaborationRoom(
32-
(state) => state.nodeProperties.action,
32+
(state) => state.nodeProperties.action
3333
);
3434

3535
const nodeCreateProps = useCollaborationRoom(
36-
(state) => state.nodeProperties.createProps,
36+
(state) => state.nodeProperties.createProps
3737
);
3838

3939
const actualNode = React.useMemo(() => {
@@ -62,7 +62,7 @@ export function StrokeProperties() {
6262
instance.updateNode(updatedNode);
6363
}
6464
},
65-
[instance, actualAction, nodePropertiesAction],
65+
[instance, actualAction, nodePropertiesAction]
6666
);
6767

6868
if (!instance || !actualAction || !actualNode) {
@@ -71,7 +71,8 @@ export function StrokeProperties() {
7171

7272
if (!actualAction && !actualNode) return null;
7373

74-
if (["colorTokenTool", "frameTool"].includes(actualAction)) return null;
74+
if (["colorTokenTool", "frameTool", "textTool"].includes(actualAction))
75+
return null;
7576

7677
if (["text", "color-token", "frame"].includes(actualNode.type)) {
7778
return null;

code/components/room-components/node-properties/text-properties.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ export function TextProperties() {
3434
const actualAction = useWeave((state) => state.actions.actual);
3535

3636
const nodePropertiesAction = useCollaborationRoom(
37-
(state) => state.nodeProperties.action,
37+
(state) => state.nodeProperties.action
3838
);
3939

4040
const nodeCreateProps = useCollaborationRoom(
41-
(state) => state.nodeProperties.createProps,
41+
(state) => state.nodeProperties.createProps
4242
);
4343

4444
const actualNode = React.useMemo(() => {
@@ -67,7 +67,7 @@ export function TextProperties() {
6767
instance.updateNode(updatedNode);
6868
}
6969
},
70-
[instance, actualAction, nodePropertiesAction],
70+
[instance, actualAction, nodePropertiesAction]
7171
);
7272

7373
if (!instance || !actualAction || !actualNode) {
@@ -76,7 +76,10 @@ export function TextProperties() {
7676

7777
if (!actualAction && !actualNode) return null;
7878

79-
if (!["text"].includes(actualNode.type)) {
79+
if (
80+
!["textTool"].includes(actualAction) &&
81+
!["text"].includes(actualNode.type)
82+
) {
8083
return null;
8184
}
8285

code/components/room-components/overlay/node-properties.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ export const NodeProperties = () => {
3434
const setNode = useWeave((state) => state.setNode);
3535

3636
const sidebarRightActive = useCollaborationRoom(
37-
(state) => state.sidebar.right.active,
37+
(state) => state.sidebar.right.active
3838
);
3939
const setSidebarActive = useCollaborationRoom(
40-
(state) => state.setSidebarActive,
40+
(state) => state.setSidebarActive
4141
);
4242
const setNodePropertiesAction = useCollaborationRoom(
43-
(state) => state.setNodePropertiesAction,
43+
(state) => state.setNodePropertiesAction
4444
);
4545

4646
const nodePropertiesAction = useCollaborationRoom(
47-
(state) => state.nodeProperties.action,
47+
(state) => state.nodeProperties.action
4848
);
4949

5050
React.useEffect(() => {
@@ -61,6 +61,7 @@ export const NodeProperties = () => {
6161
"arrowTool",
6262
"colorTokenTool",
6363
"frameTool",
64+
"textTool",
6465
].includes(actualAction)
6566
) {
6667
setNodePropertiesAction("create");
@@ -128,6 +129,8 @@ export const NodeProperties = () => {
128129
return "Color Token";
129130
case "frameTool":
130131
return "Frame";
132+
case "textTool":
133+
return "Text";
131134
default:
132135
return "Unknown";
133136
}
@@ -212,6 +215,7 @@ export const NodeProperties = () => {
212215
"arrowTool",
213216
"colorTokenTool",
214217
"frameTool",
218+
"textTool",
215219
].includes(actualAction)
216220
) {
217221
instance.cancelAction(actualAction);

0 commit comments

Comments
 (0)