|
@@ -8,8 +8,14 @@ import { NonDeletedExcalidrawElement } from "../element/types";
|
|
import { Language, t } from "../i18n";
|
|
import { Language, t } from "../i18n";
|
|
import { calculateScrollCenter } from "../scene";
|
|
import { calculateScrollCenter } from "../scene";
|
|
import { ExportType } from "../scene/types";
|
|
import { ExportType } from "../scene/types";
|
|
-import { AppProps, AppState, ExcalidrawProps, BinaryFiles } from "../types";
|
|
|
|
-import { muteFSAbortError } from "../utils";
|
|
|
|
|
|
+import {
|
|
|
|
+ AppProps,
|
|
|
|
+ AppState,
|
|
|
|
+ ExcalidrawProps,
|
|
|
|
+ BinaryFiles,
|
|
|
|
+ UIChildrenComponents,
|
|
|
|
+} from "../types";
|
|
|
|
+import { muteFSAbortError, ReactChildrenToObject } from "../utils";
|
|
import { SelectedShapeActions, ShapesSwitcher } from "./Actions";
|
|
import { SelectedShapeActions, ShapesSwitcher } from "./Actions";
|
|
import CollabButton from "./CollabButton";
|
|
import CollabButton from "./CollabButton";
|
|
import { ErrorDialog } from "./ErrorDialog";
|
|
import { ErrorDialog } from "./ErrorDialog";
|
|
@@ -38,7 +44,7 @@ import { trackEvent } from "../analytics";
|
|
import { isMenuOpenAtom, useDevice } from "../components/App";
|
|
import { isMenuOpenAtom, useDevice } from "../components/App";
|
|
import { Stats } from "./Stats";
|
|
import { Stats } from "./Stats";
|
|
import { actionToggleStats } from "../actions/actionToggleStats";
|
|
import { actionToggleStats } from "../actions/actionToggleStats";
|
|
-import Footer from "./Footer";
|
|
|
|
|
|
+import Footer from "./footer/Footer";
|
|
import {
|
|
import {
|
|
ExportImageIcon,
|
|
ExportImageIcon,
|
|
HamburgerMenuIcon,
|
|
HamburgerMenuIcon,
|
|
@@ -71,7 +77,6 @@ interface LayerUIProps {
|
|
langCode: Language["code"];
|
|
langCode: Language["code"];
|
|
isCollaborating: boolean;
|
|
isCollaborating: boolean;
|
|
renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
|
|
renderTopRightUI?: ExcalidrawProps["renderTopRightUI"];
|
|
- renderCustomFooter?: ExcalidrawProps["renderFooter"];
|
|
|
|
renderCustomStats?: ExcalidrawProps["renderCustomStats"];
|
|
renderCustomStats?: ExcalidrawProps["renderCustomStats"];
|
|
renderCustomSidebar?: ExcalidrawProps["renderSidebar"];
|
|
renderCustomSidebar?: ExcalidrawProps["renderSidebar"];
|
|
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
|
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
|
|
@@ -81,7 +86,9 @@ interface LayerUIProps {
|
|
id: string;
|
|
id: string;
|
|
onImageAction: (data: { insertOnCanvasDirectly: boolean }) => void;
|
|
onImageAction: (data: { insertOnCanvasDirectly: boolean }) => void;
|
|
renderWelcomeScreen: boolean;
|
|
renderWelcomeScreen: boolean;
|
|
|
|
+ children?: React.ReactNode;
|
|
}
|
|
}
|
|
|
|
+
|
|
const LayerUI = ({
|
|
const LayerUI = ({
|
|
actionManager,
|
|
actionManager,
|
|
appState,
|
|
appState,
|
|
@@ -96,7 +103,7 @@ const LayerUI = ({
|
|
showExitZenModeBtn,
|
|
showExitZenModeBtn,
|
|
isCollaborating,
|
|
isCollaborating,
|
|
renderTopRightUI,
|
|
renderTopRightUI,
|
|
- renderCustomFooter,
|
|
|
|
|
|
+
|
|
renderCustomStats,
|
|
renderCustomStats,
|
|
renderCustomSidebar,
|
|
renderCustomSidebar,
|
|
libraryReturnUrl,
|
|
libraryReturnUrl,
|
|
@@ -106,9 +113,13 @@ const LayerUI = ({
|
|
id,
|
|
id,
|
|
onImageAction,
|
|
onImageAction,
|
|
renderWelcomeScreen,
|
|
renderWelcomeScreen,
|
|
|
|
+ children,
|
|
}: LayerUIProps) => {
|
|
}: LayerUIProps) => {
|
|
const device = useDevice();
|
|
const device = useDevice();
|
|
|
|
|
|
|
|
+ const childrenComponents =
|
|
|
|
+ ReactChildrenToObject<UIChildrenComponents>(children);
|
|
|
|
+
|
|
const renderJSONExportDialog = () => {
|
|
const renderJSONExportDialog = () => {
|
|
if (!UIOptions.canvasActions.export) {
|
|
if (!UIOptions.canvasActions.export) {
|
|
return null;
|
|
return null;
|
|
@@ -481,7 +492,6 @@ const LayerUI = ({
|
|
onPenModeToggle={onPenModeToggle}
|
|
onPenModeToggle={onPenModeToggle}
|
|
canvas={canvas}
|
|
canvas={canvas}
|
|
isCollaborating={isCollaborating}
|
|
isCollaborating={isCollaborating}
|
|
- renderCustomFooter={renderCustomFooter}
|
|
|
|
onImageAction={onImageAction}
|
|
onImageAction={onImageAction}
|
|
renderTopRightUI={renderTopRightUI}
|
|
renderTopRightUI={renderTopRightUI}
|
|
renderCustomStats={renderCustomStats}
|
|
renderCustomStats={renderCustomStats}
|
|
@@ -514,9 +524,11 @@ const LayerUI = ({
|
|
renderWelcomeScreen={renderWelcomeScreen}
|
|
renderWelcomeScreen={renderWelcomeScreen}
|
|
appState={appState}
|
|
appState={appState}
|
|
actionManager={actionManager}
|
|
actionManager={actionManager}
|
|
- renderCustomFooter={renderCustomFooter}
|
|
|
|
showExitZenModeBtn={showExitZenModeBtn}
|
|
showExitZenModeBtn={showExitZenModeBtn}
|
|
- />
|
|
|
|
|
|
+ >
|
|
|
|
+ {childrenComponents.FooterCenter}
|
|
|
|
+ </Footer>
|
|
|
|
+
|
|
{appState.showStats && (
|
|
{appState.showStats && (
|
|
<Stats
|
|
<Stats
|
|
appState={appState}
|
|
appState={appState}
|
|
@@ -563,7 +575,6 @@ const areEqual = (prev: LayerUIProps, next: LayerUIProps) => {
|
|
const keys = Object.keys(prevAppState) as (keyof Partial<AppState>)[];
|
|
const keys = Object.keys(prevAppState) as (keyof Partial<AppState>)[];
|
|
|
|
|
|
return (
|
|
return (
|
|
- prev.renderCustomFooter === next.renderCustomFooter &&
|
|
|
|
prev.renderTopRightUI === next.renderTopRightUI &&
|
|
prev.renderTopRightUI === next.renderTopRightUI &&
|
|
prev.renderCustomStats === next.renderCustomStats &&
|
|
prev.renderCustomStats === next.renderCustomStats &&
|
|
prev.renderCustomSidebar === next.renderCustomSidebar &&
|
|
prev.renderCustomSidebar === next.renderCustomSidebar &&
|