diff --git a/apps/client/src/components/common/export-modal.tsx b/apps/client/src/components/common/export-modal.tsx index a53094d4..25f4d328 100644 --- a/apps/client/src/components/common/export-modal.tsx +++ b/apps/client/src/components/common/export-modal.tsx @@ -29,19 +29,22 @@ export default function ExportModal({ }: ExportModalProps) { const [format, setFormat] = useState(ExportFormat.Markdown); const [includeChildren, setIncludeChildren] = useState(false); - const [includeAttachments, setIncludeAttachments] = useState(true); + const [includeAttachments, setIncludeAttachments] = useState(false); const { t } = useTranslation(); const handleExport = async () => { try { if (type === "page") { - await exportPage({ pageId: id, format, includeChildren }); + await exportPage({ + pageId: id, + format, + includeChildren, + includeAttachments, + }); } if (type === "space") { await exportSpace({ spaceId: id, format, includeAttachments }); } - setIncludeChildren(false); - setIncludeAttachments(true); onClose(); } catch (err) { notifications.show({ @@ -96,6 +99,18 @@ export default function ExportModal({ checked={includeChildren} /> + + +
+ {t("Include attachments")} +
+ + setIncludeAttachments(event.currentTarget.checked) + } + checked={includeAttachments} + /> +
)} diff --git a/apps/client/src/features/page/components/page-export-modal.tsx b/apps/client/src/features/page/components/page-export-modal.tsx deleted file mode 100644 index 9b51910f..00000000 --- a/apps/client/src/features/page/components/page-export-modal.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import { Modal, Button, Group, Text, Select, Switch } from "@mantine/core"; -import { exportPage } from "@/features/page/services/page-service.ts"; -import { useState } from "react"; -import * as React from "react"; -import { ExportFormat } from "@/features/page/types/page.types.ts"; -import { notifications } from "@mantine/notifications"; -import { useTranslation } from "react-i18next"; - -interface PageExportModalProps { - pageId: string; - open: boolean; - onClose: () => void; -} - -export default function PageExportModal({ - pageId, - open, - onClose, -}: PageExportModalProps) { - const { t } = useTranslation(); - const [format, setFormat] = useState(ExportFormat.Markdown); - - const handleExport = async () => { - try { - await exportPage({ pageId: pageId, format }); - onClose(); - } catch (err) { - notifications.show({ - message: t("Export failed:") + err.response?.data.message, - color: "red", - }); - console.error("export error", err); - } - }; - - const handleChange = (format: ExportFormat) => { - setFormat(format); - }; - - return ( - - - - - {t("Export page")} - - - - -
- {t("Format")} -
- -
- - -
- {t("Include subpages")} -
- -
- - - - - -
-
-
- ); -} - -interface ExportFormatSelection { - format: ExportFormat; - onChange: (value: string) => void; -} -function ExportFormatSelection({ format, onChange }: ExportFormatSelection) { - const { t } = useTranslation(); - - return ( -