feat(music): redesign the music section around the player

- album, playlist and artist pages share one layout: sleeve with a record edge, large title, metadata, full-width track list and an about block
- full-screen player: wall colour from the cover's blurhash, large sleeve, transport at the bottom, queue sliding out from under the cover
- queue rows show current/upcoming tracks with covers, hearts and durations; lyrics open in the same panel
- bottom bar follows: floating capsule, white play button and accent progress
- artist page rebuilt with a round portrait, tabs and an album grid
- music library gets a calmer grid and an aligned alphabet rail
This commit is contained in:
1xDed committed 2026-12-01 02:48:05 +03:00
1 parent fcf61012db
commit 9f314582c0
13 files changed
+2105 -1505

No files matched your search

+84
View File
@@ -0,0 +1,84 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { decode } from "blurhash";
type Palette = {
/** Main wall colour of the player. */
base: string;
/** Darker end of the vertical gradient. */
deep: string;
};
const FALLBACK: Palette = { base: "hsl(266 32% 22%)", deep: "hsl(266 40% 9%)" };
const clamp = (value: number, min: number, max: number) =>
Math.min(max, Math.max(min, value));
const rgbToHsl = (r: number, g: number, b: number) => {
const rn = r / 255;
const gn = g / 255;
const bn = b / 255;
const max = Math.max(rn, gn, bn);
const min = Math.min(rn, gn, bn);
const l = (max + min) / 2;
let h = 0;
let s = 0;
if (max !== min) {
const d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch (max) {
case rn:
h = (gn - bn) / d + (gn < bn ? 6 : 0);
break;
case gn:
h = (bn - rn) / d + 2;
break;
default:
h = (rn - gn) / d + 4;
}
h /= 6;
}
return { h: h * 360, s, l };
};
const hsl = (h: number, s: number, l: number) =>
`hsl(${Math.round(h)} ${Math.round(s * 100)}% ${Math.round(l * 100)}%)`;
/**
* The player wall follows the record: decode the cover's blurhash, average it
* and turn it into a muted, slightly saturated background. Blurhash is local
* (no CORS/network work), and the artwork always ships one from Jellyfin.
*/
export const getCoverPalette = (item?: BaseItemDto | null): Palette => {
const tag = item?.ImageTags?.Primary;
const hash = tag ? item?.ImageBlurHashes?.Primary?.[tag] : undefined;
if (!hash) return FALLBACK;
try {
const size = 32;
const pixels = decode(hash, size, size);
let r = 0;
let g = 0;
let b = 0;
let count = 0;
for (let i = 0; i < pixels.length; i += 4) {
r += pixels[i];
g += pixels[i + 1];
b += pixels[i + 2];
count++;
}
if (!count) return FALLBACK;
const { h, s, l } = rgbToHsl(r / count, g / count, b / count);
// A wall, not a black rectangle: keep a hint of the cover's hue and
// lift it into a comfortable mid-dark range.
const wallSaturation = clamp(s + 0.14, 0.16, 0.42);
const wallLightness = clamp(l + 0.1, 0.16, 0.3);
return {
base: hsl(h, wallSaturation, wallLightness),
deep: hsl(h, wallSaturation, clamp(wallLightness * 0.45, 0.05, 0.12)),
};
} catch {
return FALLBACK;
}
};