muzical-ui 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/AGENTS.md +5 -0
  2. package/CHANGELOG.md +30 -0
  3. package/CLAUDE.md +1 -0
  4. package/LICENSE.md +21 -0
  5. package/README.md +36 -0
  6. package/app/favicon.ico +0 -0
  7. package/app/globals.css +67 -0
  8. package/app/layout.tsx +49 -0
  9. package/app/musicbrainz/page.tsx +6 -0
  10. package/app/page.tsx +12 -0
  11. package/app/settings/display/page.tsx +11 -0
  12. package/app/settings/layout.tsx +19 -0
  13. package/app/settings/library/page.tsx +11 -0
  14. package/app/settings/page.tsx +5 -0
  15. package/app/settings/playback/page.tsx +11 -0
  16. package/app/settings/youtube/page.tsx +11 -0
  17. package/bin/stt-ui.js +25 -0
  18. package/components/AlbumCoverThumb.tsx +82 -0
  19. package/components/BrowsePanel.tsx +64 -0
  20. package/components/DisplaySettingsPanel.tsx +30 -0
  21. package/components/FavoriteStarButton.tsx +41 -0
  22. package/components/LibraryBrowser.tsx +1180 -0
  23. package/components/LibraryProvider.tsx +1023 -0
  24. package/components/LibraryScanNotification.tsx +62 -0
  25. package/components/LibraryScanOptionsSection.tsx +123 -0
  26. package/components/LibrarySettingsPanel.tsx +116 -0
  27. package/components/LibraryStatistics.tsx +54 -0
  28. package/components/MusicBrainzBrowser.tsx +395 -0
  29. package/components/MusicBrainzTrackRow.tsx +52 -0
  30. package/components/MusicPlayer.tsx +1531 -0
  31. package/components/PanelResizeHandle.tsx +65 -0
  32. package/components/PlaybackSettingsPanel.tsx +32 -0
  33. package/components/QueueLoadingSpinner.tsx +19 -0
  34. package/components/SettingsNav.tsx +37 -0
  35. package/components/SettingsOverview.tsx +34 -0
  36. package/components/SettingsShell.tsx +47 -0
  37. package/components/SettingsSwitchRow.tsx +38 -0
  38. package/components/ThemeProvider.tsx +75 -0
  39. package/components/ThemeToggle.tsx +38 -0
  40. package/components/YouTubeSettingsPanel.tsx +79 -0
  41. package/components/YouTubeStreamNotification.tsx +30 -0
  42. package/components/format-library-root-added.ts +13 -0
  43. package/components/settings-nav-items.ts +40 -0
  44. package/eslint.config.mjs +18 -0
  45. package/lib/format-duration.ts +9 -0
  46. package/lib/format-total-library-duration.ts +14 -0
  47. package/lib/library/audio-filename.ts +31 -0
  48. package/lib/library/collect-tracks-for-meta.ts +91 -0
  49. package/lib/library/compute-library-stats.ts +37 -0
  50. package/lib/library/constants.ts +27 -0
  51. package/lib/library/cover-bytes-cache.ts +59 -0
  52. package/lib/library/default-library-scan-preferences.ts +13 -0
  53. package/lib/library/extract-cover-bytes-from-audio-file.ts +41 -0
  54. package/lib/library/extract-cover-object-url-from-audio-file.ts +31 -0
  55. package/lib/library/favorite-keys.ts +14 -0
  56. package/lib/library/format-fs-access-error.ts +29 -0
  57. package/lib/library/idb.ts +270 -0
  58. package/lib/library/read-audio-metadata.ts +34 -0
  59. package/lib/library/read-stored-library-scan-preferences.ts +43 -0
  60. package/lib/library/resolve-track-file.ts +26 -0
  61. package/lib/library/scan-preferences-to-tree-options.ts +15 -0
  62. package/lib/library/scan-progress-label.ts +18 -0
  63. package/lib/library/scan-progress-percent.ts +19 -0
  64. package/lib/library/scan-progress-tick.ts +9 -0
  65. package/lib/library/scan-tree.ts +191 -0
  66. package/lib/library/write-stored-library-scan-preferences.ts +19 -0
  67. package/lib/mock-playlist.ts +47 -0
  68. package/lib/musicbrainz/build-musicbrainz-lucene-queries.ts +46 -0
  69. package/lib/musicbrainz/escape-lucene-term.ts +6 -0
  70. package/lib/musicbrainz/fetch-musicbrainz-json.ts +55 -0
  71. package/lib/musicbrainz/fetch-release-tracks.ts +53 -0
  72. package/lib/musicbrainz/group-tracks-by-album.ts +26 -0
  73. package/lib/musicbrainz/group-tracks-by-artist.ts +23 -0
  74. package/lib/musicbrainz/merge-tracks-by-id.ts +16 -0
  75. package/lib/musicbrainz/musicbrainz-recording-to-track.ts +42 -0
  76. package/lib/musicbrainz/pick-preferred-release.ts +32 -0
  77. package/lib/musicbrainz/pick-release-group-release-id.ts +12 -0
  78. package/lib/musicbrainz/release-group-artist-name.ts +13 -0
  79. package/lib/musicbrainz/search-musicbrainz-recordings.ts +33 -0
  80. package/lib/musicbrainz/search-musicbrainz-release-groups.ts +24 -0
  81. package/lib/musicbrainz/search-musicbrainz.ts +65 -0
  82. package/lib/musicbrainz/types.ts +43 -0
  83. package/lib/musicbrainz.ts +3 -0
  84. package/lib/playback/build-queue-from-snapshot.ts +49 -0
  85. package/lib/playback/parse-persisted-track.ts +45 -0
  86. package/lib/playback/read-stored-playback-snapshot.ts +45 -0
  87. package/lib/playback/write-stored-playback-snapshot.ts +19 -0
  88. package/lib/theme-constants.ts +4 -0
  89. package/lib/theme-init-script.ts +9 -0
  90. package/lib/youtube/clear-youtube-data-api-blocked.ts +8 -0
  91. package/lib/youtube/collect-youtube-prefetch-targets.ts +20 -0
  92. package/lib/youtube/is-youtube-quota-error-message.ts +7 -0
  93. package/lib/youtube/mark-youtube-data-api-blocked.ts +8 -0
  94. package/lib/youtube/prefetch-youtube-video-ids.ts +55 -0
  95. package/lib/youtube/read-stored-youtube-api-key.ts +16 -0
  96. package/lib/youtube/read-youtube-data-api-blocked.ts +12 -0
  97. package/lib/youtube/search-youtube-video-id.ts +60 -0
  98. package/lib/youtube/should-use-youtube-search-playback.ts +19 -0
  99. package/lib/youtube/write-stored-youtube-api-key.ts +18 -0
  100. package/next.config.ts +7 -0
  101. package/package.json +94 -0
  102. package/pnpm-workspace.yaml +6 -0
  103. package/postcss.config.mjs +7 -0
  104. package/public/file.svg +1 -0
  105. package/public/globe.svg +1 -0
  106. package/public/next.svg +1 -0
  107. package/public/vercel.svg +1 -0
  108. package/public/window.svg +1 -0
  109. package/tsconfig.json +34 -0
  110. package/types/file-system-access.d.ts +22 -0
  111. package/types/library-root-meta.ts +5 -0
  112. package/types/library-scan-preferences.ts +9 -0
  113. package/types/library-scan-progress.ts +8 -0
  114. package/types/persisted-playback-snapshot.ts +11 -0
  115. package/types/queue.ts +7 -0
  116. package/types/scan-tree-options.ts +6 -0
  117. package/types/track.ts +29 -0
