import React from "react";
import { GithubIcon } from "../../packages/excalidraw/components/icons";
import { useI18n } from "../../packages/excalidraw/i18n";
import { WelcomeScreen } from "../../packages/excalidraw/index";
import { isExcalidrawPlusSignedUser } from "../app_constants";
import { POINTER_EVENTS } from "../../packages/excalidraw/constants";
import { useAtom } from "jotai";
import { userAtom } from "../app-jotai";
export const AppWelcomeScreen: React.FC<{
onCollabDialogOpen: () => any;
isCollabEnabled: boolean;
}> = React.memo((props) => {
const { t } = useI18n();
const [user] = useAtom(userAtom);
let headingContent;
if (isExcalidrawPlusSignedUser) {
headingContent = t("welcomeScreen.app.center_heading_plus")
.split(/(Excalidraw\+)/)
.map((bit, idx) => {
if (bit === "Excalidraw+") {
return (
Excalidraw+
);
}
return bit;
});
} else {
headingContent = t("welcomeScreen.app.center_heading");
}
return (
{t("welcomeScreen.app.menuHint")}
{headingContent}
{props.isCollabEnabled && (
props.onCollabDialogOpen()}
/>
)}
{!user && (
{
window.location.href = "/auth/github/login";
}}
icon={GithubIcon}
>
Login with GitHub
)}
);
});