2023-01-31 13:53:20 +01:00
|
|
|
import React from "react";
|
2024-08-23 15:54:59 +02:00
|
|
|
import {
|
|
|
|
loginIcon,
|
|
|
|
ExcalLogo,
|
|
|
|
} from "../../packages/excalidraw/components/icons";
|
|
|
|
import type { Theme } from "../../packages/excalidraw/element/types";
|
2023-12-12 11:32:51 +05:30
|
|
|
import { MainMenu } from "../../packages/excalidraw/index";
|
2024-08-23 15:54:59 +02:00
|
|
|
import { isExcalidrawPlusSignedUser } from "../app_constants";
|
|
|
|
import { LanguageList } from "../app-language/LanguageList";
|
2023-01-31 13:53:20 +01:00
|
|
|
|
|
|
|
export const AppMainMenu: React.FC<{
|
2024-08-23 15:54:59 +02:00
|
|
|
onCollabDialogOpen: () => any;
|
2023-01-31 13:53:20 +01:00
|
|
|
isCollaborating: boolean;
|
2023-06-12 17:44:31 +02:00
|
|
|
isCollabEnabled: boolean;
|
2024-08-23 15:54:59 +02:00
|
|
|
theme: Theme | "system";
|
|
|
|
setTheme: (theme: Theme | "system") => void;
|
2023-01-31 13:53:20 +01:00
|
|
|
}> = React.memo((props) => {
|
|
|
|
return (
|
|
|
|
<MainMenu>
|
|
|
|
<MainMenu.DefaultItems.LoadScene />
|
|
|
|
<MainMenu.DefaultItems.SaveToActiveFile />
|
|
|
|
<MainMenu.DefaultItems.Export />
|
|
|
|
<MainMenu.DefaultItems.SaveAsImage />
|
2023-06-12 17:44:31 +02:00
|
|
|
{props.isCollabEnabled && (
|
|
|
|
<MainMenu.DefaultItems.LiveCollaborationTrigger
|
|
|
|
isCollaborating={props.isCollaborating}
|
2024-08-23 15:54:59 +02:00
|
|
|
onSelect={() => props.onCollabDialogOpen()}
|
2023-06-12 17:44:31 +02:00
|
|
|
/>
|
|
|
|
)}
|
2024-08-23 15:54:59 +02:00
|
|
|
<MainMenu.DefaultItems.CommandPalette className="highlighted" />
|
2023-01-31 13:53:20 +01:00
|
|
|
<MainMenu.DefaultItems.Help />
|
|
|
|
<MainMenu.DefaultItems.ClearCanvas />
|
|
|
|
<MainMenu.Separator />
|
|
|
|
<MainMenu.ItemLink
|
2024-08-23 15:54:59 +02:00
|
|
|
icon={ExcalLogo}
|
2023-09-11 23:13:16 +02:00
|
|
|
href={`${
|
|
|
|
import.meta.env.VITE_APP_PLUS_LP
|
|
|
|
}/plus?utm_source=excalidraw&utm_medium=app&utm_content=hamburger`}
|
2024-08-23 15:54:59 +02:00
|
|
|
className=""
|
2023-01-31 13:53:20 +01:00
|
|
|
>
|
|
|
|
Excalidraw+
|
|
|
|
</MainMenu.ItemLink>
|
|
|
|
<MainMenu.DefaultItems.Socials />
|
2024-08-23 15:54:59 +02:00
|
|
|
<MainMenu.ItemLink
|
|
|
|
icon={loginIcon}
|
|
|
|
href={`${import.meta.env.VITE_APP_PLUS_APP}${
|
|
|
|
isExcalidrawPlusSignedUser ? "" : "/sign-up"
|
|
|
|
}?utm_source=signin&utm_medium=app&utm_content=hamburger`}
|
|
|
|
className="highlighted"
|
|
|
|
>
|
|
|
|
{isExcalidrawPlusSignedUser ? "Sign in" : "Sign up"}
|
|
|
|
</MainMenu.ItemLink>
|
2023-01-31 13:53:20 +01:00
|
|
|
<MainMenu.Separator />
|
2024-08-23 15:54:59 +02:00
|
|
|
<MainMenu.DefaultItems.ToggleTheme
|
|
|
|
allowSystemTheme
|
|
|
|
theme={props.theme}
|
|
|
|
onSelect={props.setTheme}
|
|
|
|
/>
|
2023-01-31 13:53:20 +01:00
|
|
|
<MainMenu.ItemCustom>
|
|
|
|
<LanguageList style={{ width: "100%" }} />
|
|
|
|
</MainMenu.ItemCustom>
|
|
|
|
<MainMenu.DefaultItems.ChangeCanvasBackground />
|
|
|
|
</MainMenu>
|
|
|
|
);
|
|
|
|
});
|