From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001
From: kj_sh604
Date: Sun, 15 Mar 2026 16:19:35 -0400
Subject: refactor: packages/
---
.../welcome-screen/WelcomeScreen.Center.tsx | 195 +++++++++++++++++++++
1 file changed, 195 insertions(+)
create mode 100644 packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx
(limited to 'packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx')
diff --git a/packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx b/packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx
new file mode 100644
index 0000000..4faa41b
--- /dev/null
+++ b/packages/excalidraw/components/welcome-screen/WelcomeScreen.Center.tsx
@@ -0,0 +1,195 @@
+import type { JSX } from "react";
+import { actionLoadScene, actionShortcuts } from "../../actions";
+import { getShortcutFromShortcutName } from "../../actions/shortcuts";
+import { t, useI18n } from "../../i18n";
+import { useDevice, useExcalidrawActionManager } from "../App";
+import { useTunnels } from "../../context/tunnels";
+import { HelpIcon, LoadIcon, usersIcon } from "../icons";
+import { useUIAppState } from "../../context/ui-appState";
+import { ExcalidrawLogo } from "../ExcalidrawLogo";
+
+const WelcomeScreenMenuItemContent = ({
+ icon,
+ shortcut,
+ children,
+}: {
+ icon?: JSX.Element;
+ shortcut?: string | null;
+ children: React.ReactNode;
+}) => {
+ const device = useDevice();
+ return (
+ <>
+
{icon}
+ {children}
+ {shortcut && !device.editor.isMobile && (
+ {shortcut}
+ )}
+ >
+ );
+};
+WelcomeScreenMenuItemContent.displayName = "WelcomeScreenMenuItemContent";
+
+const WelcomeScreenMenuItem = ({
+ onSelect,
+ children,
+ icon,
+ shortcut,
+ className = "",
+ ...props
+}: {
+ onSelect: () => void;
+ children: React.ReactNode;
+ icon?: JSX.Element;
+ shortcut?: string | null;
+} & React.ButtonHTMLAttributes) => {
+ return (
+
+ );
+};
+WelcomeScreenMenuItem.displayName = "WelcomeScreenMenuItem";
+
+const WelcomeScreenMenuItemLink = ({
+ children,
+ href,
+ icon,
+ shortcut,
+ className = "",
+ ...props
+}: {
+ children: React.ReactNode;
+ href: string;
+ icon?: JSX.Element;
+ shortcut?: string | null;
+} & React.AnchorHTMLAttributes) => {
+ return (
+
+
+ {children}
+
+
+ );
+};
+WelcomeScreenMenuItemLink.displayName = "WelcomeScreenMenuItemLink";
+
+const Center = ({ children }: { children?: React.ReactNode }) => {
+ const { WelcomeScreenCenterTunnel } = useTunnels();
+ return (
+
+
+ {children || (
+ <>
+
+ {t("welcomeScreen.defaults.center_heading")}
+
+ >
+ )}
+
+
+ );
+};
+Center.displayName = "Center";
+
+const Logo = ({ children }: { children?: React.ReactNode }) => {
+ return (
+
+ {children || }
+
+ );
+};
+Logo.displayName = "Logo";
+
+const Heading = ({ children }: { children: React.ReactNode }) => {
+ return (
+
+ {children}
+
+ );
+};
+Heading.displayName = "Heading";
+
+const Menu = ({ children }: { children?: React.ReactNode }) => {
+ return {children}
;
+};
+Menu.displayName = "Menu";
+
+const MenuItemHelp = () => {
+ const actionManager = useExcalidrawActionManager();
+
+ return (
+ actionManager.executeAction(actionShortcuts)}
+ shortcut="?"
+ icon={HelpIcon}
+ >
+ {t("helpDialog.title")}
+
+ );
+};
+MenuItemHelp.displayName = "MenuItemHelp";
+
+const MenuItemLoadScene = () => {
+ const appState = useUIAppState();
+ const actionManager = useExcalidrawActionManager();
+
+ if (appState.viewModeEnabled) {
+ return null;
+ }
+
+ return (
+ actionManager.executeAction(actionLoadScene)}
+ shortcut={getShortcutFromShortcutName("loadScene")}
+ icon={LoadIcon}
+ >
+ {t("buttons.load")}
+
+ );
+};
+MenuItemLoadScene.displayName = "MenuItemLoadScene";
+
+const MenuItemLiveCollaborationTrigger = ({
+ onSelect,
+}: {
+ onSelect: () => any;
+}) => {
+ const { t } = useI18n();
+ return (
+
+ {t("labels.liveCollaboration")}
+
+ );
+};
+MenuItemLiveCollaborationTrigger.displayName =
+ "MenuItemLiveCollaborationTrigger";
+
+// -----------------------------------------------------------------------------
+
+Center.Logo = Logo;
+Center.Heading = Heading;
+Center.Menu = Menu;
+Center.MenuItem = WelcomeScreenMenuItem;
+Center.MenuItemLink = WelcomeScreenMenuItemLink;
+Center.MenuItemHelp = MenuItemHelp;
+Center.MenuItemLoadScene = MenuItemLoadScene;
+Center.MenuItemLiveCollaborationTrigger = MenuItemLiveCollaborationTrigger;
+
+export { Center };
--
cgit v1.2.3