From 0d2edcab3d78af3f0ecc53962f6c781da606e0e7 Mon Sep 17 00:00:00 2001 From: 1xDed Date: Sat, 28 Nov 2026 02:40:42 +0300 Subject: [PATCH] fix(ui): compact library/search titlebars and reliable local stop Library/search headers no longer overflow at narrow widths and use the shared titlebar strip outside macOS. Transferring a local video now pauses it before reporting it stopped, preventing a ghost playback session. --- src/components/libraryHeader/index.tsx | 16 +++++++++++----- src/components/libraryHeader/libraryHeader.scss | 7 +++++++ src/components/remoteControl/index.tsx | 16 ++++++++++++---- src/components/windowControls/windowChrome.tsx | 10 ++-------- .../windowControls/windowControls.scss | 6 ++++++ src/routes/_api/search/index.tsx | 2 -- 6 files changed, 38 insertions(+), 19 deletions(-) diff --git a/src/components/libraryHeader/index.tsx b/src/components/libraryHeader/index.tsx index 3252a16..c10dac3 100644 --- a/src/components/libraryHeader/index.tsx +++ b/src/components/libraryHeader/index.tsx @@ -25,7 +25,6 @@ import BackButton from "../buttons/backButton"; import CastButton from "../buttons/castButton"; import { FiltersDialogTrigger } from "../filtersDialog"; import { UserAvatarMenu } from "../userAvatarMenu"; -import WindowControls from "../windowControls"; import "./libraryHeader.scss"; const route = getRouteApi("/_api/library/$id"); @@ -387,16 +386,23 @@ export const LibraryHeader = () => { -
- +
+ + +
search
- +
favorite
-
diff --git a/src/components/libraryHeader/libraryHeader.scss b/src/components/libraryHeader/libraryHeader.scss index 3a0c657..5c4a954 100644 --- a/src/components/libraryHeader/libraryHeader.scss +++ b/src/components/libraryHeader/libraryHeader.scss @@ -1,3 +1,10 @@ +@media (max-width: 980px) { + .library-header-cast, + .library-header-favorite { + display: none !important; + } +} + .library-header { display: flex; align-items: center; diff --git a/src/components/remoteControl/index.tsx b/src/components/remoteControl/index.tsx index 7cd9f4f..29bd506 100644 --- a/src/components/remoteControl/index.tsx +++ b/src/components/remoteControl/index.tsx @@ -114,6 +114,17 @@ const RemoteControlDialog = () => { } else if (transfer?.kind === "video") { const playback = usePlaybackStore.getState(); const transferredItemId = playback.metadata.item?.Id; + const stoppedPosition = playback.playerState.currentTime; + // Stop local playback first so a trailing timeupdate cannot + // re-mark the old session as playing after we report it stopped. + ( + document + .querySelector("hls-video") + ?.shadowRoot?.querySelector("video") as HTMLVideoElement | null + )?.pause(); + usePlaybackStore.setState(usePlaybackStore.getInitialState()); + clearQueue(); + navigate({ to: "/home" }); if (api && transferredItemId) { try { await getSessionApi(api).reportPlaybackStopped({ @@ -122,16 +133,13 @@ const RemoteControlDialog = () => { ItemId: transferredItemId, MediaSourceId: playback.mediaSource.id, PlaySessionId: playback.playsessionId, - PositionTicks: playback.playerState.currentTime, + PositionTicks: stoppedPosition, }, }); } catch (error) { console.warn("Could not report the transferred video as stopped", error); } } - usePlaybackStore.setState(usePlaybackStore.getInitialState()); - clearQueue(); - navigate({ to: "/home" }); } closeDialog(); }, diff --git a/src/components/windowControls/windowChrome.tsx b/src/components/windowControls/windowChrome.tsx index de4e726..91e61eb 100644 --- a/src/components/windowControls/windowChrome.tsx +++ b/src/components/windowControls/windowChrome.tsx @@ -31,14 +31,8 @@ const WindowChrome = () => { const { pathname } = useLocation(); if (isMac) return null; if (pathname === "/home" || shouldShowAppBar(pathname)) return null; - // These routes draw their own headers and include WindowControls. - if ( - pathname.startsWith("/library") || - pathname.startsWith("/search") || - pathname.startsWith("/player") - ) { - return null; - } + // The video player has its own fullscreen UI. + if (pathname.startsWith("/player")) return null; return ; }; diff --git a/src/components/windowControls/windowControls.scss b/src/components/windowControls/windowControls.scss index fb1a56f..9db0ae3 100644 --- a/src/components/windowControls/windowControls.scss +++ b/src/components/windowControls/windowControls.scss @@ -47,6 +47,12 @@ html.is-linux body.has-window-chrome #root { padding-top: 44px; } +// Search uses a fixed header; move it below the custom titlebar strip. +html.is-windows body.has-window-chrome .search-header, +html.is-linux body.has-window-chrome .search-header { + top: calc(1em + 44px) !important; +} + .window-resize-handles { position: fixed; inset: 0; diff --git a/src/routes/_api/search/index.tsx b/src/routes/_api/search/index.tsx index 90f186d..18de773 100644 --- a/src/routes/_api/search/index.tsx +++ b/src/routes/_api/search/index.tsx @@ -29,7 +29,6 @@ import { useShallow } from "zustand/shallow"; import { NavigationDrawer } from "@/components/appBar/navigationDrawer"; import BackButton from "@/components/buttons/backButton"; import { UserAvatarMenu } from "@/components/userAvatarMenu"; -import WindowControls from "@/components/windowControls"; import { useApiInContext } from "@/utils/store/api"; import useDebounce from "@/utils/hooks/useDebounce"; import { useCentralStore } from "@/utils/store/central"; @@ -357,7 +356,6 @@ function SearchAppBar({
favorite
-