feat: add gamepad navigation and music library improvements
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

- add TV/gamepad spatial navigation, focus ring and back/select controls
- cache artwork persistently and add music cover placeholders
- add compact songs list, shuffle-all queue and library error recovery
- polish remote control layout and optimistic seek timeline
This commit is contained in:
1xDed committed 2026-12-01 04:24:56 +03:00
1 parent 04ab9f767b
commit 5f5803c9f8
24 files changed
+1199 -245

No files matched your search

+2
View File
@@ -34,6 +34,7 @@ import RealtimeBridge from "@/components/realtime";
import SplashHider from "@/components/splash";
import RemoteControlDialog from "@/components/remoteControl";
import RouterLoading from "@/components/routerLoading";
import SpatialNavigation from "@/components/spatialNavigation";
import SyncPlayController from "@/components/syncPlay/controller";
import SyncPlayDialog from "@/components/syncPlay";
import Search from "@/components/search";
@@ -79,6 +80,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
<AudioPlayer />
<PlaybackSync />
<RealtimeBridge />
<SpatialNavigation />
<FollowMe />
<OverlayScrollbar />
<Outlet />
+43 -25
View File
@@ -1,6 +1,7 @@
import { BaseItemKind, ItemSortBy } from "@jellyfin/sdk/lib/generated-client";
import { useSuspenseQuery } from "@tanstack/react-query";
import React, { Suspense, useEffect } from "react";
import { ErrorBoundary } from "react-error-boundary";
import "./library.scss";
import { createFileRoute } from "@tanstack/react-router";
import { useShallow } from "zustand/shallow";
@@ -65,14 +66,16 @@ function Library() {
getLibraryQueryOptions(api, user?.Id, id),
);
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
const { libraryName: storeLibraryName } = useLibraryStateStore(
useShallow((s) => {
const sl = s.libraries[id || ""];
return {
libraryName: sl?.libraryName,
} as const;
}),
);
const { libraryName: storeLibraryName, currentViewType } =
useLibraryStateStore(
useShallow((s) => {
const sl = s.libraries[id || ""];
return {
libraryName: sl?.libraryName,
currentViewType: sl?.currentViewType,
} as const;
}),
);
React.useEffect(() => {
if (!id || !currentLib.data) return;
@@ -107,23 +110,38 @@ function Library() {
>
<LibraryHeader />
<Suspense fallback={<LibraryItemsSkeleton />}>
<div className="library-items">
<LibraryItemsGrid />
</div>
<div
style={{
position: "fixed",
right:
currentLib.data.CollectionType === "music"
? "max(14px, calc((100vw - 1180px) / 2 + 18px))"
: 14,
top: 80,
}}
>
<AlphaSelector />
</div>
</Suspense>
<ErrorBoundary
fallbackRender={({ error, resetErrorBoundary }) => (
<div className="library-load-error">
<span className="material-symbols-rounded">cloud_off</span>
<h2>Не удалось загрузить библиотеку</h2>
<p>{error instanceof Error ? error.message : String(error)}</p>
<button type="button" onClick={resetErrorBoundary}>
Повторить
</button>
</div>
)}
>
<Suspense fallback={<LibraryItemsSkeleton />}>
<div className="library-items">
<LibraryItemsGrid />
</div>
{currentViewType !== BaseItemKind.Audio && (
<div
style={{
position: "fixed",
right:
currentLib.data.CollectionType === "music"
? "max(14px, calc((100vw - 1180px) / 2 + 18px))"
: 14,
top: 80,
}}
>
<AlphaSelector />
</div>
)}
</Suspense>
</ErrorBoundary>
</main>
);
}
+45 -1
View File
@@ -169,4 +169,48 @@
flex-basis: 14%;
}
}
}
}
.library-load-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.6em;
min-height: 50vh;
padding: 2em;
text-align: center;
> .material-symbols-rounded {
font-size: 3.5rem;
opacity: 0.5;
}
h2 {
margin: 0;
font-size: 1.4rem;
font-weight: 600;
}
p {
max-width: 48ch;
margin: 0;
opacity: 0.65;
font-size: 0.9rem;
overflow-wrap: anywhere;
}
button {
margin-top: 0.6em;
padding: 0.6em 1.2em;
border: 1px solid rgb(255 255 255 / 0.12);
border-radius: 999px;
background: rgb(255 255 255 / 0.08);
color: inherit;
font: inherit;
cursor: pointer;
&:hover {
background: rgb(255 255 255 / 0.14);
}
}
}
+84 -102
View File
@@ -1,14 +1,18 @@
/**
* Remote control for another Jellyfin client.
* Layout follows the reference player: brand bar, poster + details + round
* transport, a full-width timeline, and a service bar with subtitles, volume,
* quality and fullscreen.
* Layout follows the reference player: title bar, poster + details + round
* transport, a full-width timeline, and a transparent service bar with
* subtitles, volume and fullscreen.
*/
.remote-page {
--remote-accent: #{$clr-accent-default};
--remote-panel: #16191f;
--remote-chip: #1b1e25;
--remote-muted: #a9b0bb;
--remote-chip: rgb(255 255 255 / 0.08);
--remote-muted: rgb(255 255 255 / 0.64);
--remote-gutter: clamp(1.5rem, 2.5vw, 2rem);
--remote-surface: rgb(255 255 255 / 0.08);
--remote-surface-hover: rgb(255 255 255 / 0.14);
--remote-border: rgb(255 255 255 / 0.1);
position: fixed;
inset: 0;
@@ -33,10 +37,35 @@
align-items: center;
justify-content: space-between;
gap: 24px;
height: 88px;
padding: 0 32px;
height: 58px;
padding: 0 var(--remote-gutter);
box-sizing: border-box;
html.is-macos & {
padding-left: calc(var(--remote-gutter) + 64px);
}
.MuiIconButton-root {
width: 38px;
height: 38px;
color: rgb(255 255 255 / 0.88);
background: rgb(255 255 255 / 0.08);
border: 1px solid rgb(255 255 255 / 0.1);
backdrop-filter: blur(10px);
transition:
background-color 0.18s ease,
color 0.18s ease;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.16);
}
.material-symbols-rounded {
font-size: 1.25rem;
}
}
&-left,
&-right {
display: flex;
@@ -45,19 +74,6 @@
min-width: 0;
}
.MuiIconButton-root {
color: #dfe3ea;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.08);
}
.material-symbols-rounded {
font-size: 1.5rem;
}
}
&-divider {
width: 1px;
height: 26px;
@@ -65,57 +81,8 @@
}
}
.remote-brand {
display: flex;
align-items: center;
gap: 10px;
&-mark {
display: grid;
place-items: center;
width: 38px;
height: 38px;
border-radius: 50%;
background: linear-gradient(
135deg,
$clr-accent-default,
$clr-secondary-default
);
color: #fff;
.material-symbols-rounded {
font-size: 1.3rem;
}
}
&-name {
font-size: 1.35rem;
font-weight: 600;
letter-spacing: -0.01em;
}
}
.remote-device-chip {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 8px 12px 8px 14px;
border: 0;
border-radius: 999px;
background: var(--remote-panel);
color: #e8ebf1;
font: inherit;
font-size: 0.88rem;
cursor: pointer;
transition: background-color 0.15s ease;
&:hover {
background: #1d2028;
}
> .material-symbols-rounded {
font-size: 1.2rem;
}
html.is-macos .remote-topbar-right .remote-topbar-divider {
display: none;
}
.remote-chevron {
@@ -136,13 +103,13 @@
flex: 0 0 clamp(220px, 19vw, 280px);
flex-direction: column;
min-height: 0;
padding: clamp(0.5rem, 3vh, 2rem) 0 0 clamp(1.5rem, 4vw, 3.5rem);
padding: 14px 0 0 var(--remote-gutter);
box-sizing: border-box;
overflow: hidden;
}
.remote-devices-title {
margin: 0 0 0.5em 0.6em;
margin: 0 0 0.5em 0.45em;
font-size: 0.72rem;
font-weight: 500;
letter-spacing: 0.2em;
@@ -166,8 +133,8 @@
gap: 0.75em;
width: 100%;
padding: 0.6em 0.7em;
border: 0;
border-radius: 10px;
border: 1px solid transparent;
border-radius: 12px;
background: transparent;
color: rgb(255 255 255 / 0.75);
font: inherit;
@@ -180,7 +147,8 @@
}
&.is-active {
background: rgb(255 255 255 / 0.1);
border-color: var(--remote-border);
background: var(--remote-surface);
color: #fff;
}
@@ -232,7 +200,7 @@
min-width: 0;
min-height: 0;
margin: 0 auto;
padding: clamp(0.5rem, 3vh, 2.5rem) clamp(1.5rem, 4vw, 3.5rem) 0;
padding: 0 var(--remote-gutter);
box-sizing: border-box;
overflow: hidden;
}
@@ -276,7 +244,7 @@
flex: 1 1 auto;
min-width: 0;
max-width: 820px;
padding-top: clamp(0.5rem, 4vh, 3rem);
padding-top: 0;
}
.remote-title {
@@ -306,10 +274,12 @@
.remote-chip {
padding: 7px 15px;
border: 1px solid var(--remote-border);
border-radius: 999px;
background: var(--remote-chip);
font-size: 0.95rem;
color: #dfe3ea;
backdrop-filter: blur(12px);
}
.remote-overview {
@@ -334,22 +304,27 @@
.remote-round {
display: grid;
place-items: center;
width: clamp(64px, 6vw, 86px);
height: clamp(64px, 6vw, 86px);
width: clamp(56px, 5vw, 72px);
height: clamp(56px, 5vw, 72px);
padding: 0;
border: 0;
border: 1px solid var(--remote-border);
border-radius: 50%;
background: var(--remote-panel);
background: var(--remote-surface);
color: #fff;
backdrop-filter: blur(16px) saturate(150%);
cursor: pointer;
transition: background-color 0.15s ease, transform 0.15s ease;
transition:
background-color 0.15s ease,
border-color 0.15s ease,
transform 0.15s ease;
.material-symbols-rounded {
font-size: clamp(1.5rem, 2vw, 2rem);
}
&:hover:not(:disabled) {
background: #1e222b;
border-color: rgb(255 255 255 / 0.18);
background: var(--remote-surface-hover);
transform: scale(1.03);
}
@@ -359,17 +334,20 @@
}
&.remote-round-primary {
width: clamp(74px, 7vw, 98px);
height: clamp(74px, 7vw, 98px);
width: clamp(68px, 6vw, 84px);
height: clamp(68px, 6vw, 84px);
border-color: transparent;
background: var(--remote-accent);
box-shadow: 0 10px 24px rgb(0 0 0 / 0.3);
box-shadow: 0 10px 28px rgb(0 0 0 / 0.28);
.material-symbols-rounded {
font-size: clamp(1.9rem, 2.6vw, 2.6rem);
font-size: clamp(1.8rem, 2.4vw, 2.4rem);
}
&:hover:not(:disabled) {
background: #8b70ff;
border-color: transparent;
background: var(--remote-accent);
filter: brightness(1.06);
transform: scale(1.04);
}
}
@@ -382,7 +360,7 @@
flex: 0 0 auto;
align-items: center;
gap: 22px;
padding: clamp(0.5rem, 1.5vh, 1rem) clamp(1.5rem, 4vw, 3.5rem) 0;
padding: 8px var(--remote-gutter) 0;
box-sizing: border-box;
.MuiSlider-root {
@@ -432,11 +410,11 @@
align-items: center;
justify-content: space-between;
gap: 24px;
height: 72px;
padding: 0 clamp(1.5rem, 4vw, 3rem);
height: 68px;
padding: 0 var(--remote-gutter);
box-sizing: border-box;
background: rgb(0 0 0 / 0.22);
border-top: 1px solid rgb(255 255 255 / 0.06);
background: transparent;
border-top: 0;
}
.remote-bottom-item {
@@ -538,7 +516,7 @@
@media (max-height: 780px) {
.remote-topbar {
height: 72px;
height: 52px;
}
.remote-title {
@@ -562,17 +540,17 @@
}
.remote-round {
width: 64px;
height: 64px;
width: 54px;
height: 54px;
}
.remote-round.remote-round-primary {
width: 78px;
height: 78px;
width: 66px;
height: 66px;
}
.remote-bottombar {
height: 64px;
height: 58px;
}
}
@@ -586,7 +564,7 @@
}
.remote-bottombar {
height: 90px;
height: 76px;
gap: 16px;
}
@@ -597,10 +575,14 @@
@media (max-width: 820px) {
.remote-topbar {
height: 72px;
height: 52px;
padding: 0 16px;
}
html.is-macos .remote-topbar {
padding-left: 76px;
}
.remote-hero {
flex-direction: column;
align-items: center;
+40 -41
View File
@@ -12,6 +12,7 @@ import Tooltip from "@mui/material/Tooltip";
import { useQuery } from "@tanstack/react-query";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
import React, { useEffect, useMemo, useRef, useState } from "react";
import CachedImage from "@/components/cachedImage";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
import WindowControls from "@/components/windowControls";
import { getRuntimeCompact } from "@/utils/date/time";
@@ -72,9 +73,10 @@ function RemotePage() {
const [subtitleAnchor, setSubtitleAnchor] = useState<HTMLElement | null>(
null,
);
const [qualityAnchor, setQualityAnchor] = useState<HTMLElement | null>(null);
const [subtitleIndex, setSubtitleIndex] = useState<number>(-1);
const [volumeDraft, setVolumeDraft] = useState<number | null>(null);
const [displayPosition, setDisplayPosition] = useState(0);
const [isSeeking, setIsSeeking] = useState(false);
const volumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const clearVolumeTimer = () => {
@@ -176,10 +178,36 @@ function RemotePage() {
const playState = selected?.PlayState;
const isPaused = playState?.IsPaused ?? true;
const duration = nowPlaying?.RunTimeTicks ?? 0;
const position = playState?.PositionTicks ?? 0;
const volume = volumeDraft ?? (playState?.VolumeLevel ?? 100) / 100;
const isMuted = playState?.IsMuted ?? false;
useEffect(() => {
setDisplayPosition(playState?.PositionTicks ?? 0);
setIsSeeking(false);
}, [selected?.Id]);
// Session polling is slow, so keep the timeline moving locally between
// updates. Large jumps (another client seeking) still win.
useEffect(() => {
const serverPosition = playState?.PositionTicks;
if (serverPosition == null) return;
setDisplayPosition((current) =>
Math.abs(serverPosition - current) > 2 * TICKS_PER_SECOND
? serverPosition
: current,
);
}, [playState?.PositionTicks]);
useEffect(() => {
if (isPaused || isSeeking || duration <= 0) return;
const timer = window.setInterval(() => {
setDisplayPosition((current) =>
Math.min(current + TICKS_PER_SECOND / 2, duration),
);
}, 500);
return () => window.clearInterval(timer);
}, [isPaused, isSeeking, duration, selected?.Id]);
const coverUrl = useMemo(() => {
if (!api || !nowPlaying) return undefined;
const imageItemId = nowPlaying.AlbumId ?? nowPlaying.Id;
@@ -228,9 +256,6 @@ function RemotePage() {
channelLabel(audioStream?.Channels),
].filter(Boolean) as string[];
const qualityLabel = videoStream?.Height
? `${videoStream.Height}p`
: (nowPlaying?.MediaSources?.[0]?.Name ?? "Авто");
const subtitleLabel =
subtitleIndex < 0
? "Выкл."
@@ -271,13 +296,6 @@ function RemotePage() {
>
<header className="remote-topbar" data-tauri-drag-region>
<div className="remote-topbar-left">
<div className="remote-brand">
<span className="remote-brand-mark">
<span className="material-symbols-rounded">settings_remote</span>
</span>
<span className="remote-brand-name">Пульт</span>
</div>
<span className="remote-topbar-divider" />
<IconButton
aria-label="Главная"
title="Главная"
@@ -366,7 +384,7 @@ function RemotePage() {
<div className="remote-poster">
<div className="remote-poster-frame">
{coverUrl ? (
<img src={coverUrl} alt={title ?? "Постер"} />
<CachedImage src={coverUrl} alt={title ?? "Постер"} />
) : (
<span className="material-symbols-rounded">live_tv</span>
)}
@@ -471,16 +489,23 @@ function RemotePage() {
</div>
<div className="remote-timeline">
<span className="remote-time">{formatTime(position)}</span>
<span className="remote-time">{formatTime(displayPosition)}</span>
<Slider
className="remote-timeline-slider"
value={Math.min(position, duration)}
value={Math.min(displayPosition, duration)}
max={duration || 1}
step={1}
size="small"
aria-label="Перемотка"
onChange={(_, value) => {
const next = Array.isArray(value) ? value[0] : value;
setIsSeeking(true);
setDisplayPosition(next);
}}
onChangeCommitted={(_, value) => {
const next = Array.isArray(value) ? value[0] : value;
setIsSeeking(false);
setDisplayPosition(next);
if (selected) {
void command(
selected,
@@ -544,19 +569,6 @@ function RemotePage() {
/>
</div>
<button
type="button"
className="remote-bottom-item"
onClick={(event) => setQualityAnchor(event.currentTarget)}
disabled={!nowPlaying}
>
<span className="material-symbols-rounded">monitor</span>
<span>Качество: {qualityLabel}</span>
<span className="material-symbols-rounded remote-chevron">
expand_more
</span>
</button>
<button
type="button"
className="remote-bottom-item"
@@ -591,19 +603,6 @@ function RemotePage() {
</MenuItem>
))}
</Menu>
<Menu
anchorEl={qualityAnchor}
open={Boolean(qualityAnchor)}
onClose={() => setQualityAnchor(null)}
>
<MenuItem disabled>Качество выбирает сам клиент</MenuItem>
{nowPlaying?.MediaSources?.map((source) => (
<MenuItem key={source.Id} disabled>
{source.Name ?? "Источник"}
</MenuItem>
))}
</Menu>
</>
)}
</div>