2023-01-31 13:53:20 +01:00
|
|
|
import React from "react";
|
2023-12-12 07:02:51 +01:00
|
|
|
import { PlusPromoIcon } from "../../packages/excalidraw/components/icons";
|
|
|
|
import { useI18n } from "../../packages/excalidraw/i18n";
|
|
|
|
import { WelcomeScreen } from "../../packages/excalidraw/index";
|
2023-01-31 13:53:20 +01:00
|
|
|
import { isExcalidrawPlusSignedUser } from "../app_constants";
|
2023-12-12 07:02:51 +01:00
|
|
|
import { POINTER_EVENTS } from "../../packages/excalidraw/constants";
|
2023-01-31 13:53:20 +01:00
|
|
|
|
|
|
|
export const AppWelcomeScreen: React.FC<{
|
|
|
|
setCollabDialogShown: (toggle: boolean) => any;
|
2023-06-12 17:44:31 +02:00
|
|
|
isCollabEnabled: boolean;
|
2023-01-31 13:53:20 +01:00
|
|
|
}> = React.memo((props) => {
|
2023-02-22 15:01:23 +01:00
|
|
|
const { t } = useI18n();
|
2023-01-31 13:53:20 +01:00
|
|
|
let headingContent;
|
|
|
|
|
|
|
|
if (isExcalidrawPlusSignedUser) {
|
|
|
|
headingContent = t("welcomeScreen.app.center_heading_plus")
|
|
|
|
.split(/(Excalidraw\+)/)
|
|
|
|
.map((bit, idx) => {
|
|
|
|
if (bit === "Excalidraw+") {
|
|
|
|
return (
|
|
|
|
<a
|
2023-09-19 16:01:40 +02:00
|
|
|
style={{ pointerEvents: POINTER_EVENTS.inheritFromUI }}
|
2023-07-27 20:20:11 +02:00
|
|
|
href={`${
|
|
|
|
import.meta.env.VITE_APP_PLUS_APP
|
|
|
|
}?utm_source=excalidraw&utm_medium=app&utm_content=welcomeScreenSignedInUser`}
|
2023-01-31 13:53:20 +01:00
|
|
|
key={idx}
|
|
|
|
>
|
|
|
|
Excalidraw+
|
|
|
|
</a>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return bit;
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
headingContent = t("welcomeScreen.app.center_heading");
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<WelcomeScreen>
|
|
|
|
<WelcomeScreen.Hints.MenuHint>
|
|
|
|
{t("welcomeScreen.app.menuHint")}
|
|
|
|
</WelcomeScreen.Hints.MenuHint>
|
|
|
|
<WelcomeScreen.Hints.ToolbarHint />
|
|
|
|
<WelcomeScreen.Hints.HelpHint />
|
|
|
|
<WelcomeScreen.Center>
|
|
|
|
<WelcomeScreen.Center.Logo />
|
|
|
|
<WelcomeScreen.Center.Heading>
|
|
|
|
{headingContent}
|
|
|
|
</WelcomeScreen.Center.Heading>
|
|
|
|
<WelcomeScreen.Center.Menu>
|
|
|
|
<WelcomeScreen.Center.MenuItemLoadScene />
|
|
|
|
<WelcomeScreen.Center.MenuItemHelp />
|
2023-06-12 17:44:31 +02:00
|
|
|
{props.isCollabEnabled && (
|
|
|
|
<WelcomeScreen.Center.MenuItemLiveCollaborationTrigger
|
|
|
|
onSelect={() => props.setCollabDialogShown(true)}
|
|
|
|
/>
|
|
|
|
)}
|
2023-01-31 13:53:20 +01:00
|
|
|
{!isExcalidrawPlusSignedUser && (
|
|
|
|
<WelcomeScreen.Center.MenuItemLink
|
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=welcomeScreenGuest`}
|
2023-01-31 13:53:20 +01:00
|
|
|
shortcut={null}
|
|
|
|
icon={PlusPromoIcon}
|
|
|
|
>
|
|
|
|
Try Excalidraw Plus!
|
|
|
|
</WelcomeScreen.Center.MenuItemLink>
|
|
|
|
)}
|
|
|
|
</WelcomeScreen.Center.Menu>
|
|
|
|
</WelcomeScreen.Center>
|
|
|
|
</WelcomeScreen>
|
|
|
|
);
|
|
|
|
});
|