import React, { useState } from "react"; import { MainMenu } from "@excalidraw/excalidraw/index"; import { ExcalLogo, eyeIcon, loginIcon, TrashIcon } from "../../packages/excalidraw/components/icons"; import { isDevEnv } from "@excalidraw/common"; import { LanguageList } from "../app-language/LanguageList"; import { isExcalidrawPlusSignedUser } from "../app_constants"; import { saveDebugState } from "./DebugCanvas"; import type { Theme } from "@excalidraw/element/types"; export const AppMainMenu: React.FC<{ onCollabDialogOpen: () => any; isCollaborating: boolean; isCollabEnabled: boolean; theme: Theme | "system"; setTheme: (theme: Theme | "system") => void; refresh: () => void; excalidrawAPI: any; }> = React.memo((props) => { const [isDialogOpen, setIsDialogOpen] = useState(false); const handleClearCanvas = () => { setIsDialogOpen(true); }; const confirmClearCanvas = () => { if (props.excalidrawAPI) { props.excalidrawAPI.updateScene({ elements: [] }); } setIsDialogOpen(false); }; const cancelClearCanvas = () => { setIsDialogOpen(false); }; return ( <> {props.isCollabEnabled && ( props.onCollabDialogOpen()} /> )} Clear Canvas Excalidraw+ {isExcalidrawPlusSignedUser ? "Sign in" : "Sign up"} {isDevEnv() && ( { if (window.visualDebug) { delete window.visualDebug; saveDebugState({ enabled: false }); } else { window.visualDebug = { data: [] }; saveDebugState({ enabled: true }); } props?.refresh(); }} > Visual Debug )} {isDialogOpen && (

Clear Canvas

Are you sure you want to clear the canvas? This action cannot be undone.

)} ); });