Startup now uses the Android iris animation, and playback can continue in a corner miniplayer while browsing (the video is drawn into a corner rectangle beneath a matching hole in the page). The player keeps the window controls, hides its chrome when the pointer leaves, and gains audio/subtitle tracks, audio sync, source bitrate and playback details in its options. Subtitles can be styled in Settings with a live preview. Categories replace Collections, the A–Z rail magnifies, descriptions expand in place, downloads can be removed in bulk, and search keeps its results while typing. Fixes scroll jank from per-card and scrolling backdrop blurs, the hidden colour wash, the cubic volume curve, loud theme music, the search focus ring, a stray nav indicator, Continue Watching previews and the TV Shows header overlap. Removes the star rating, the duplicate Settings menu entry and the server settings' Show advanced switch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.7 KiB
TypeScript
68 lines
2.7 KiB
TypeScript
import { useEffect, useRef, useState } from 'react';
|
|
import type { Item } from '../plex/types';
|
|
import { useServer } from '../app/session';
|
|
import { useSettings } from '../app/settings';
|
|
import { art, washGradient } from '../app/format';
|
|
|
|
interface Layer {
|
|
key: number;
|
|
src: string;
|
|
wash: string;
|
|
ready: boolean;
|
|
}
|
|
|
|
/**
|
|
* Artwork-led page background. The image sits top-right and fades into the
|
|
* page toward its left and bottom edges; the UltraBlur colour wash tints the
|
|
* page beneath it and carries on down behind the rows. Changes crossfade; the
|
|
* outgoing layer stays until the new image has decoded.
|
|
*/
|
|
export function Backdrop({ item, className = '', width = 1600, height = 900, wash: forceWash }: { item: Item | null | undefined; className?: string; width?: number; height?: number; wash?: Item['ultraBlur'] }) {
|
|
const server = useServer();
|
|
const colorWash = useSettings((s) => s.colorWash);
|
|
const [layers, setLayers] = useState<Layer[]>([]);
|
|
const counter = useRef(0);
|
|
const path = item ? art.backdrop(item) : '';
|
|
const src = path ? server.image(path, width, height) : '';
|
|
const blur = forceWash ?? item?.ultraBlur ?? null;
|
|
const wash = colorWash && blur ? washGradient(blur) : '';
|
|
|
|
useEffect(() => {
|
|
if (!src && !wash) return;
|
|
setLayers((prev) => {
|
|
if (prev.length && prev[prev.length - 1].src === src) {
|
|
// Same art, maybe new wash.
|
|
return prev.map((l, i) => (i === prev.length - 1 ? { ...l, wash } : l));
|
|
}
|
|
return [...prev.slice(-1), { key: ++counter.current, src, wash, ready: !src }];
|
|
});
|
|
}, [src, wash]);
|
|
|
|
const onReady = (key: number) =>
|
|
setLayers((prev) => {
|
|
const idx = prev.findIndex((l) => l.key === key);
|
|
if (idx < 0) return prev;
|
|
const next = prev.map((l) => (l.key === key ? { ...l, ready: true } : l));
|
|
// Drop older layers once the newest is visible (after its fade).
|
|
setTimeout(() => setLayers((p) => (p.length > 1 && p[p.length - 1].key === key ? p.slice(-1) : p)), 500);
|
|
return next;
|
|
});
|
|
|
|
return (
|
|
<>
|
|
{colorWash && (
|
|
<div className={`backdrop-tint ${className}`} aria-hidden="true">
|
|
{layers.map((l) => l.wash && <div key={l.key} className={`backdrop-wash${l.ready ? ' ready' : ''}`} style={{ background: l.wash }} />)}
|
|
</div>
|
|
)}
|
|
<div className={`backdrop ${className}${colorWash ? ' washed' : ''}`} aria-hidden="true">
|
|
{layers.map((l) => (
|
|
<div key={l.key} className={`backdrop-layer${l.ready ? ' ready' : ''}`}>
|
|
{l.src && <img className="backdrop-art" src={l.src} alt="" draggable={false} decoding="async" onLoad={() => onReady(l.key)} onError={() => onReady(l.key)} />}
|
|
</div>
|
|
))}
|
|
<div className="backdrop-scrim" />
|
|
</div>
|
|
</>
|
|
);
|
|
}
|