From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 15 Mar 2026 16:19:35 -0400 Subject: refactor: packages/ --- .../OverwriteConfirm/OverwriteConfirmActions.tsx | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.tsx (limited to 'packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.tsx') diff --git a/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.tsx b/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.tsx new file mode 100644 index 0000000..5da0a08 --- /dev/null +++ b/packages/excalidraw/components/OverwriteConfirm/OverwriteConfirmActions.tsx @@ -0,0 +1,85 @@ +import React from "react"; +import { FilledButton } from "../FilledButton"; +import { useExcalidrawActionManager, useExcalidrawSetAppState } from "../App"; +import { actionSaveFileToDisk } from "../../actions"; +import { useI18n } from "../../i18n"; +import { actionChangeExportEmbedScene } from "../../actions/actionExport"; + +export type ActionProps = { + title: string; + children: React.ReactNode; + actionLabel: string; + onClick: () => void; +}; + +export const Action = ({ + title, + children, + actionLabel, + onClick, +}: ActionProps) => { + return ( +
+

{title}

+
+ {children} +
+ +
+ ); +}; + +export const ExportToImage = () => { + const { t } = useI18n(); + const actionManager = useExcalidrawActionManager(); + const setAppState = useExcalidrawSetAppState(); + + return ( + { + actionManager.executeAction(actionChangeExportEmbedScene, "ui", true); + setAppState({ openDialog: { name: "imageExport" } }); + }} + > + {t("overwriteConfirm.action.exportToImage.description")} + + ); +}; + +export const SaveToDisk = () => { + const { t } = useI18n(); + const actionManager = useExcalidrawActionManager(); + + return ( + { + actionManager.executeAction(actionSaveFileToDisk, "ui"); + }} + > + {t("overwriteConfirm.action.saveToDisk.description")} + + ); +}; + +const Actions = Object.assign( + ({ children }: { children: React.ReactNode }) => { + return
{children}
; + }, + { + ExportToImage, + SaveToDisk, + }, +); + +export { Actions }; -- cgit v1.2.3