diff --git a/ftl/core/importing.ftl b/ftl/core/importing.ftl index 3b9f7c401..b23d12654 100644 --- a/ftl/core/importing.ftl +++ b/ftl/core/importing.ftl @@ -48,6 +48,7 @@ importing-merge-notetypes-help = Warning: This will require a one-way sync, and may mark existing notes as modified. importing-mnemosyne-20-deck-db = Mnemosyne 2.0 Deck (*.db) importing-multicharacter-separators-are-not-supported-please = Multi-character separators are not supported. Please enter one character only. +importing-new-deck-will-be-created = A new deck will be created: { $name } importing-notes-added-from-file = Notes added from file: { $val } importing-notes-found-in-file = Notes found in file: { $val } importing-notes-skipped-as-theyre-already-in = Notes skipped, as up-to-date copies are already in your collection: { $val } diff --git a/ts/routes/import-csv/ImportOptions.svelte b/ts/routes/import-csv/ImportOptions.svelte index 2acde50eb..5e7c76b28 100644 --- a/ts/routes/import-csv/ImportOptions.svelte +++ b/ts/routes/import-csv/ImportOptions.svelte @@ -17,12 +17,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { dupeResolutionChoices, matchScopeChoices } from "./choices"; import type { ImportCsvState } from "./lib"; + import Warning from "../deck-options/Warning.svelte"; export let state: ImportCsvState; const metadata = state.metadata; const globalNotetype = state.globalNotetype; const deckId = state.deckId; + const deckName = state.newDeckName; const settings = { notetype: { @@ -64,6 +66,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html modal.show(); carousel.to(index); } + + const choices = state.deckNameIds.map(({ id, name }) => { + return { label: name, value: id }; + }); + + if (deckName) { + choices.push({ + label: deckName, + value: 0n, + }); + } + + $: newDeckCreationNotice = + deckName && $deckId === 0n + ? tr.importingNewDeckWillBeCreated({ name: deckName }) + : ""; @@ -95,13 +113,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if} - {#if $deckId !== null} + {#if deckName || $deckId} { - return { label: name, value: id }; - })} + {choices} > openHelpModal(Object.keys(settings).indexOf("deck"))} @@ -111,6 +127,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if} + +