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
Home is now a floating rounded window: an integrated header over full-bleed artwork, a large featured title with actions, and a Trending now rail that switches the hero. Existing home sections continue below in the same frame.
84 lines
2.3 KiB
TypeScript
84 lines
2.3 KiB
TypeScript
import IconButton from "@mui/material/IconButton";
|
|
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
|
|
import { useNavigate } from "@tanstack/react-router";
|
|
import React, { useCallback, useState } from "react";
|
|
import { NavigationDrawer } from "@/components/appBar/navigationDrawer";
|
|
import CastButton from "@/components/buttons/castButton";
|
|
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
|
import useSearchStore from "@/utils/store/search";
|
|
|
|
type HomeHeaderProps = {
|
|
libraries: BaseItemDto[];
|
|
onNewAndPopular: () => void;
|
|
};
|
|
|
|
const HomeHeader = ({ libraries, onNewAndPopular }: HomeHeaderProps) => {
|
|
const navigate = useNavigate();
|
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
const toggleSearchDialog = useSearchStore((s) => s.toggleSearchDialog);
|
|
|
|
const moviesLibrary = libraries.find(
|
|
(library) => library.CollectionType === "movies",
|
|
);
|
|
|
|
const openMovies = useCallback(() => {
|
|
if (!moviesLibrary?.Id) return;
|
|
navigate({ to: "/library/$id", params: { id: moviesLibrary.Id } });
|
|
}, [moviesLibrary?.Id, navigate]);
|
|
|
|
return (
|
|
<>
|
|
<header className="home-header" data-tauri-drag-region>
|
|
<div className="home-header-left" data-tauri-drag-region>
|
|
<IconButton
|
|
aria-label="Open navigation"
|
|
onClick={() => setDrawerOpen(true)}
|
|
>
|
|
<span className="material-symbols-rounded">menu</span>
|
|
</IconButton>
|
|
{moviesLibrary?.Id && (
|
|
<button
|
|
type="button"
|
|
className="home-nav-link"
|
|
onClick={openMovies}
|
|
>
|
|
Movies
|
|
</button>
|
|
)}
|
|
<button
|
|
type="button"
|
|
className="home-nav-link"
|
|
onClick={onNewAndPopular}
|
|
>
|
|
New & Popular
|
|
</button>
|
|
</div>
|
|
|
|
<div className="home-header-logo" data-tauri-drag-region>
|
|
Blink
|
|
</div>
|
|
|
|
<div className="home-header-right">
|
|
<IconButton aria-label="Search" onClick={toggleSearchDialog}>
|
|
<span className="material-symbols-rounded">search</span>
|
|
</IconButton>
|
|
<CastButton />
|
|
<IconButton
|
|
aria-label="Favorites"
|
|
onClick={() => navigate({ to: "/favorite" })}
|
|
>
|
|
<span className="material-symbols-rounded">favorite</span>
|
|
</IconButton>
|
|
<UserAvatarMenu />
|
|
</div>
|
|
</header>
|
|
<NavigationDrawer
|
|
open={drawerOpen}
|
|
onClose={() => setDrawerOpen(false)}
|
|
/>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default HomeHeader;
|