Files
Blink/src/routes/_api/home/homeHeader.tsx
T
1xDed 5746bf35a5
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
feat: add cross-device playback and remote control
- native SyncPlay groups with shared queues, ready/buffering and local pause/seek reporting
- follow-me prompt that transfers another session's playback to this device
- auto-skip intros/recaps and skip-credits for final items
- blink:// deep links with timestamped scene sharing via QR
- Quick Connect approval and QR onboarding from a phone
- Rust WebSocket client with Authorization header for Jellyfin 12, capabilities advertising, live sessions and remote commands
2026-11-29 08:03:21 +03:00

136 lines
3.9 KiB
TypeScript

import "@fontsource-variable/caveat";
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 WindowControls from "@/components/windowControls";
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
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 showsLibrary = libraries.find(
(library) => library.CollectionType === "tvshows",
);
const openMovies = useCallback(() => {
if (!moviesLibrary?.Id) return;
navigate({ to: "/library/$id", params: { id: moviesLibrary.Id } });
}, [moviesLibrary?.Id, navigate]);
const openShows = useCallback(() => {
if (!showsLibrary?.Id) return;
navigate({ to: "/library/$id", params: { id: showsLibrary.Id } });
}, [showsLibrary?.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>
)}
{showsLibrary?.Id && (
<button
type="button"
className="home-nav-link"
onClick={openShows}
>
Shows
</button>
)}
<button
type="button"
className="home-nav-link"
onClick={onNewAndPopular}
>
New &amp; Popular
</button>
</div>
<div className="home-header-logo" data-tauri-drag-region>
<svg
className="home-header-logo-mark"
viewBox="0 0 40 32"
fill="none"
aria-hidden="true"
>
{/* Quick marker doodle: a blinking eye with little rays. */}
<g
stroke="currentColor"
strokeWidth="2.2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M8.5 7.6 4.7 4.2" />
<path d="M14.2 5.4 13.4 1.4" />
<path d="M20.4 5.2 21.1 1.3" />
<path d="M5.2 18.4c3.7-5.9 10.5-8.3 16.6-5.7 4.2 1.8 7.6 5 9.8 8.2-4.8 4.7-12.4 6.1-18.2 3.5-3.7-1.7-6.4-3.7-8.2-6Z" />
<path
d="M18.7 18.5a2.9 2.9 0 1 0 0-5.8 2.9 2.9 0 0 0 0 5.8Z"
fill="currentColor"
stroke="none"
/>
</g>
</svg>
<span>Blink</span>
</div>
<div className="home-header-right">
<IconButton
aria-label="Watch together"
title="Watch together"
onClick={openSyncPlayDialog}
>
<span className="material-symbols-rounded">groups</span>
</IconButton>
<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 />
<WindowControls />
</div>
</header>
<NavigationDrawer
open={drawerOpen}
onClose={() => setDrawerOpen(false)}
/>
</>
);
};
export default HomeHeader;