feat: cross-platform titlebar, video transfers and client cleanup
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
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
Adds frameless-window controls for Windows/Linux (native traffic lights on macOS), keeps transfers at the current position for video, lets the video player use the same sync/device controls as the media bar, and removes dead code plus assorted UI/perf issues.
This commit is contained in:
1 parent
4bdd0139bf
commit
6675a55957
26 files changed
+561
-316
No files matched your search
@@ -7,15 +7,13 @@ import React, { useCallback, useState } from "react";
|
||||
import "./appBar.scss";
|
||||
|
||||
import { useShallow } from "zustand/shallow";
|
||||
// removed search placeholder; library state now managed via zustand
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useHeaderStore from "@/utils/store/header";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import BackButton from "../buttons/backButton";
|
||||
import CastButton from "../buttons/castButton";
|
||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||
import { NavigationDrawer } from "./navigationDrawer";
|
||||
import WindowControls from "../windowControls";
|
||||
|
||||
const MemoizeBackButton = React.memo(BackButton);
|
||||
|
||||
@@ -32,7 +30,15 @@ const HIDDEN_PATHS = [
|
||||
"/home",
|
||||
];
|
||||
|
||||
export const AppBar = () => {
|
||||
/** Whether the global app header is drawn for this route. */
|
||||
export const shouldShowAppBar = (pathname: string) =>
|
||||
!HIDDEN_PATHS.some(
|
||||
(path) =>
|
||||
(pathname.startsWith(path) && pathname !== "/player/audio") ||
|
||||
pathname === "/",
|
||||
);
|
||||
|
||||
const AppBarContent = () => {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
@@ -40,13 +46,7 @@ export const AppBar = () => {
|
||||
useShallow((s) => s.toggleSearchDialog),
|
||||
);
|
||||
|
||||
const display = !HIDDEN_PATHS.some(
|
||||
(path) =>
|
||||
(location.pathname.startsWith(path) &&
|
||||
location.pathname !== "/player/audio") ||
|
||||
location.pathname === "/",
|
||||
);
|
||||
|
||||
// This hook subscribes to page scroll; keep it out of hidden routes.
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
@@ -54,11 +54,6 @@ export const AppBar = () => {
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
|
||||
const _handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const handleDrawerClose = useCallback(() => {
|
||||
setShowDrawer(false);
|
||||
}, []);
|
||||
@@ -74,53 +69,66 @@ export const AppBar = () => {
|
||||
|
||||
useHeaderStore(useShallow((s) => ({ pageTitle: s.pageTitle })));
|
||||
|
||||
if (!display) {
|
||||
return null;
|
||||
}
|
||||
if (display) {
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
data-tauri-drag-region
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
: "appBar flex flex-row flex-justify-spaced-between"
|
||||
}
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
>
|
||||
<div
|
||||
className="flex flex-row"
|
||||
data-tauri-drag-region
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
: "appBar flex flex-row flex-justify-spaced-between"
|
||||
}
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
style={{ gap: "0.6em" }}
|
||||
>
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<span className="material-symbols-rounded">menu</span>
|
||||
</IconButton>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<span
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
? "material-symbols-rounded fill"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
home
|
||||
</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<IconButton onClick={handleDrawerOpen} aria-label="Open navigation">
|
||||
<span className="material-symbols-rounded">menu</span>
|
||||
</IconButton>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome} aria-label="Home">
|
||||
<span
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
? "material-symbols-rounded fill"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
home
|
||||
</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<CastButton />
|
||||
<IconButton onClick={toggleSearchDialog}>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<span className="material-symbols-rounded">favorite</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
</div>
|
||||
</MuiAppBar>
|
||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
<div
|
||||
className="flex flex-row"
|
||||
data-tauri-drag-region
|
||||
style={{ gap: "0.6em" }}
|
||||
>
|
||||
<CastButton />
|
||||
<IconButton onClick={toggleSearchDialog} aria-label="Search">
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={handleNavigateToFavorite}
|
||||
aria-label="Favorites"
|
||||
>
|
||||
<span className="material-symbols-rounded">favorite</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
<WindowControls />
|
||||
</div>
|
||||
</MuiAppBar>
|
||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const AppBar = () => {
|
||||
const location = useLocation();
|
||||
if (!shouldShowAppBar(location.pathname)) return null;
|
||||
return <AppBarContent />;
|
||||
};
|
||||
Reference in new issue
Block a user