package/AGENTS.md ADDED
@@ -0,0 +1,5 @@
1
+ <!-- BEGIN:nextjs-agent-rules -->
2
+ # This is NOT the Next.js you know
3
+
4
+ This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
5
+ <!-- END:nextjs-agent-rules -->
package/CHANGELOG.md ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ### 0.1.1 (2026-05-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * add more settings, queue persistence ([8a759b9](https://github.com/f3rnox/muzical-ui/commit/8a759b9f9fd294a0b7c29ec6e41db04bc30c44c3))
11
+ * add scan notification and scan on startup ([d73d5e7](https://github.com/f3rnox/muzical-ui/commit/d73d5e75112c75ceede00c3bf38cffd3ad64e48e))
12
+ * finish musicbrainz integration and add yt data api for playback ([7641d5e](https://github.com/f3rnox/muzical-ui/commit/7641d5e9b5b169aac013814e0e6943da64e7a06c))
13
+ * initial commit ([fe9b411](https://github.com/f3rnox/muzical-ui/commit/fe9b411d0f67a038f6ac8b3fe0a21dd7f57806f9))
14
+ * update ([4116257](https://github.com/f3rnox/muzical-ui/commit/41162577d715056be8544406919c62dfc8309e86))
15
+ * update ([fa94934](https://github.com/f3rnox/muzical-ui/commit/fa94934525eb72bdbcafa1eb6280d80572de2c1c))
16
+ * update ([ba023e6](https://github.com/f3rnox/muzical-ui/commit/ba023e6080cb061ff4e38bb02e463e541393b5f8))
17
+ * update ([a33bcf3](https://github.com/f3rnox/muzical-ui/commit/a33bcf34e449528f458ab1a2bc0eee81fa6fa5e9))
18
+ * update ([9b1020b](https://github.com/f3rnox/muzical-ui/commit/9b1020b5b6fe6b9863e5b00eaad680687180daa9))
19
+ * update ([d6aca7d](https://github.com/f3rnox/muzical-ui/commit/d6aca7ddd4c9e410896f3b97f664eab84148dc28))
20
+ * update manifest for release, add bin ([5b7bba5](https://github.com/f3rnox/muzical-ui/commit/5b7bba5318727c504ab29a41611ec5636b0d4c04))
21
+ * WIP musicbrainz ([fd51c92](https://github.com/f3rnox/muzical-ui/commit/fd51c92512511a8db6b809095d9b026dafa4f994))
22
+ * WIP musicbrainz integration ([f47cc07](https://github.com/f3rnox/muzical-ui/commit/f47cc07d8972dd9978f4d04016efa42d8ecadf2f))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * error ([223cbd6](https://github.com/f3rnox/muzical-ui/commit/223cbd682726a5f25a226e753f6bd7c984e1ebda))
28
+ * linter errors ([e281e80](https://github.com/f3rnox/muzical-ui/commit/e281e80042285a5e5a45a92860762ec2e0852885))
29
+ * linter warnings ([6c6ba71](https://github.com/f3rnox/muzical-ui/commit/6c6ba71ac268433161afe1672dfebb999c16a507))
30
+ * queue topbar alignment ([39d24b2](https://github.com/f3rnox/muzical-ui/commit/39d24b23ff8b2503b7cd191e4048274ca5f1a57c))
package/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ @AGENTS.md
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Cris Mihalache <f3rnox42@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
2
+
3
+ ## Getting Started
4
+
5
+ First, run the development server:
6
+
7
+ ```bash
8
+ npm run dev
9
+ # or
10
+ yarn dev
11
+ # or
12
+ pnpm dev
13
+ # or
14
+ bun dev
15
+ ```
16
+
17
+ Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18
+
19
+ You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20
+
21
+ This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
22
+
23
+ ## Learn More
24
+
25
+ To learn more about Next.js, take a look at the following resources:
26
+
27
+ - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
+ - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29
+
30
+ You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
31
+
32
+ ## Deploy on Vercel
33
+
34
+ The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35
+
36
+ Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
Binary file
@@ -0,0 +1,67 @@
1
+ @import "tailwindcss";
2
+
3
+ html {
4
+ height: 100%;
5
+ }
6
+
7
+ @custom-variant dark (&:where(.dark, .dark *));
8
+
9
+ :root {
10
+ --background: #fafafa;
11
+ --foreground: #171717;
12
+ }
13
+
14
+ .dark {
15
+ --background: #0a0a0a;
16
+ --foreground: #ededed;
17
+ }
18
+
19
+ /* Custom scrollbars (WebKit + Firefox). */
20
+ :root {
21
+ --scrollbar-track: rgba(63, 63, 70, 0.15);
22
+ --scrollbar-thumb: rgba(161, 161, 170, 0.7);
23
+ --scrollbar-thumb-hover: rgba(161, 161, 170, 0.95);
24
+ }
25
+
26
+ .dark {
27
+ --scrollbar-track: rgba(39, 39, 42, 0.7);
28
+ --scrollbar-thumb: rgba(82, 82, 91, 0.9);
29
+ --scrollbar-thumb-hover: rgba(82, 82, 91, 1);
30
+ }
31
+
32
+ * {
33
+ scrollbar-width: thin;
34
+ scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
35
+ }
36
+
37
+ *::-webkit-scrollbar {
38
+ width: 10px;
39
+ height: 10px;
40
+ }
41
+
42
+ *::-webkit-scrollbar-track {
43
+ background: var(--scrollbar-track);
44
+ }
45
+
46
+ *::-webkit-scrollbar-thumb {
47
+ background-color: var(--scrollbar-thumb);
48
+ border-radius: 9999px;
49
+ border: 2px solid var(--scrollbar-track);
50
+ }
51
+
52
+ *::-webkit-scrollbar-thumb:hover {
53
+ background-color: var(--scrollbar-thumb-hover);
54
+ }
55
+
56
+ @theme inline {
57
+ --color-background: var(--background);
58
+ --color-foreground: var(--foreground);
59
+ --font-sans: var(--font-geist-sans);
60
+ --font-mono: var(--font-geist-mono);
61
+ }
62
+
63
+ body {
64
+ height: 100%;
65
+ margin: 0;
66
+ font-family: var(--font-sans), ui-sans-serif, system-ui, sans-serif;
67
+ }
package/app/layout.tsx ADDED
@@ -0,0 +1,49 @@
1
+ import type { Metadata } from 'next'
2
+ import { Geist, Geist_Mono } from 'next/font/google'
3
+ import Script from 'next/script'
4
+ import { LibraryProvider } from '@/components/LibraryProvider'
5
+ import { ThemeProvider } from '@/components/ThemeProvider'
6
+ import { getThemeInitScript } from '@/lib/theme-init-script'
7
+ import './globals.css'
8
+
9
+ const geistSans = Geist({
10
+ variable: "--font-geist-sans",
11
+ subsets: ["latin"],
12
+ });
13
+
14
+ const geistMono = Geist_Mono({
15
+ variable: "--font-geist-mono",
16
+ subsets: ["latin"],
17
+ });
18
+
19
+ export const metadata: Metadata = {
20
+ title: 'Muzical',
21
+ description: 'Local music player',
22
+ }
23
+
24
+ export default function RootLayout({
25
+ children,
26
+ }: Readonly<{
27
+ children: React.ReactNode;
28
+ }>) {
29
+ return (
30
+ <html
31
+ lang="en"
32
+ suppressHydrationWarning
33
+ className={`${geistSans.variable} ${geistMono.variable} h-full min-h-0 antialiased`}
34
+ >
35
+ <body className="flex h-full min-h-0 flex-col overflow-hidden bg-background font-sans text-foreground">
36
+ <Script
37
+ id="theme-init"
38
+ strategy="beforeInteractive"
39
+ dangerouslySetInnerHTML={{ __html: getThemeInitScript() }}
40
+ />
41
+ <div className="flex min-h-0 flex-1 flex-col">
42
+ <ThemeProvider>
43
+ <LibraryProvider>{children}</LibraryProvider>
44
+ </ThemeProvider>
45
+ </div>
46
+ </body>
47
+ </html>
48
+ );
49
+ }
@@ -0,0 +1,6 @@
1
+ import { redirect } from 'next/navigation'
2
+
3
+ /** Legacy route; MusicBrainz lives in the player browse panel. */
4
+ export default function MusicBrainzPage() {
5
+ redirect('/?view=musicbrainz')
6
+ }
package/app/page.tsx ADDED
@@ -0,0 +1,12 @@
1
+ import { Suspense } from 'react'
2
+ import MusicPlayer from '@/components/MusicPlayer'
3
+
4
+ export default function Home() {
5
+ return (
6
+ <div className="flex h-full min-h-0 flex-1 flex-col">
7
+ <Suspense fallback={null}>
8
+ <MusicPlayer />
9
+ </Suspense>
10
+ </div>
11
+ )
12
+ }
@@ -0,0 +1,11 @@
1
+ import type { Metadata } from 'next'
2
+ import DisplaySettingsPanel from '@/components/DisplaySettingsPanel'
3
+
4
+ export const metadata: Metadata = {
5
+ title: 'Display · Settings · Muzical',
6
+ description: 'Display preferences for Muzical',
7
+ }
8
+
9
+ export default function DisplaySettingsPage() {
10
+ return <DisplaySettingsPanel />
11
+ }
@@ -0,0 +1,19 @@
1
+ import type { Metadata } from 'next'
2
+ import SettingsShell from '@/components/SettingsShell'
3
+
4
+ export const metadata: Metadata = {
5
+ title: 'Settings · Muzical',
6
+ description: 'Configure Muzical on this device',
7
+ }
8
+
9
+ export default function SettingsLayout({
10
+ children,
11
+ }: Readonly<{
12
+ children: React.ReactNode
13
+ }>) {
14
+ return (
15
+ <div className="flex h-full min-h-0 flex-1 flex-col">
16
+ <SettingsShell>{children}</SettingsShell>
17
+ </div>
18
+ )
19
+ }
@@ -0,0 +1,11 @@
1
+ import type { Metadata } from 'next'
2
+ import LibrarySettingsPanel from '@/components/LibrarySettingsPanel'
3
+
4
+ export const metadata: Metadata = {
5
+ title: 'Library · Settings · Muzical',
6
+ description: 'Configure local music library scan folders',
7
+ }
8
+
9
+ export default function LibrarySettingsPage() {
10
+ return <LibrarySettingsPanel />
11
+ }
@@ -0,0 +1,5 @@
1
+ import SettingsOverview from '@/components/SettingsOverview'
2
+
3
+ export default function SettingsPage() {
4
+ return <SettingsOverview />
5
+ }
@@ -0,0 +1,11 @@
1
+ import type { Metadata } from 'next'
2
+ import PlaybackSettingsPanel from '@/components/PlaybackSettingsPanel'
3
+
4
+ export const metadata: Metadata = {
5
+ title: 'Playback · Settings · Muzical',
6
+ description: 'Playback preferences for Muzical',
7
+ }
8
+
9
+ export default function PlaybackSettingsPage() {
10
+ return <PlaybackSettingsPanel />
11
+ }
@@ -0,0 +1,11 @@
1
+ import type { Metadata } from 'next'
2
+ import YouTubeSettingsPanel from '@/components/YouTubeSettingsPanel'
3
+
4
+ export const metadata: Metadata = {
5
+ title: 'YouTube · Settings · Muzical',
6
+ description: 'YouTube Data API configuration for Muzical',
7
+ }
8
+
9
+ export default function YoutubeSettingsPage() {
10
+ return <YouTubeSettingsPanel />
11
+ }
package/bin/stt-ui.js ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('node:child_process')
4
+ const path = require('node:path')
5
+
6
+ const packageRoot = path.resolve(__dirname, '..')
7
+ const nextBin = require.resolve('next/dist/bin/next')
8
+
9
+ const child = spawn(
10
+ process.execPath,
11
+ [nextBin, 'start', ...process.argv.slice(2)],
12
+ {
13
+ cwd: packageRoot,
14
+ stdio: 'inherit',
15
+ env: process.env,
16
+ },
17
+ )
18
+
19
+ child.on('exit', (code, signal) => {
20
+ if (signal) {
21
+ process.kill(process.pid, signal)
22
+ return
23
+ }
24
+ process.exit(code ?? 0)
25
+ })
@@ -0,0 +1,82 @@
1
+ 'use client'
2
+
3
+ import { useEffect, useState } from 'react'
4
+ import { useLibrary } from '@/components/LibraryProvider'
5
+ import type { Track } from '@/types/track'
6
+ import { getCoverBytesForTrack } from '@/lib/library/cover-bytes-cache'
7
+
8
+ type AlbumCoverThumbProps = {
9
+ /** Representative track (e.g. first on the album) — embedded art is read from its file */
10
+ track: Track | undefined
11
+ className?: string
12
+ }
13
+
14
+ /**
15
+ * Loads embedded cover art for a library track and shows a square thumbnail or letter fallback.
16
+ */
17
+ export default function AlbumCoverThumb(props: AlbumCoverThumbProps) {
18
+ const { track, className = 'h-12 w-12 shrink-0 overflow-hidden rounded-md ring-1 ring-zinc-200/80 dark:ring-zinc-700/80' } =
19
+ props
20
+ const { resolveFileForTrack } = useLibrary()
21
+ const [coverUrl, setCoverUrl] = useState<string | null>(null)
22
+
23
+ useEffect(() => {
24
+ let cancelled = false
25
+ let createdUrl: string | null = null
26
+
27
+ if (!track?.library) {
28
+ void Promise.resolve().then(() => {
29
+ if (!cancelled) setCoverUrl(null)
30
+ })
31
+ return (): void => {
32
+ cancelled = true
33
+ }
34
+ }
35
+
36
+ const t = track
37
+
38
+ void (async (): Promise<void> => {
39
+ const file = await resolveFileForTrack(t)
40
+ if (cancelled || !file) return
41
+ const bytes = await getCoverBytesForTrack(t.id, file)
42
+ if (cancelled) return
43
+ if (!bytes) {
44
+ setCoverUrl(null)
45
+ return
46
+ }
47
+ const u = URL.createObjectURL(new Blob([bytes.data], { type: bytes.mime }))
48
+ if (cancelled) {
49
+ if (u) URL.revokeObjectURL(u)
50
+ return
51
+ }
52
+ createdUrl = u
53
+ setCoverUrl(u)
54
+ })()
55
+
56
+ return (): void => {
57
+ cancelled = true
58
+ if (createdUrl) URL.revokeObjectURL(createdUrl)
59
+ }
60
+ }, [track, resolveFileForTrack])
61
+
62
+ const letter = track?.album?.trim().charAt(0) || '♪'
63
+
64
+ return (
65
+ <div
66
+ className={[
67
+ 'relative bg-linear-to-br from-amber-200/70 via-zinc-100 to-zinc-200 dark:from-amber-900/35 dark:via-zinc-800 dark:to-zinc-900',
68
+ className,
69
+ ].join(' ')}
70
+ aria-hidden
71
+ >
72
+ {coverUrl ? (
73
+ // eslint-disable-next-line @next/next/no-img-element -- blob URL from tags
74
+ <img src={coverUrl} alt="" className="absolute inset-0 h-full w-full object-cover" decoding="async" />
75
+ ) : (
76
+ <span className="flex h-full w-full items-center justify-center text-lg font-semibold tracking-tight text-amber-900/25 dark:text-zinc-600/90">
77
+ {letter}
78
+ </span>
79
+ )}
80
+ </div>
81
+ )
82
+ }
@@ -0,0 +1,64 @@
1
+ 'use client'
2
+
3
+ import { useCallback } from 'react'
4
+ import { usePathname, useRouter, useSearchParams } from 'next/navigation'
5
+ import LibraryBrowser from '@/components/LibraryBrowser'
6
+ import MusicBrainzBrowser from '@/components/MusicBrainzBrowser'
7
+
8
+ export type BrowseView = 'library' | 'musicbrainz'
9
+
10
+ const BROWSE_VIEWS: readonly BrowseView[] = ['library', 'musicbrainz']
11
+
12
+ function parseBrowseView(raw: string | null): BrowseView {
13
+ return raw === 'musicbrainz' ? 'musicbrainz' : 'library'
14
+ }
15
+
16
+ /**
17
+ * Left-panel shell: switch between local library browse and MusicBrainz discovery.
18
+ */
19
+ export default function BrowsePanel() {
20
+ const router = useRouter()
21
+ const pathname = usePathname()
22
+ const searchParams = useSearchParams()
23
+ const view = parseBrowseView(searchParams.get('view'))
24
+
25
+ const setView = useCallback(
26
+ (next: BrowseView) => {
27
+ const params = new URLSearchParams(searchParams.toString())
28
+ if (next === 'musicbrainz') {
29
+ params.set('view', 'musicbrainz')
30
+ } else {
31
+ params.delete('view')
32
+ }
33
+ const qs = params.toString()
34
+ router.replace(qs ? `${pathname}?${qs}` : pathname, { scroll: false })
35
+ },
36
+ [pathname, router, searchParams],
37
+ )
38
+
39
+ return (
40
+ <div className="flex h-full min-h-0 flex-1 flex-col overflow-hidden">
41
+ <div className="flex h-11 shrink-0 items-center gap-1 border-b border-zinc-200 bg-white/80 px-3 dark:border-zinc-800 dark:bg-zinc-950/80">
42
+ {BROWSE_VIEWS.map((id) => (
43
+ <button
44
+ key={id}
45
+ type="button"
46
+ onClick={() => setView(id)}
47
+ className={[
48
+ 'cursor-pointer rounded-full px-3 py-1.5 text-xs font-medium capitalize transition',
49
+ view === id
50
+ ? 'bg-amber-500 text-zinc-950'
51
+ : 'bg-zinc-200 text-zinc-700 hover:bg-zinc-300 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:bg-zinc-700',
52
+ ].join(' ')}
53
+ aria-pressed={view === id}
54
+ >
55
+ {id === 'musicbrainz' ? 'MusicBrainz' : 'Library'}
56
+ </button>
57
+ ))}
58
+ </div>
59
+ <div className="min-h-0 flex-1 overflow-hidden">
60
+ {view === 'library' ? <LibraryBrowser /> : <MusicBrainzBrowser />}
61
+ </div>
62
+ </div>
63
+ )
64
+ }
@@ -0,0 +1,30 @@
1
+ 'use client'
2
+
3
+ import { useLibrary } from '@/components/LibraryProvider'
4
+ import SettingsSwitchRow from '@/components/SettingsSwitchRow'
5
+
6
+ /**
7
+ * Display settings: list density and related UI preferences.
8
+ */
9
+ export default function DisplaySettingsPanel() {
10
+ const { compactLists, setCompactLists } = useLibrary()
11
+
12
+ return (
13
+ <div className="flex flex-col gap-8">
14
+ <div>
15
+ <h2 className="text-lg font-semibold tracking-tight text-zinc-900 dark:text-zinc-100">Display</h2>
16
+ <p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400">Adjust how lists and panels look in the player.</p>
17
+ </div>
18
+
19
+ <section className="rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-800 dark:bg-zinc-900/40">
20
+ <SettingsSwitchRow
21
+ title="Compact UI"
22
+ description="Tighter spacing in the player, queue, and library browser."
23
+ checked={compactLists}
24
+ onChange={setCompactLists}
25
+ ariaLabel="Enable compact UI"
26
+ />
27
+ </section>
28
+ </div>
29
+ )
30
+ }
@@ -0,0 +1,41 @@
1
+ 'use client'
2
+
3
+ type FavoriteStarButtonProps = {
4
+ filled: boolean
5
+ onPress: () => void
6
+ label: string
7
+ /** Merged after base styles; omit for default circular hit target. */
8
+ className?: string
9
+ }
10
+
11
+ /**
12
+ * Toggle control for favoriting artists, albums, or tracks.
13
+ */
14
+ export default function FavoriteStarButton(props: FavoriteStarButtonProps) {
15
+ const { filled, onPress, label, className } = props
16
+ return (
17
+ <button
18
+ type="button"
19
+ onClick={(e) => {
20
+ e.stopPropagation()
21
+ e.preventDefault()
22
+ onPress()
23
+ }}
24
+ aria-label={label}
25
+ aria-pressed={filled}
26
+ className={[
27
+ 'inline-flex h-7 w-7 shrink-0 items-center justify-center self-center leading-none text-amber-600 transition hover:bg-amber-500/15 hover:text-amber-700 dark:text-amber-400 dark:hover:bg-amber-500/10 dark:hover:text-amber-300',
28
+ className ?? 'rounded-full',
29
+ ].join(' ')}
30
+ >
31
+ <svg viewBox="0 0 24 24" className="block h-4 w-4 shrink-0" fill={filled ? 'currentColor' : 'none'} aria-hidden>
32
+ <path
33
+ stroke="currentColor"
34
+ strokeWidth="1.75"
35
+ strokeLinejoin="round"
36
+ d="M12 3.5l2.35 4.76 5.26.77-3.8 3.7.9 5.24L12 15.9 6.29 18l.9-5.24-3.8-3.7 5.26-.77L12 3.5z"
37
+ />
38
+ </svg>
39
+ </button>
40
+ )
41
+ }