diff --git a/package.json b/package.json index 3d4b90e..6d58904 100644 --- a/package.json +++ b/package.json @@ -38,11 +38,12 @@ "type": "module", "dependencies": { "@radix-ui/react-icons": "^1.3.0", - "bits-ui": "^0.21.4", + "bits-ui": "^0.21.7", "clsx": "^2.1.0", "formsnap": "^1.0.0", "js-cookie": "^3.0.5", "radix-icons-svelte": "^1.2.1", + "svelte-radix": "^1.1.0", "tailwind-merge": "^2.3.0", "tailwind-variants": "^0.2.1", "ts-md5": "^1.3.1", diff --git a/src/lib/components/ui/checkbox/checkbox.svelte b/src/lib/components/ui/checkbox/checkbox.svelte new file mode 100644 index 0000000..68bb996 --- /dev/null +++ b/src/lib/components/ui/checkbox/checkbox.svelte @@ -0,0 +1,35 @@ + + + + + {#if isIndeterminate} + + {:else} + + {/if} + + diff --git a/src/lib/components/ui/checkbox/index.ts b/src/lib/components/ui/checkbox/index.ts new file mode 100644 index 0000000..6d92d94 --- /dev/null +++ b/src/lib/components/ui/checkbox/index.ts @@ -0,0 +1,6 @@ +import Root from "./checkbox.svelte"; +export { + Root, + // + Root as Checkbox, +}; diff --git a/src/routes/album/[albumId]/+page.svelte b/src/routes/album/[albumId]/+page.svelte index a95b3c2..6e762b8 100644 --- a/src/routes/album/[albumId]/+page.svelte +++ b/src/routes/album/[albumId]/+page.svelte @@ -14,6 +14,7 @@ import {Button} from "$lib/components/ui/button"; import {shuffle} from "$lib/utilities"; import {displayTime} from "$lib/utilities.js"; + import {Checkbox} from "$lib/components/ui/checkbox"; class AlbumData { data: AlbumID3WithSongs = $state({}) } @@ -123,6 +124,19 @@ } } + async function toggleStarred() { + const parameters = [ + {key: "albumId", value: album.data.id} + ]; + if (album.data.starred) { + await OpenSubsonic.get("unstar", parameters); + } + else { + await OpenSubsonic.get("star", parameters) + } + fetchAlbumInfos(); + } + onMount(() => { fetchAlbumInfos(); }) @@ -140,6 +154,9 @@

{album.info.lastFmUrl}

{album.info.musicBrainzId}

Length: {displayTime(album.data.duration)}

+

{album.data.genre}

+

{"*".repeat(album.data.userRating)}

+ toggleStarred()} />
diff --git a/yarn.lock b/yarn.lock index 8c45667..f031212 100644 --- a/yarn.lock +++ b/yarn.lock @@ -805,10 +805,10 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== -bits-ui@^0.21.4: - version "0.21.4" - resolved "https://registry.yarnpkg.com/bits-ui/-/bits-ui-0.21.4.tgz#dac98b85f8a5bd01a12169ca1f2ce45a4aa63d1f" - integrity sha512-IL+7s19GW561jwkeYk23dwkTfQ9606I062qqv2AtjCdhhIdoOEJNVBX0kjP5xefSaS6ojL0HGG54att0aRTcAQ== +bits-ui@^0.21.7: + version "0.21.7" + resolved "https://registry.yarnpkg.com/bits-ui/-/bits-ui-0.21.7.tgz#bd43ee86194802396823880385e7575fbd2b3c3a" + integrity sha512-1PKp90ly1R6jexIiAUj1Dk4u2pln7ok+L8Vc0rHMY7pi7YZvadFNZvkp1G5BtmL8qh2xsn4MVNgKjPAQMCxW0A== dependencies: "@internationalized/date" "^3.5.1" "@melt-ui/svelte" "0.76.2" @@ -2286,6 +2286,11 @@ svelte-preprocess@^5.1.3: sorcery "^0.11.0" strip-indent "^3.0.0" +svelte-radix@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/svelte-radix/-/svelte-radix-1.1.0.tgz#5fb0c8d37422ea4863649180f6277af2d8b70dd3" + integrity sha512-kyE9wZiJV937INGb+wiBkAjmGtQUUYRPkVL2Q+/gj+9Vog1Ewd2wNvNmpNMUd+c+euxoc5u5YZMuCUgky9EUPw== + svelte@^5.0.0-next: version "5.0.0-next.115" resolved "https://registry.yarnpkg.com/svelte/-/svelte-5.0.0-next.115.tgz#43fe80829eb6c783e891888a7df07a5d8f854a64"