fix(ui): unify titlebar and playback state

- window buttons live in the page header on library/search pages and in a shared chrome strip where a page has no header; removed the 44px root padding toggle that made pages jump on navigation
- video player gets its own titlebar row with window controls; the audio player hides the global app bar
- starting a video stops music and vice versa; a single track queues the rest of its album, or the artist's songs when AlbumId is missing
- album page no longer crashes on albums without AlbumArtists
- queue summary is localized
This commit is contained in:
1xDed committed 2026-12-01 02:47:40 +03:00
1 parent d9bce4de04
commit fcf61012db
13 files changed
+245 -171

No files matched your search

@@ -20,13 +20,24 @@
--media-object-fit: fill;
}
&-drag-region {
&-titlebar {
position: absolute;
inset: 0 0 auto;
height: 38px;
z-index: 4;
cursor: default;
z-index: 3;
display: flex;
align-items: center;
gap: 0.75em;
padding: 4px 8px;
min-height: 46px;
user-select: none;
&-end {
display: flex;
align-items: center;
gap: 0.5em;
margin-left: auto;
min-width: 0;
}
}
&-osd {
@@ -53,22 +64,16 @@
}
&-back,
&-actions {
position: absolute;
top: 2em;
z-index: 3;
display: flex;
align-items: center;
flex: 0 0 auto;
padding: 0.3em;
border-radius: 999px;
border: 1px solid rgb(255 255 255 / 0.08);
background: rgb(0 0 0 / 0.28);
backdrop-filter: blur(12px);
}
&-back {
left: 3em;
}
&-actions {
right: 3em;
gap: 0.35em;
}
&-info {
@@ -117,4 +122,27 @@
border: 1.2px solid rgb(255 255 255 / 0.1);
}
}
}
// The window is frameless outside macOS: the player draws the titlebar row and
// the window buttons in the same strip the rest of the app uses on Windows and
// Linux, so they sit on the window edge instead of floating over the picture.
// macOS keeps its native traffic lights inside the overlay titlebar, so the
// player only has to clear them.
html.is-macos .video-player-titlebar {
padding-left: 84px;
padding-top: 14px;
min-height: 60px;
}
html.is-macos .video-player-titlebar.is-fullscreen {
padding-left: 8px;
padding-top: 4px;
min-height: 46px;
}
// A faded-out OSD keeps its buttons clickable otherwise; the titlebar would
// then catch clicks in the top corners while invisible.
.video-player-osd:not(.hovering) .video-player-titlebar {
pointer-events: none;
}
+56 -121
View File
@@ -15,9 +15,9 @@ import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton";
import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider";
import WindowControls from "@/components/windowControls";
import { secToTicks, ticksToSec } from "@/utils/date/time";
import { buildPlayDeepLink } from "@/utils/deepLinks";
import { getPlayerVideoElement } from "@/utils/methods/pictureInPicture";
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
import { useApiInContext } from "@/utils/store/api";
import { useShareStore } from "@/utils/store/share";
@@ -88,6 +88,7 @@ const VideoPlayerControls = ({
isPlayerPlaying,
toggleIsPlaying,
toggleIsPlayerFullscreen,
isPlayerFullscreen,
isUserSeeking,
// seekValue,
isPlayerMuted,
@@ -112,6 +113,7 @@ const VideoPlayerControls = ({
playsessionId: state.playsessionId,
toggleIsPlaying: state.toggleIsPlaying,
toggleIsPlayerFullscreen: state.toggleIsPlayerFullscreen,
isPlayerFullscreen: state.playerState.isPlayerFullscreen,
isUserSeeking: state.playerState.isUserSeeking,
seekValue: state.playerState.seekValue,
isPlayerMuted: state.playerState.isPlayerMuted,
@@ -153,69 +155,6 @@ const VideoPlayerControls = ({
const [settingsMenuRef, setSettingsMenuRef] =
useState<HTMLButtonElement | null>(null);
const [videoFrame, setVideoFrame] = useState<{
top: number;
left: number;
right: number;
} | null>(null);
// Keep the back button and the top action buttons on one line inside the
// visible video area, below any letterbox bars.
useEffect(() => {
let frame = 0;
const update = () => {
const video = getPlayerVideoElement();
if (!video) return;
const rect = video.getBoundingClientRect();
const ratio =
video.videoWidth > 0 && video.videoHeight > 0
? video.videoWidth / video.videoHeight
: null;
const contentWidth = ratio
? Math.min(rect.width, rect.height * ratio)
: rect.width;
const contentHeight = ratio ? contentWidth / ratio : rect.height;
const contentLeft = rect.left + (rect.width - contentWidth) / 2;
const contentTop = rect.top + (rect.height - contentHeight) / 2;
setVideoFrame((current) => {
const next = {
// 14% keeps the controls inside the picture even when the
// file has letterbox bars baked into a 16:9 frame.
top: Math.round(
contentTop + Math.max(28, contentHeight * 0.14),
),
left: Math.round(contentLeft + 24),
right: Math.round(
window.innerWidth - contentLeft - contentWidth + 24,
),
};
return current?.top === next.top &&
current?.left === next.left &&
current?.right === next.right
? current
: next;
});
};
const schedule = () => {
cancelAnimationFrame(frame);
frame = requestAnimationFrame(update);
};
schedule();
const video = getPlayerVideoElement();
video?.addEventListener("loadedmetadata", schedule);
window.addEventListener("resize", schedule);
const interval = window.setInterval(schedule, 1000);
return () => {
cancelAnimationFrame(frame);
window.clearInterval(interval);
video?.removeEventListener("loadedmetadata", schedule);
window.removeEventListener("resize", schedule);
};
}, [playsessionId]);
// const creditInfo = mediaSegments?.Items?.find(
// (segment) => segment.Type === "Outro",
@@ -301,64 +240,60 @@ const VideoPlayerControls = ({
}}
>
<div
className="video-player-osd-back"
style={
videoFrame
? { top: videoFrame.top, left: videoFrame.left }
: undefined
}
className={`video-player-titlebar${isPlayerFullscreen ? " is-fullscreen" : ""}`}
data-tauri-drag-region
>
<IconButton
onClick={handleExitPlayer}
aria-label="Выйти из плеера"
title="Выйти из плеера"
>
<span className="material-symbols-rounded">arrow_back</span>
</IconButton>
</div>
<div
className="video-player-osd-actions"
style={
videoFrame
? { top: videoFrame.top, right: videoFrame.right }
: undefined
}
>
<IconButton
onClick={() =>
useShareStore
.getState()
.openShareDialog(
buildPlayDeepLink(
itemId ?? "",
currentTime > 0 ? ticksToSec(currentTime) : getCurrentTime(),
),
"Поделиться этой сценой",
)
}
aria-label="Поделиться сценой"
title="Поделиться сценой"
>
<span className="material-symbols-rounded">share</span>
</IconButton>
<IconButton
onClick={openSyncPlayDialog}
aria-label="Смотреть вместе"
title="Смотреть вместе"
>
<span className="material-symbols-rounded">groups</span>
</IconButton>
<IconButton
onClick={(e) => setSettingsMenuRef(e.currentTarget)}
aria-label="Настройки плеера"
title="Настройки плеера"
>
<span className="material-symbols-rounded">settings</span>
</IconButton>
<VideoPlayerSettingsMenu
settingsMenuRef={settingsMenuRef}
handleClose={() => setSettingsMenuRef(null)}
/>
<div className="video-player-osd-back">
<IconButton
onClick={handleExitPlayer}
aria-label="Выйти из плеера"
title="Выйти из плеера"
>
<span className="material-symbols-rounded">arrow_back</span>
</IconButton>
</div>
<div className="video-player-titlebar-end">
<div className="video-player-osd-actions">
<IconButton
onClick={() =>
useShareStore
.getState()
.openShareDialog(
buildPlayDeepLink(
itemId ?? "",
currentTime > 0
? ticksToSec(currentTime)
: getCurrentTime(),
),
"Поделиться этой сценой",
)
}
aria-label="Поделиться сценой"
title="Поделиться сценой"
>
<span className="material-symbols-rounded">share</span>
</IconButton>
<IconButton
onClick={openSyncPlayDialog}
aria-label="Смотреть вместе"
title="Смотреть вместе"
>
<span className="material-symbols-rounded">groups</span>
</IconButton>
<IconButton
onClick={(e) => setSettingsMenuRef(e.currentTarget)}
aria-label="Настройки плеера"
title="Настройки плеера"
>
<span className="material-symbols-rounded">settings</span>
</IconButton>
<VideoPlayerSettingsMenu
settingsMenuRef={settingsMenuRef}
handleClose={() => setSettingsMenuRef(null)}
/>
</div>
{!isPlayerFullscreen && <WindowControls />}
</div>
</div>
<div className="video-player-osd-info">
<div>