fix(ui): search results, navigation and window controls on headers
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
Search queries no longer cache empty results while auth is restoring, the search header gets a working navigation drawer, and library/search headers include the custom window controls on Windows/Linux. Idle remote-session polling is reduced.
This commit is contained in:
1 parent
3cfa52ffc9
commit
23cdfb010d
4 files changed
+40
-9
No files matched your search
@@ -25,6 +25,7 @@ import BackButton from "../buttons/backButton";
|
|||||||
import CastButton from "../buttons/castButton";
|
import CastButton from "../buttons/castButton";
|
||||||
import { FiltersDialogTrigger } from "../filtersDialog";
|
import { FiltersDialogTrigger } from "../filtersDialog";
|
||||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||||
|
import WindowControls from "../windowControls";
|
||||||
import "./libraryHeader.scss";
|
import "./libraryHeader.scss";
|
||||||
|
|
||||||
const route = getRouteApi("/_api/library/$id");
|
const route = getRouteApi("/_api/library/$id");
|
||||||
@@ -395,6 +396,7 @@ export const LibraryHeader = () => {
|
|||||||
<div className="material-symbols-rounded">favorite</div>
|
<div className="material-symbols-rounded">favorite</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<UserAvatarMenu />
|
<UserAvatarMenu />
|
||||||
|
<WindowControls />
|
||||||
</div>
|
</div>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ const AudioPlayer = () => {
|
|||||||
const [playing, setPlaying] = useState(false);
|
const [playing, setPlaying] = useState(false);
|
||||||
const [progress, setProgress] = useState(0);
|
const [progress, setProgress] = useState(0);
|
||||||
const [selectedRemoteId, setSelectedRemoteId] = useState<string | null>(null);
|
const [selectedRemoteId, setSelectedRemoteId] = useState<string | null>(null);
|
||||||
|
const remoteActiveRef = useRef(false);
|
||||||
const [moreAnchor, setMoreAnchor] = useState<HTMLElement | null>(null);
|
const [moreAnchor, setMoreAnchor] = useState<HTMLElement | null>(null);
|
||||||
const [remoteVolumeDraft, setRemoteVolumeDraft] = useState<number | null>(
|
const [remoteVolumeDraft, setRemoteVolumeDraft] = useState<number | null>(
|
||||||
null,
|
null,
|
||||||
@@ -98,9 +99,12 @@ const AudioPlayer = () => {
|
|||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
enabled: !!api && !!user?.Id,
|
enabled: !!api && !!user?.Id,
|
||||||
// Do not keep polling the server while the window is hidden.
|
// Poll quickly only while something is actually playing; idle devices
|
||||||
refetchInterval: () =>
|
// are checked less often, and never while the window is hidden.
|
||||||
document.visibilityState === "visible" ? 3000 : false,
|
refetchInterval: () => {
|
||||||
|
if (document.visibilityState !== "visible") return false;
|
||||||
|
return display || remoteActiveRef.current ? 3000 : 8000;
|
||||||
|
},
|
||||||
refetchIntervalInBackground: false,
|
refetchIntervalInBackground: false,
|
||||||
staleTime: 1500,
|
staleTime: 1500,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
@@ -126,6 +130,7 @@ const AudioPlayer = () => {
|
|||||||
: !display
|
: !display
|
||||||
? playingRemote
|
? playingRemote
|
||||||
: undefined;
|
: undefined;
|
||||||
|
remoteActiveRef.current = Boolean(remote);
|
||||||
|
|
||||||
const activeItem: BaseItemDto | undefined | null =
|
const activeItem: BaseItemDto | undefined | null =
|
||||||
remote?.NowPlayingItem ?? item;
|
remote?.NowPlayingItem ?? item;
|
||||||
|
|||||||
@@ -31,8 +31,14 @@ const WindowChrome = () => {
|
|||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
if (isMac) return null;
|
if (isMac) return null;
|
||||||
if (pathname === "/home" || shouldShowAppBar(pathname)) return null;
|
if (pathname === "/home" || shouldShowAppBar(pathname)) return null;
|
||||||
// The video player has its own fullscreen UI.
|
// These routes draw their own headers and include WindowControls.
|
||||||
if (pathname.startsWith("/player")) return null;
|
if (
|
||||||
|
pathname.startsWith("/library") ||
|
||||||
|
pathname.startsWith("/search") ||
|
||||||
|
pathname.startsWith("/player")
|
||||||
|
) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return <WindowChromeContent />;
|
return <WindowChromeContent />;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,8 +26,11 @@ import {
|
|||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router";
|
import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router";
|
||||||
import { useShallow } from "zustand/shallow";
|
import { useShallow } from "zustand/shallow";
|
||||||
|
import { NavigationDrawer } from "@/components/appBar/navigationDrawer";
|
||||||
import BackButton from "@/components/buttons/backButton";
|
import BackButton from "@/components/buttons/backButton";
|
||||||
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
||||||
|
import WindowControls from "@/components/windowControls";
|
||||||
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import useDebounce from "@/utils/hooks/useDebounce";
|
import useDebounce from "@/utils/hooks/useDebounce";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import useSearchStore from "@/utils/store/search";
|
import useSearchStore from "@/utils/store/search";
|
||||||
@@ -50,7 +53,7 @@ const CATEGORIES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function SearchPage() {
|
function SearchPage() {
|
||||||
const api = Route.useRouteContext().api;
|
const api = useApiInContext((state) => state.api);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { query } = Route.useSearch();
|
const { query } = Route.useSearch();
|
||||||
const [setBackdrop] = useBackdropStore(useShallow((s) => [s.setBackdrop]));
|
const [setBackdrop] = useBackdropStore(useShallow((s) => [s.setBackdrop]));
|
||||||
@@ -184,8 +187,10 @@ function SearchAppBar({
|
|||||||
const toggleSearchDialog = useSearchStore(
|
const toggleSearchDialog = useSearchStore(
|
||||||
useShallow((s) => s.toggleSearchDialog),
|
useShallow((s) => s.toggleSearchDialog),
|
||||||
);
|
);
|
||||||
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
<AppBar
|
<AppBar
|
||||||
className={
|
className={
|
||||||
scrollTrigger
|
scrollTrigger
|
||||||
@@ -197,7 +202,7 @@ function SearchAppBar({
|
|||||||
color="transparent"
|
color="transparent"
|
||||||
>
|
>
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
<IconButton disabled>
|
<IconButton onClick={() => setShowDrawer(true)}>
|
||||||
<div className="material-symbols-rounded">menu</div>
|
<div className="material-symbols-rounded">menu</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<BackButton />
|
<BackButton />
|
||||||
@@ -352,8 +357,14 @@ function SearchAppBar({
|
|||||||
<div className="material-symbols-rounded">favorite</div>
|
<div className="material-symbols-rounded">favorite</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<UserAvatarMenu />
|
<UserAvatarMenu />
|
||||||
|
<WindowControls />
|
||||||
</div>
|
</div>
|
||||||
</AppBar>
|
</AppBar>
|
||||||
|
<NavigationDrawer
|
||||||
|
open={showDrawer}
|
||||||
|
onClose={() => setShowDrawer(false)}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +448,14 @@ function CategorySection({ category, query, api, user, onResult }: any) {
|
|||||||
const limit = 20;
|
const limit = 20;
|
||||||
|
|
||||||
const { data, isLoading } = useQuery({
|
const { data, isLoading } = useQuery({
|
||||||
queryKey: ["search", "category", category.value, query],
|
queryKey: [
|
||||||
|
"search",
|
||||||
|
"category",
|
||||||
|
category.value,
|
||||||
|
query,
|
||||||
|
user?.Id,
|
||||||
|
api?.basePath,
|
||||||
|
],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
if (!api || !user?.Id) return { items: [], total: 0 };
|
if (!api || !user?.Id) return { items: [], total: 0 };
|
||||||
|
|
||||||
@@ -472,7 +490,7 @@ function CategorySection({ category, query, api, user, onResult }: any) {
|
|||||||
});
|
});
|
||||||
return { items: res.data.Items, total: res.data.TotalRecordCount };
|
return { items: res.data.Items, total: res.data.TotalRecordCount };
|
||||||
},
|
},
|
||||||
enabled: !!query,
|
enabled: Boolean(api && user?.Id && query),
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in new issue
Block a user