diff --git a/package.json b/package.json index 5d6d01ff..0fe38e5d 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "daisyui": "^2.52.0", "nprogress": "^0.2.0", "playwright-e2e-coverage-report": "^1.0.28", + "svelte-tags-input": "^5.0.0", "theme-change": "^2.5.0" } } diff --git a/src/app.d.ts b/src/app.d.ts index f6f54253..083333c1 100644 --- a/src/app.d.ts +++ b/src/app.d.ts @@ -23,3 +23,5 @@ declare namespace svelteHTML { } declare const __VERSION__: string + +declare module 'svelte-tags-input' diff --git a/src/lib/components/Browse/DrawerCreateChannel.svelte b/src/lib/components/Browse/DrawerCreateChannel.svelte index 976e0b3c..d7338601 100644 --- a/src/lib/components/Browse/DrawerCreateChannel.svelte +++ b/src/lib/components/Browse/DrawerCreateChannel.svelte @@ -2,7 +2,7 @@ // import IconPhoto from '$lib/assets/icons/IconPhoto.svelte' import { tags } from '$lib/stores/channelStore' import { onMount } from 'svelte' - import Tags from '$lib/components/Browse/Tags.svelte' + import Tags from 'svelte-tags-input' import DrawerAddCategory from '$lib/components/Browse/DrawerAddCategory.svelte' import { get } from '$lib/api' import { enhance } from '$app/forms' @@ -28,7 +28,6 @@ showThumbnail = false, showAddCategory = false, maxTag = 3, - maxTagChars = 18, maxCategory = 4, isLoadingChannel = false @@ -65,7 +64,7 @@ newChannel = newChannel } - const onTagValidation = (evt: any) => { + const onValidation = (evt: any) => { if (Number(evt.target.value) < 1) { evt.target.setCustomValidity('Please fill out this field.') } @@ -165,7 +164,6 @@ 0 ? '' : 'Tag'} /> ({maxTagLabel}) @@ -177,7 +175,7 @@ min="1" class="opacity-0 pointer-events-none absolute left-0 right-0 mx-auto bottom-0" bind:value={newChannel.tags.length} - on:invalid={onTagValidation} /> + on:invalid={onValidation} /> {/if}
@@ -185,7 +183,6 @@ on:click={() => (showAddCategory = true)} type="text" name="category" - required={!newChannel.category.length} placeholder={newChannel?.category?.length ? '' : 'Category'} class="input input-primary input-bordered mt-5 w-full" /> ({maxCategoryLabel}) @@ -196,6 +193,16 @@ {/each} {/if} + {#if newChannel.category.length === 0} + + {/if}