anki/ts/import-csv/DupeResolutionSelector.svelte
RumovZ 5a53da23ca
Deck scoped dupe check (#2372)
* Support limiting dupe check to deck

* Expose deck limiting dupe check on frontend

* Make CSV dupe options configurable with headers

* Rename duplicate file headers

* Change dupe check limit to enum
2023-02-16 17:53:36 +10:00

46 lines
1.4 KiB
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import * as tr from "@tslib/ftl";
import { ImportExport } from "@tslib/proto";
import Col from "../components/Col.svelte";
import Row from "../components/Row.svelte";
import Select from "../components/Select.svelte";
import SelectOption from "../components/SelectOption.svelte";
export let dupeResolution: ImportExport.CsvMetadata.DupeResolution;
const dupeResolutions = [
{
value: ImportExport.CsvMetadata.DupeResolution.UPDATE,
label: tr.importingUpdate(),
},
{
value: ImportExport.CsvMetadata.DupeResolution.DUPLICATE,
label: tr.importingDuplicate(),
},
{
value: ImportExport.CsvMetadata.DupeResolution.PRESERVE,
label: tr.importingPreserve(),
},
];
$: label = dupeResolutions.find((r) => r.value === dupeResolution)?.label;
</script>
<Row --cols={2}>
<Col --col-size={1}>
{tr.importingExistingNotes()}
</Col>
<Col --col-size={1}>
<Select bind:value={dupeResolution} {label}>
{#each dupeResolutions as { label, value }}
<SelectOption {value}>{label}</SelectOption>
{/each}
</Select>
</Col>
</Row>