Skip to content

Commit 80ee80c

Browse files
committed
feat: add Canvas Backups option to Main Menu
- Updated the menu item titles for clarity and consistency.
1 parent f91f382 commit 80ee80c

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/frontend/src/ui/MainMenu.tsx

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import type { ExcalidrawImperativeAPI } from '@atyrode/excalidraw/types';
44
import type { MainMenu as MainMenuType } from '@atyrode/excalidraw';
55

6-
import { LogOut, SquarePlus, LayoutDashboard, SquareCode, Eye, Coffee, Grid2x2, User, Text } from 'lucide-react';
6+
import { LogOut, SquarePlus, LayoutDashboard, SquareCode, Eye, Coffee, Grid2x2, User, Text, ArchiveRestore } from 'lucide-react';
77
import { capture } from '../utils/posthog';
88
import { ExcalidrawElementFactory, PlacementMode } from '../lib/ExcalidrawElementFactory';
99
import { useUserProfile } from "../api/hooks";
@@ -93,6 +93,22 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
9393
});
9494
};
9595

96+
const handleCanvasBackupsClick = () => {
97+
if (!excalidrawAPI) return;
98+
99+
const backupsElement = ExcalidrawElementFactory.createEmbeddableElement({
100+
link: "!backups",
101+
width: 400,
102+
height: 500
103+
});
104+
105+
ExcalidrawElementFactory.placeInScene(backupsElement, excalidrawAPI, {
106+
mode: PlacementMode.NEAR_VIEWPORT_CENTER,
107+
bufferPercentage: 10,
108+
scrollToView: true
109+
});
110+
};
111+
96112
const handleGridToggle = () => {
97113
if (!excalidrawAPI) return;
98114
const appState = excalidrawAPI.getAppState();
@@ -136,6 +152,12 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
136152
<MainMenu.DefaultItems.LoadScene />
137153
<MainMenu.DefaultItems.Export />
138154
<MainMenu.DefaultItems.SaveAsImage />
155+
<MainMenu.Item
156+
icon={<ArchiveRestore />}
157+
onClick={handleCanvasBackupsClick}
158+
>
159+
Canvas Backups
160+
</MainMenu.Item>
139161
</MainMenu.Group>
140162

141163
<MainMenu.Separator />
@@ -169,25 +191,25 @@ export const MainMenuConfig: React.FC<MainMenuConfigProps> = ({
169191
icon={<SquareCode />}
170192
onClick={handleHtmlEditorClick}
171193
>
172-
Insert HTML Editor
194+
HTML Editor
173195
</MainMenu.Item>
174196
<MainMenu.Item
175197
icon={<Text />}
176198
onClick={handleEditorClick}
177199
>
178-
Insert Code Editor
200+
Code Editor
179201
</MainMenu.Item>
180202
<MainMenu.Item
181203
icon={<LayoutDashboard />}
182204
onClick={handleDashboardButtonClick}
183205
>
184-
Insert Dashboard
206+
Dashboard
185207
</MainMenu.Item>
186208
<MainMenu.Item
187209
icon={<SquarePlus />}
188210
onClick={handleInsertButtonClick}
189211
>
190-
Insert Button
212+
Action Button
191213
</MainMenu.Item>
192214
</MainMenu.Group>
193215

0 commit comments

Comments
 (0)