diff --git a/src/components/import/import.svelte b/src/components/import/import.svelte index 1682684..452b73b 100644 --- a/src/components/import/import.svelte +++ b/src/components/import/import.svelte @@ -16,6 +16,8 @@ import { importDefaultShortforms, importShortforms } from '../../db/import'; import { createShortformList, type List } from '../../db/main'; + import { ScrollArea } from "$lib/components/ui/scroll-area/index.js"; + $: form = { textarea: '', name: '', @@ -24,6 +26,17 @@ let importing = false; let progress = 0; const handleImport = async () => { + importState.errors = [] + if (form.textarea == "") { + console.error("no name error") + importState.errors.push("Importfältet är tomt") + return + } + if (form.name == "") { + console.error("no name error") + importState.errors.push("Du måste döpa förkortningslistan till något") + return + } importing = true; const l: List = { name: form.name, type: form.type ? 1 : 0, updated: new Date() }; const listid = await createShortformList(l); @@ -81,7 +94,19 @@ förkn=förkortningen -

{importState.errors}

+ + {#if importState.errors.length > 0} + + + + {/if} diff --git a/src/lib/components/ui/scroll-area/index.ts b/src/lib/components/ui/scroll-area/index.ts new file mode 100644 index 0000000..e86a25b --- /dev/null +++ b/src/lib/components/ui/scroll-area/index.ts @@ -0,0 +1,10 @@ +import Scrollbar from "./scroll-area-scrollbar.svelte"; +import Root from "./scroll-area.svelte"; + +export { + Root, + Scrollbar, + //, + Root as ScrollArea, + Scrollbar as ScrollAreaScrollbar, +}; diff --git a/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte b/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte new file mode 100644 index 0000000..71b3328 --- /dev/null +++ b/src/lib/components/ui/scroll-area/scroll-area-scrollbar.svelte @@ -0,0 +1,27 @@ + + + + + + diff --git a/src/lib/components/ui/scroll-area/scroll-area.svelte b/src/lib/components/ui/scroll-area/scroll-area.svelte new file mode 100644 index 0000000..e8e368c --- /dev/null +++ b/src/lib/components/ui/scroll-area/scroll-area.svelte @@ -0,0 +1,32 @@ + + + + + + + + + {#if orientation === "vertical" || orientation === "both"} + + {/if} + {#if orientation === "horizontal" || orientation === "both"} + + {/if} + +