From f63841e69f1ae77800a0bd2b9b4dc1a82ad193ee Mon Sep 17 00:00:00 2001 From: Yuri Tatishchev Date: Fri, 6 Feb 2026 11:17:06 -0800 Subject: [PATCH] songs add single song type to filters --- bun.lock | 4 +- package.json | 2 +- src/lib/components/ui/native-select/index.ts | 12 ++++++ .../native-select-opt-group.svelte | 14 +++++++ .../native-select/native-select-option.svelte | 14 +++++++ .../ui/native-select/native-select.svelte | 38 +++++++++++++++++++ src/routes/songs/+page.svelte | 13 +++++++ src/routes/songs/+page.ts | 1 + src/routes/songs/schema.ts | 1 + 9 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 src/lib/components/ui/native-select/index.ts create mode 100644 src/lib/components/ui/native-select/native-select-opt-group.svelte create mode 100644 src/lib/components/ui/native-select/native-select-option.svelte create mode 100644 src/lib/components/ui/native-select/native-select.svelte diff --git a/bun.lock b/bun.lock index 17e82f7..ba2d758 100644 --- a/bun.lock +++ b/bun.lock @@ -7,7 +7,7 @@ "devDependencies": { "@biomejs/biome": "^2.3.14", "@internationalized/date": "^3.10.0", - "@lucide/svelte": "^0.563.1", + "@lucide/svelte": "^0.561.0", "@sveltejs/adapter-auto": "^7.0.0", "@sveltejs/adapter-cloudflare": "^7.2.6", "@sveltejs/kit": "^2.50.1", @@ -200,7 +200,7 @@ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], - "@lucide/svelte": ["@lucide/svelte@0.563.1", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-Kt+MbnE5D9RsuI/csmf7M+HWxALe57x3A0DhQ8pPnnUpneh7zuldrYjlT+veWtk+tVnp5doQtaAAxLujzIlhBw=="], + "@lucide/svelte": ["@lucide/svelte@0.561.0", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-vofKV2UFVrKE6I4ewKJ3dfCXSV6iP6nWVmiM83MLjsU91EeJcEg7LoWUABLp/aOTxj1HQNbJD1f3g3L0JQgH9A=="], "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], diff --git a/package.json b/package.json index 6d4f7fd..86cab8f 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "devDependencies": { "@biomejs/biome": "^2.3.14", "@internationalized/date": "^3.10.0", - "@lucide/svelte": "^0.563.1", + "@lucide/svelte": "^0.561.0", "@sveltejs/adapter-auto": "^7.0.0", "@sveltejs/adapter-cloudflare": "^7.2.6", "@sveltejs/kit": "^2.50.1", diff --git a/src/lib/components/ui/native-select/index.ts b/src/lib/components/ui/native-select/index.ts new file mode 100644 index 0000000..4aebbe1 --- /dev/null +++ b/src/lib/components/ui/native-select/index.ts @@ -0,0 +1,12 @@ +import Root from "./native-select.svelte"; +import Option from "./native-select-option.svelte"; +import OptGroup from "./native-select-opt-group.svelte"; + +export { + Root, + Option, + OptGroup, + Root as NativeSelect, + Option as NativeSelectOption, + OptGroup as NativeSelectOptGroup, +}; diff --git a/src/lib/components/ui/native-select/native-select-opt-group.svelte b/src/lib/components/ui/native-select/native-select-opt-group.svelte new file mode 100644 index 0000000..16339f1 --- /dev/null +++ b/src/lib/components/ui/native-select/native-select-opt-group.svelte @@ -0,0 +1,14 @@ + + + + {@render children?.()} + diff --git a/src/lib/components/ui/native-select/native-select-option.svelte b/src/lib/components/ui/native-select/native-select-option.svelte new file mode 100644 index 0000000..10c9e29 --- /dev/null +++ b/src/lib/components/ui/native-select/native-select-option.svelte @@ -0,0 +1,14 @@ + + + diff --git a/src/lib/components/ui/native-select/native-select.svelte b/src/lib/components/ui/native-select/native-select.svelte new file mode 100644 index 0000000..ac8328c --- /dev/null +++ b/src/lib/components/ui/native-select/native-select.svelte @@ -0,0 +1,38 @@ + + +
+ +
diff --git a/src/routes/songs/+page.svelte b/src/routes/songs/+page.svelte index 868d06c..67e7f48 100644 --- a/src/routes/songs/+page.svelte +++ b/src/routes/songs/+page.svelte @@ -7,6 +7,10 @@ import { Button } from "$lib/components/ui/button"; import { Input } from "$lib/components/ui/input"; import { Label } from "$lib/components/ui/label"; + import { + NativeSelect, + NativeSelectOption, + } from "$lib/components/ui/native-select"; import { db as clientDb } from "$lib/db/client-db"; import { addAllToQueue, playAllNext } from "$lib/player/player.svelte"; import { trackFromSongRow } from "$lib/player/types"; @@ -118,6 +122,15 @@ /> +
+ + + All + OP + ED + INS + +
diff --git a/src/routes/songs/+page.ts b/src/routes/songs/+page.ts index ffcfb7e..ee8476e 100644 --- a/src/routes/songs/+page.ts +++ b/src/routes/songs/+page.ts @@ -19,6 +19,7 @@ export const load: PageLoad = async ({ url, fetch, depends }) => { filters.globalPercentMin = parsed.data.gpm; if (parsed.data.gpx !== undefined) filters.globalPercentMax = parsed.data.gpx; + if (parsed.data.songType) filters.songTypes = [parsed.data.songType]; } // Client-only DB: on the server `db` is null, so return [] and let hydration re-run load in browser. diff --git a/src/routes/songs/schema.ts b/src/routes/songs/schema.ts index 068b501..2541077 100644 --- a/src/routes/songs/schema.ts +++ b/src/routes/songs/schema.ts @@ -6,4 +6,5 @@ export const SearchParamsSchema = z.object({ anime: z.string().optional().default(""), gpm: z.coerce.number().int().optional().default(0), gpx: z.coerce.number().int().optional().default(100), + songType: z.coerce.number().int().optional().default(0), });