AppWelcomeScreen.tsx 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import React from "react";
  2. import { PlusPromoIcon } from "../../packages/excalidraw/components/icons";
  3. import { useI18n } from "../../packages/excalidraw/i18n";
  4. import { WelcomeScreen } from "../../packages/excalidraw/index";
  5. import { isExcalidrawPlusSignedUser } from "../app_constants";
  6. import { POINTER_EVENTS } from "../../packages/excalidraw/constants";
  7. export const AppWelcomeScreen: React.FC<{
  8. setCollabDialogShown: (toggle: boolean) => any;
  9. isCollabEnabled: boolean;
  10. }> = React.memo((props) => {
  11. const { t } = useI18n();
  12. let headingContent;
  13. if (isExcalidrawPlusSignedUser) {
  14. headingContent = t("welcomeScreen.app.center_heading_plus")
  15. .split(/(Excalidraw\+)/)
  16. .map((bit, idx) => {
  17. if (bit === "Excalidraw+") {
  18. return (
  19. <a
  20. style={{ pointerEvents: POINTER_EVENTS.inheritFromUI }}
  21. href={`${
  22. import.meta.env.VITE_APP_PLUS_APP
  23. }?utm_source=excalidraw&utm_medium=app&utm_content=welcomeScreenSignedInUser`}
  24. key={idx}
  25. >
  26. Excalidraw+
  27. </a>
  28. );
  29. }
  30. return bit;
  31. });
  32. } else {
  33. headingContent = t("welcomeScreen.app.center_heading");
  34. }
  35. return (
  36. <WelcomeScreen>
  37. <WelcomeScreen.Hints.MenuHint>
  38. {t("welcomeScreen.app.menuHint")}
  39. </WelcomeScreen.Hints.MenuHint>
  40. <WelcomeScreen.Hints.ToolbarHint />
  41. <WelcomeScreen.Hints.HelpHint />
  42. <WelcomeScreen.Center>
  43. <WelcomeScreen.Center.Logo />
  44. <WelcomeScreen.Center.Heading>
  45. {headingContent}
  46. </WelcomeScreen.Center.Heading>
  47. <WelcomeScreen.Center.Menu>
  48. <WelcomeScreen.Center.MenuItemLoadScene />
  49. <WelcomeScreen.Center.MenuItemHelp />
  50. {props.isCollabEnabled && (
  51. <WelcomeScreen.Center.MenuItemLiveCollaborationTrigger
  52. onSelect={() => props.setCollabDialogShown(true)}
  53. />
  54. )}
  55. {!isExcalidrawPlusSignedUser && (
  56. <WelcomeScreen.Center.MenuItemLink
  57. href={`${
  58. import.meta.env.VITE_APP_PLUS_LP
  59. }/plus?utm_source=excalidraw&utm_medium=app&utm_content=welcomeScreenGuest`}
  60. shortcut={null}
  61. icon={PlusPromoIcon}
  62. >
  63. Try Excalidraw Plus!
  64. </WelcomeScreen.Center.MenuItemLink>
  65. )}
  66. </WelcomeScreen.Center.Menu>
  67. </WelcomeScreen.Center>
  68. </WelcomeScreen>
  69. );
  70. });