diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 9f33fd8c35..7c5686df77 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2283,5 +2283,10 @@ }, "bookmark_buttons": { "bookmarks": "Bookmarks" + }, + "import_preview": { + "title": "Import preview", + "notes_count_one": "{{count}} notes", + "notes_count_other": "{{count}} note" } } diff --git a/apps/client/src/widgets/dialogs/help.tsx b/apps/client/src/widgets/dialogs/help.tsx index f6c0c96d60..c4a21c0905 100644 --- a/apps/client/src/widgets/dialogs/help.tsx +++ b/apps/client/src/widgets/dialogs/help.tsx @@ -1,11 +1,12 @@ -import Modal from "../react/Modal.jsx"; -import { t } from "../../services/i18n.js"; -import { ComponentChildren } from "preact"; -import appContext, { CommandNames } from "../../components/app_context.js"; -import RawHtml from "../react/RawHtml.jsx"; import { useEffect, useState } from "preact/hooks"; + +import appContext, { CommandNames } from "../../components/app_context.js"; +import { t } from "../../services/i18n.js"; import keyboard_actions from "../../services/keyboard_actions.js"; +import { Card } from "../react/Card.jsx"; import { useTriliumEvent } from "../react/hooks.jsx"; +import Modal from "../react/Modal.jsx"; +import RawHtml from "../react/RawHtml.jsx"; export default function HelpDialog() { const [ shown, setShown ] = useState(false); @@ -110,7 +111,7 @@ export default function HelpDialog() { function KeyboardShortcut({ commands, description }: { commands: CommandNames | CommandNames[], description: string }) { const [ shortcuts, setShortcuts ] = useState([]); - + useEffect(() => { (async () => { const shortcuts: string[] = []; @@ -148,20 +149,6 @@ function FixedKeyboardShortcut({ keys, description }: { keys?: string[], descrip ); } -function Card({ title, children }: { title: string, children: ComponentChildren }) { - return ( -
-
-
{title}
- -

- {children} -

-
-
- ) -} - function editShortcuts() { appContext.tabManager.openContextWithNote("_optionsShortcuts", { activate: true }); -} \ No newline at end of file +} diff --git a/apps/client/src/widgets/dialogs/import_preview.tsx b/apps/client/src/widgets/dialogs/import_preview.tsx index 0b887b3042..29b1e4a074 100644 --- a/apps/client/src/widgets/dialogs/import_preview.tsx +++ b/apps/client/src/widgets/dialogs/import_preview.tsx @@ -1,6 +1,8 @@ import { ImportPreviewResponse } from "@triliumnext/commons"; import { useState } from "preact/hooks"; +import { t } from "../../services/i18n"; +import { Card } from "../react/Card"; import { useTriliumEvent } from "../react/hooks"; import Modal from "../react/Modal"; @@ -9,7 +11,11 @@ export interface ImportPreviewData { } export default function ImportPreviewDialog() { - const [ data, setData ] = useState(JSON.parse(`{"isDangerous":true,"dangerousAttributes":["iconPack"],"dangerousAttributeCategories":["iconPack"],"numNotes":1,"id":"llpCPOmcBGhW5.trilium"}`)); + const [ data, setData ] = useState({ + previews: [ + JSON.parse(`{"isDangerous":true,"dangerousAttributes":["iconPack"],"dangerousAttributeCategories":["iconPack"],"numNotes":1,"id":"llpCPOmcBGhW5.trilium"}`) + ] + }); const [ shown, setShown ] = useState(true); useTriliumEvent("showImportPreviewDialog", (data) => { @@ -21,14 +27,22 @@ export default function ImportPreviewDialog() { { setShown(false); setData(null); }} > -

Preview goes here.

+ {data?.previews.map(preview => )}
); } + +function SinglePreview({ preview }: { preview: ImportPreviewResponse }) { + return ( + + {t("import_preview.notes_count", { count: preview.numNotes })} + + ); +} diff --git a/apps/client/src/widgets/react/Card.tsx b/apps/client/src/widgets/react/Card.tsx new file mode 100644 index 0000000000..401e55ed43 --- /dev/null +++ b/apps/client/src/widgets/react/Card.tsx @@ -0,0 +1,15 @@ +import type { ComponentChildren } from "preact"; + +export function Card({ title, children }: { title: string, children: ComponentChildren }) { + return ( +
+
+
{title}
+ +

+ {children} +

+
+
+ ); +}