From 43c168da95abd37612fe95a07216f7128fd85d1b Mon Sep 17 00:00:00 2001 From: Elijah Date: Fri, 30 Oct 2026 18:06:54 -0700 Subject: [PATCH] Address the first beta's bugs and requested changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- CHANGELOG.md | 17 ++ docs/architecture.md | 11 +- src-tauri/src/lib.rs | 1 + src-tauri/src/platform/linux.rs | 1 + src-tauri/src/platform/macos.rs | 1 + src-tauri/src/platform/mod.rs | 2 +- src-tauri/src/platform/windows.rs | 21 +- src-tauri/src/player.rs | 22 ++ src/app/App.tsx | 11 +- src/app/TopBar.tsx | 9 +- src/app/router.ts | 4 +- src/app/settings.ts | 41 ++- src/main.tsx | 3 +- src/player/PlayerOverlay.tsx | 308 ++++++++++++++++--- src/player/engine.ts | 2 + src/player/store.ts | 118 +++++++- src/player/theme.ts | 16 +- src/plex/api.ts | 8 +- src/screens/Downloads.tsx | 42 ++- src/screens/Item.tsx | 53 +--- src/screens/LibraryBrowser.tsx | 28 +- src/screens/Search.tsx | 5 +- src/screens/Section.tsx | 75 +++-- src/screens/Splash.tsx | 427 +++++++++++++++++++++++++-- src/screens/categories.ts | 78 +++++ src/screens/settings/AppSettings.tsx | 104 ++++++- src/screens/settings/ServerPrefs.tsx | 19 +- src/styles/app.css | 121 ++++---- src/styles/base.css | 17 ++ src/styles/player.css | 193 ++++++++++++ src/styles/screens.css | 278 ++++++++++++++--- src/ui/Backdrop.tsx | 28 +- src/ui/Hero.tsx | 22 +- src/ui/HoverPreview.tsx | 5 +- src/ui/media.tsx | 7 +- 35 files changed, 1771 insertions(+), 327 deletions(-) create mode 100644 src/screens/categories.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f573d1..1ccfa93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## Unreleased + +- New startup animation: the iris opens and the view flies through the aperture, as on Kaleido for TV. +- Miniplayer: the player's back arrow (or Esc) keeps the video playing in the corner while you browse. +- Window controls stay available in the player, and its controls also hide when the pointer leaves the window. +- Playback options now include audio and subtitle tracks, audio sync, the source bitrate for Original quality, subtitle size and background, and playback details. +- Subtitle styling in Settings (size, colour, edge, background, bold, position) with a live preview. +- Categories replace Collections in Movies and TV Shows: genre tiles with artwork that open a filtered library. +- Smoother scrolling: per-card and scrolling backdrop blurs were re-rendering every frame. +- The artwork colour wash is visible again and carries down the page. +- The volume slider follows loudness (halfway is about half as loud), and theme music is much quieter and follows the player volume. +- Search keeps results on screen while you type; the A–Z rail is easier to see and magnifies under the pointer; long descriptions expand when clicked. +- Featured titles rotate faster and preload their artwork; hovering Continue Watching shows a preview. +- Downloads: Remove all (everything, a show, or all movies) and a simpler page. +- Removed: the five-star rating, the duplicate Settings entry in the profile menu and the server settings' Show advanced switch (everything is shown). +- Fixed: double focus ring in search, a stray dot under the navigation, and overlapping text on the TV Shows header. + ## 0.1.0-beta.1 First beta of Kaleido for Windows. diff --git a/docs/architecture.md b/docs/architecture.md index 5af3343..740d222 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -13,7 +13,7 @@ src/ Shared interface (all platforms) plex/ Plex client: account (plex.tv), library API, admin, playback, parsing player/ Playback controller (store.ts), mpv bridge, player overlay downloads/ Download catalog and actions - screens/ Home, Movies/TV (Discover/Library/Collections), title pages, + screens/ Home, Movies/TV (Discover/Library/Categories), title pages, search, people, downloads, settings, dialogs ui/ Design system: primitives, menus/dialogs/toasts, cards, hero styles/ Tokens and styles (base, ui, app, screens, player) @@ -37,14 +37,14 @@ Each exposes the same items: | Item | Windows implementation | | --- | --- | -| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. | +| `VideoSurface` | mpv renders with `d3d11-output-mode=composition`; its swapchain (`display-swapchain`) is set as the content of a DirectComposition visual targeted at the window with `topmost = false`, i.e. behind the web view's child windows. For the miniplayer the visual is offset and mpv's composition size shrunk to a corner rectangle (`player_rect`). | | `MPV_LIBRARIES` | `libmpv-2.dll` | | `hold_awake` | `SetThreadExecutionState` while video plays | macOS and Linux currently provide stubs for `VideoSurface` (browsing, downloads, settings and updates work; playback reports that it is unavailable). To add playback there, render through mpv's render API into a layer beneath the web view and implement -the same five methods. Per-OS bundling (libmpv, targets, dependencies) lives in +the same methods (`set_rect` places the video in part of the window for the miniplayer). Per-OS bundling (libmpv, targets, dependencies) lives in `tauri.macos.conf.json` and `tauri.linux.conf.json`. Credentials use the platform's keychain through the `keyring` crate with per-OS features in `Cargo.toml`. @@ -67,6 +67,9 @@ transparent only while video is visible (`html.video-active`), so browsing is op timestamps kept absolute. If direct play fails, playback retries through Plex once. Plex streams are matched to mpv tracks by stream index; external subtitles are added on demand. Timeline reports every 10 seconds make the session appear in Plex, and the - title is marked watched at the configured percentage. + title is marked watched at the configured percentage. The player's back arrow (or Esc) + shrinks playback into a miniplayer: the video is drawn in a corner rectangle and the + interface stays visible around it, with a matching hole masked out of the page + (`html.player-mini`). - **Updates**: `app/updater.ts` checks the signed feed on start; installs need the user's confirmation and then relaunch. diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 3fad8f2..dba919c 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -40,6 +40,7 @@ pub fn run() { .invoke_handler(tauri::generate_handler![ player::player_init, player::player_show, + player::player_rect, player::player_command, player::player_set, player::player_get, diff --git a/src-tauri/src/platform/linux.rs b/src-tauri/src/platform/linux.rs index d287122..5609089 100644 --- a/src-tauri/src/platform/linux.rs +++ b/src-tauri/src/platform/linux.rs @@ -23,6 +23,7 @@ impl VideoSurface { pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} pub fn show(&mut self, _: bool) {} pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} + pub fn set_rect(&mut self, _: &WebviewWindow, _: Option<&Mpv>, _: Option<(i32, i32, i32, i32)>) {} } pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { diff --git a/src-tauri/src/platform/macos.rs b/src-tauri/src/platform/macos.rs index 44a51bc..638cee2 100644 --- a/src-tauri/src/platform/macos.rs +++ b/src-tauri/src/platform/macos.rs @@ -23,6 +23,7 @@ impl VideoSurface { pub fn on_property(&mut self, _: &str, _: &serde_json::Value) {} pub fn show(&mut self, _: bool) {} pub fn fit(&mut self, _: &WebviewWindow, _: Option<&Mpv>) {} + pub fn set_rect(&mut self, _: &WebviewWindow, _: Option<&Mpv>, _: Option<(i32, i32, i32, i32)>) {} } pub fn hold_awake(rx: std::sync::mpsc::Receiver<()>) { diff --git a/src-tauri/src/platform/mod.rs b/src-tauri/src/platform/mod.rs index 2478be7..4d5f5e0 100644 --- a/src-tauri/src/platform/mod.rs +++ b/src-tauri/src/platform/mod.rs @@ -2,7 +2,7 @@ //! Each platform file exposes the same items: //! //! - `VideoSurface`: composes mpv's output beneath the web view -//! (`create`, `mpv_options`, `on_property`, `show`, `fit`). +//! (`create`, `mpv_options`, `on_property`, `show`, `fit`, `set_rect`). //! - `SURFACE_PROPERTIES`: mpv properties the surface observes. //! - `MPV_LIBRARIES`: libmpv file names to look for. //! - `hold_awake`: prevents display sleep until the receiver closes. diff --git a/src-tauri/src/platform/windows.rs b/src-tauri/src/platform/windows.rs index 9ec0543..9eb1777 100644 --- a/src-tauri/src/platform/windows.rs +++ b/src-tauri/src/platform/windows.rs @@ -15,6 +15,8 @@ pub struct VideoSurface { _target: IDCompositionTarget, root: IDCompositionVisual, visible: bool, + /// Where the video is drawn, in client pixels; `None` fills the window. + rect: Option<(i32, i32, i32, i32)>, pub width: i32, pub height: i32, } @@ -49,6 +51,7 @@ impl VideoSurface { _target: target, root, visible: false, + rect: None, width, height, }) @@ -102,9 +105,20 @@ impl VideoSurface { } } + /// Matches mpv's composition size and the visual's position to the + /// window's client area, or to the miniplayer rectangle when one is set. pub fn fit(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>) { let Ok(h) = window.hwnd() else { return }; - let (w, h) = client_size(HWND(h.0 as _)); + let (cw, ch) = client_size(HWND(h.0 as _)); + let (x, y, w, h) = match self.rect { + Some((x, y, w, h)) => (x, y, w.max(16), h.max(16)), + None => (0, 0, cw, ch), + }; + unsafe { + let _ = self.root.SetOffsetX2(x as f32); + let _ = self.root.SetOffsetY2(y as f32); + let _ = self.device.Commit(); + } if (w, h) == (self.width, self.height) { return; } @@ -114,6 +128,11 @@ impl VideoSurface { let _ = mpv.set_property("d3d11-composition-size", &serde_json::Value::String(format!("{w}x{h}"))); } } + + pub fn set_rect(&mut self, window: &WebviewWindow, mpv: Option<&Mpv>, rect: Option<(i32, i32, i32, i32)>) { + self.rect = rect; + self.fit(window, mpv); + } } /// mpv properties the surface needs to observe. diff --git a/src-tauri/src/player.rs b/src-tauri/src/player.rs index 43f2d3e..0e8cb5f 100644 --- a/src-tauri/src/player.rs +++ b/src-tauri/src/player.rs @@ -180,6 +180,28 @@ pub async fn player_show(app: AppHandle, window: WebviewWindow Ok(()) } +#[derive(Deserialize)] +pub struct VideoRect { + x: f64, + y: f64, + width: f64, + height: f64, +} + +/// Draws the video in a rectangle of the window (physical pixels), for the +/// miniplayer; `None` fills the window again. +#[tauri::command] +pub async fn player_rect(app: AppHandle, window: WebviewWindow, rect: Option) -> Result<(), String> { + let state = app.state::(); + let mpv = state.mpv.lock().clone(); + let mut surface = state.surface.lock(); + if let Some(surface) = surface.as_mut() { + let rect = rect.map(|r| (r.x.round() as i32, r.y.round() as i32, r.width.round() as i32, r.height.round() as i32)); + surface.set_rect(&window, mpv.as_deref(), rect); + } + Ok(()) +} + #[tauri::command] pub async fn player_command(app: AppHandle, args: Vec) -> Result<(), String> { player(&app)?.command(&args) diff --git a/src/app/App.tsx b/src/app/App.tsx index 77cf583..7c98113 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -33,7 +33,7 @@ function Screen({ route }: { route: Route }) { case 'home': return ; case 'section': - return ; + return ; case 'item': return ; case 'person': @@ -94,8 +94,9 @@ function Page({ onScrolled }: { onScrolled: (top: number) => void }) { function useGlobalShortcuts() { useEffect(() => { const isTyping = (t: EventTarget | null) => t instanceof HTMLElement && (t.isContentEditable || ['INPUT', 'TEXTAREA', 'SELECT'].includes(t.tagName)); + const playerFull = () => usePlayer.getState().open && !usePlayer.getState().mini; const onKey = (e: KeyboardEvent) => { - if (usePlayer.getState().open) return; + if (playerFull()) return; if ((e.ctrlKey || e.metaKey) && (e.key === 'k' || e.key === 'f')) { e.preventDefault(); navigate({ name: 'search' }); @@ -118,7 +119,7 @@ function useGlobalShortcuts() { }; // Mouse back/forward buttons. const onMouse = (e: MouseEvent) => { - if (usePlayer.getState().open) return; + if (playerFull()) return; if (e.button === 3) { e.preventDefault(); useRouter.getState().back(); @@ -144,7 +145,7 @@ function useLibrarySync() { let last = ''; let stopped = false; const tick = async () => { - if (stopped || document.hidden || usePlayer.getState().open) return; + if (stopped || document.hidden || (usePlayer.getState().open && !usePlayer.getState().mini)) return; try { const rev = await libraryRevision(server); if (last && rev !== last) invalidateLibrary(); @@ -167,7 +168,7 @@ function useLibrarySync() { function Shell() { const [scrolled, setScrolled] = useState(false); - const playerOpen = usePlayer((s) => s.open); + const playerOpen = usePlayer((s) => s.open && !s.mini); const startPage = useSettings.getState().startPage; useGlobalShortcuts(); useLibrarySync(); diff --git a/src/app/TopBar.tsx b/src/app/TopBar.tsx index 0e05da2..33e7b80 100644 --- a/src/app/TopBar.tsx +++ b/src/app/TopBar.tsx @@ -16,7 +16,7 @@ const NAV = [ { id: 'downloads', label: 'Downloads', route: { name: 'downloads' } as const }, ]; -function WindowControls() { +export function WindowControls() { const [maximized, setMaximized] = useState(false); useEffect(() => { if (!isNative) return; @@ -67,11 +67,8 @@ function Avatar() { submenu: home.users.map((u) => ({ label: u.title, checked: u.uuid === user?.uuid, onSelect: () => home.switchTo(u) })), }); } - items.push( - { divider: true }, - { label: 'Settings', icon: 'settings', onSelect: () => navigate({ name: 'settings', mode: 'app', tab: 'general' }) }, - ); - if (server?.owned) items.push({ label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); + // Settings has its own button in the bar; the menu keeps account actions. + if (server?.owned) items.push({ divider: true }, { label: 'Server dashboard', icon: 'activity', onSelect: () => navigate({ name: 'settings', mode: 'server', tab: 'dashboard' }) }); items.push({ divider: true }, { label: 'Sign out', icon: 'logout', onSelect: signOut }); openMenu(items, el, { align: 'end', minWidth: 250 }); }; diff --git a/src/app/router.ts b/src/app/router.ts index 943b176..14a5c6f 100644 --- a/src/app/router.ts +++ b/src/app/router.ts @@ -1,11 +1,11 @@ import { create } from 'zustand'; export type SectionKind = 'movie' | 'show'; -export type SectionTab = 'discover' | 'library' | 'collections'; +export type SectionTab = 'discover' | 'library' | 'categories'; export type Route = | { name: 'home' } - | { name: 'section'; kind: SectionKind; tab: SectionTab } + | { name: 'section'; kind: SectionKind; tab: SectionTab; genre?: string; genreTitle?: string } | { name: 'item'; id: string; title?: string } | { name: 'person'; id: string; title: string; thumb?: string } | { name: 'hub'; key: string; title: string } diff --git a/src/app/settings.ts b/src/app/settings.ts index 314a7cd..b921e3a 100644 --- a/src/app/settings.ts +++ b/src/app/settings.ts @@ -4,6 +4,9 @@ import { persist } from 'zustand/middleware'; export type Quality = 'original' | '2160' | '1080' | '720' | '480'; export type SkipMode = 'off' | 'button' | 'auto'; export type SubtitleMode = 'auto' | 'always' | 'forced' | 'off'; +export type SubtitleEdge = 'outline' | 'shadow' | 'raised' | 'none'; +export type SubtitleBox = 'none' | 'translucent' | 'solid'; +export type SubtitlePosition = 'low' | 'normal' | 'high'; export interface Preferences { // Playback @@ -20,7 +23,11 @@ export interface Preferences { subtitleMode: SubtitleMode; subtitleLanguage: string; subtitleScale: number; - subtitleBackground: boolean; + subtitleColor: string; + subtitleEdge: SubtitleEdge; + subtitleBox: SubtitleBox; + subtitleBold: boolean; + subtitlePosition: SubtitlePosition; volume: number; seekStep: number; // Interface @@ -54,7 +61,11 @@ export const defaults: Preferences = { subtitleMode: 'auto', subtitleLanguage: '', subtitleScale: 1, - subtitleBackground: false, + subtitleColor: '#FFFFFF', + subtitleEdge: 'outline', + subtitleBox: 'none', + subtitleBold: false, + subtitlePosition: 'normal', volume: 100, seekStep: 10, startPage: 'home', @@ -82,7 +93,19 @@ export const useSettings = create()( set: (key, value) => set({ [key]: value } as Partial), reset: () => set({ ...defaults }), }), - { name: 'kaleido.settings', version: 1 }, + { + name: 'kaleido.settings', + version: 2, + migrate: (persisted, version) => { + const p = (persisted ?? {}) as Record; + // 1 → 2: the subtitle background switch became a box style. + if (version < 2 && 'subtitleBackground' in p) { + p.subtitleBox = p.subtitleBackground ? 'translucent' : 'none'; + delete p.subtitleBackground; + } + return p as unknown as SettingsState; + }, + }, ), ); @@ -100,3 +123,15 @@ export const QUALITY_PROFILE: Record, { kbps: numbe '720': { kbps: 4000, width: 1280, height: 720 }, '480': { kbps: 1500, width: 854, height: 480 }, }; + +export const SUBTITLE_COLORS: { value: string; label: string }[] = [ + { value: '#FFFFFF', label: 'White' }, + { value: '#FFE14D', label: 'Yellow' }, + { value: '#7FE3F0', label: 'Cyan' }, + { value: '#9BE58A', label: 'Green' }, + { value: '#F4A6D7', label: 'Pink' }, + { value: '#BFC5CA', label: 'Grey' }, +]; + +/** Bottom margin in mpv's scaled pixels (720 = window height). */ +export const SUBTITLE_MARGIN: Record = { low: 14, normal: 34, high: 80 }; diff --git a/src/main.tsx b/src/main.tsx index ccf9b98..b0fc91d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -12,8 +12,9 @@ import { useSession } from './app/session'; import { useRouter } from './app/router'; import { usePlayer } from './player/store'; import { useSettings } from './app/settings'; +import { useDownloads } from './downloads/store'; -if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings }; +if (import.meta.env.DEV) (window as any).__kaleido = { useSession, useRouter, usePlayer, useSettings, useDownloads }; // No browser context menu or text-selection chrome outside inputs: this is an app. window.addEventListener('contextmenu', (e) => { diff --git a/src/player/PlayerOverlay.tsx b/src/player/PlayerOverlay.tsx index 9a026c9..3ee8dab 100644 --- a/src/player/PlayerOverlay.tsx +++ b/src/player/PlayerOverlay.tsx @@ -1,30 +1,51 @@ import { useCallback, useEffect, useRef, useState, type ReactNode } from 'react'; import { usePlayer } from './store'; import { useSession } from '../app/session'; -import { useSettings, QUALITY_LABEL, type Quality } from '../app/settings'; -import { clock, episodeLabel } from '../app/format'; +import { useSettings, QUALITY_LABEL, type Quality, type SubtitleBox } from '../app/settings'; +import { bitrate, channelLabel, clock, episodeLabel, resolutionLabel } from '../app/format'; import { Icon } from '../ui/Icon'; import { Facts, TitleArt } from '../ui/media'; import { Button, Spinner } from '../ui/primitives'; import { win, isNative } from '../platform/native'; +import { WindowControls } from '../app/TopBar'; +import { mpv } from './engine'; import type { Item } from '../plex/types'; const HIDE_AFTER = 3000; +/** + * Controls show on pointer movement and hide after a few seconds of stillness, + * or straight away when the pointer leaves the window. They stay while paused + * (until the pointer leaves) and while a panel is open or the timeline is held. + */ function useAutoHide(paused: boolean, pinned: boolean) { const [visible, setVisible] = useState(true); const timer = useRef | null>(null); + const state = useRef({ paused, pinned }); + state.current = { paused, pinned }; const poke = useCallback(() => { setVisible(true); if (timer.current) clearTimeout(timer.current); - timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); + timer.current = null; + if (!state.current.paused && !state.current.pinned) timer.current = setTimeout(() => setVisible(false), HIDE_AFTER); }, []); useEffect(() => { - if (paused || pinned) { - if (timer.current) clearTimeout(timer.current); - setVisible(true); - } else poke(); + poke(); }, [paused, pinned, poke]); + useEffect(() => { + const leave = () => { + if (state.current.pinned) return; + if (timer.current) clearTimeout(timer.current); + timer.current = null; + setVisible(false); + }; + const root = document.documentElement; + root.addEventListener('mouseleave', leave); + return () => { + root.removeEventListener('mouseleave', leave); + if (timer.current) clearTimeout(timer.current); + }; + }, []); return { visible, poke }; } @@ -123,20 +144,27 @@ function Timeline({ onScrub }: { onScrub: (active: boolean) => void }) { ); } -function Panel({ title, onClose, children, className = '' }: { title: string; onClose: () => void; children: ReactNode; className?: string }) { +function Panel({ title, onClose, onBack, children, className = '' }: { title: string; onClose: () => void; onBack?: () => void; children: ReactNode; className?: string }) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') { e.stopPropagation(); - onClose(); + (onBack ?? onClose)(); } }; window.addEventListener('keydown', onKey, true); return () => window.removeEventListener('keydown', onKey, true); - }, [onClose]); + }, [onClose, onBack]); return (
e.stopPropagation()} onDoubleClick={(e) => e.stopPropagation()}> -
{title}
+
+ {onBack && ( + + )} + {title} +
{children}
); @@ -172,58 +200,145 @@ function TracksPanel({ onClose }: { onClose: () => void }) { {st.subTracks.map((t) => (