update
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

This commit is contained in:
1xDed committed 2026-12-02 08:37:23 +03:00
1 parent 7fb3d6cfa4
commit cbb750a413
67 files changed
+5399 -3413

No files matched your search

+330
View File
@@ -0,0 +1,330 @@
:root {
--app-titlebar-height: 64px;
}
@media (max-width: 900px) {
:root {
--app-titlebar-height: calc(96px + var(--safe-top));
}
}
html:not(.has-app-titlebar) {
--app-titlebar-height: 0px;
}
/* One titlebar for the whole app: brand and sections on the left, utilities
and window buttons on the right. It floats above the page; page content
insets itself by `--app-titlebar-height`, so route roots all start at y=0
and transitions never shift the page vertically. */
.app-titlebar {
position: fixed;
inset: 0 0 auto;
z-index: 1000;
display: grid;
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
grid-template-areas: "start nav actions";
align-items: center;
gap: 1rem;
height: var(--app-titlebar-height);
padding: 0 clamp(1.1rem, 2.4vw, 2.4rem);
box-sizing: border-box;
color: #fff;
background: transparent;
isolation: isolate;
/* Two layers that cross-fade: the glass surface and the soft gradient used
while the titlebar floats over the home hero. No hard border between the
bar and the page. */
&::before,
&::after {
content: "";
position: absolute;
inset: 0;
z-index: -1;
pointer-events: none;
}
&::before {
inset: 0 0 -14px;
background: rgb(12 13 18 / 0.74);
backdrop-filter: blur(24px) saturate(170%);
mask-image: linear-gradient(
to bottom,
#000 calc(100% - 14px),
transparent 100%
);
-webkit-mask-image: linear-gradient(
to bottom,
#000 calc(100% - 14px),
transparent 100%
);
opacity: 1;
transition: opacity 360ms cubic-bezier(0.33, 1, 0.68, 1);
will-change: opacity;
}
&::after {
background: linear-gradient(
180deg,
rgb(0 0 0 / 0.58) 0%,
rgb(0 0 0 / 0.24) 62%,
transparent 100%
);
opacity: 0;
transition: opacity 360ms cubic-bezier(0.33, 1, 0.68, 1);
will-change: opacity;
}
html.is-macos & {
padding-left: calc(clamp(1.1rem, 2.4vw, 2.4rem) + 72px);
}
/* Home: transparent over the hero until the page starts scrolling. */
&--overlay {
&::before {
opacity: 0;
}
&::after {
opacity: 1;
}
}
.MuiIconButton-root {
width: 2.35rem;
height: 2.35rem;
color: rgb(255 255 255 / 0.76);
transition:
color 150ms ease,
background-color 150ms ease;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.1);
}
}
.MuiIconButton-root.Mui-disabled {
color: rgb(255 255 255 / 0.25);
}
.window-controls {
margin-left: 0.4rem;
background: rgb(255 255 255 / 0.05);
}
}
.app-titlebar-top {
display: contents;
}
.app-titlebar-start {
grid-area: start;
display: flex;
align-items: center;
gap: 0.35rem;
min-width: 0;
}
.app-titlebar-brand {
display: inline-flex;
align-items: center;
gap: 0.55rem;
min-width: 0;
padding: 0.2rem 0.35rem 0.2rem 0.15rem;
border-radius: 10px;
color: #fff;
font-family: "Medeo Sans", system-ui, sans-serif;
font-size: 1.45rem;
font-weight: 700;
letter-spacing: -0.02em;
line-height: 1;
text-decoration: none;
user-select: none;
&-mark {
width: 2rem;
height: 1.6rem;
flex: 0 0 auto;
overflow: visible;
}
}
.app-titlebar-nav {
grid-area: nav;
display: flex;
align-items: center;
justify-content: center;
gap: 0.1rem;
min-width: 0;
}
.app-titlebar-nav-link {
position: relative;
display: inline-flex;
align-items: center;
height: 2.4rem;
padding: 0 0.95rem;
border-radius: 999px;
color: rgb(255 255 255 / 0.64);
font-size: 0.92rem;
font-weight: 500;
text-decoration: none;
white-space: nowrap;
transition:
color 150ms ease,
background-color 150ms ease;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.07);
}
&.is-active {
color: #fff;
background: rgb(255 255 255 / 0.09);
&::after {
content: "";
position: absolute;
left: 50%;
bottom: 0.28rem;
width: 1.35rem;
height: 2px;
border-radius: 2px;
background: $clr-accent-default;
transform: translateX(-50%);
}
}
}
.app-titlebar-actions {
grid-area: actions;
display: flex;
align-items: center;
justify-content: flex-end;
gap: 0.1rem;
min-width: 0;
}
.app-titlebar-icon-link {
display: inline-flex;
align-items: center;
justify-content: center;
width: 2.35rem;
height: 2.35rem;
border-radius: 50%;
color: rgb(255 255 255 / 0.76);
text-decoration: none;
transition:
color 150ms ease,
background-color 150ms ease;
&:hover {
color: #fff;
background: rgb(255 255 255 / 0.1);
}
.material-symbols-rounded {
font-size: 1.35rem;
}
}
@media (max-width: 1100px) {
.app-titlebar-cast {
display: none !important;
}
}
html.is-android .app-titlebar-downloads {
display: none !important;
}
@media (max-width: 900px) {
.app-titlebar {
display: flex;
flex-direction: column;
align-items: stretch;
gap: 0;
padding: calc(var(--safe-top) + 0.3rem) 0.6rem 0.35rem;
.MuiIconButton-root {
width: 2.15rem;
height: 2.15rem;
}
}
.app-titlebar-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.5rem;
height: 46px;
}
.app-titlebar-start {
min-width: 0;
gap: 0.2rem;
}
.app-titlebar-brand {
gap: 0.4rem;
font-size: 1.18rem;
&-mark {
width: 1.55rem;
height: 1.28rem;
}
}
.app-titlebar-nav {
justify-content: flex-start;
width: 100%;
height: 38px;
gap: 0.05rem;
overflow-x: auto;
overflow-y: hidden;
scrollbar-width: none;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
display: none;
}
}
.app-titlebar-nav-link {
height: 32px;
padding: 0 0.72rem;
font-size: 0.84rem;
&.is-active::after {
bottom: 0.18rem;
}
}
.app-titlebar-actions {
gap: 0;
}
.app-titlebar-icon-link {
width: 2.15rem;
height: 2.15rem;
}
}
@media (max-width: 700px) {
.app-titlebar {
html.is-macos & {
padding-left: 0.6rem;
}
.window-controls {
display: none;
}
}
.app-titlebar-cast,
.app-titlebar-downloads {
display: none !important;
}
}
+182
View File
@@ -0,0 +1,182 @@
import { IconButton, Tooltip, useScrollTrigger } from "@mui/material";
import { Link, useLocation, useNavigate } from "@tanstack/react-router";
import React, { useEffect, useLayoutEffect, useRef } from "react";
import { useShallow } from "zustand/shallow";
import BackButton from "@/components/buttons/backButton";
import CastButton from "@/components/buttons/castButton";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
import WindowControls from "@/components/windowControls";
import {
getLocalMediaTransfer,
useCurrentMediaItem,
} from "@/utils/methods/localTransfer";
import useSearchStore from "@/utils/store/search";
import { shouldShowTitlebar } from "./routeVisibility";
import { type AppNavItem, useAppNavigation } from "./useAppNavigation";
import "./appTitlebar.scss";
const BlinkMark = () => (
<svg
className="app-titlebar-brand-mark"
viewBox="0 0 40 32"
fill="none"
aria-hidden="true"
>
<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>
);
const isItemActive = (item: AppNavItem, pathname: string) =>
item.kind === "home"
? pathname === "/home"
: pathname === `/library/${item.libraryId}` ||
(item.key === "music" && pathname.startsWith("/music/"));
const NavItem = ({ item, active }: { item: AppNavItem; active: boolean }) => {
const className = `app-titlebar-nav-link${active ? " is-active" : ""}`;
if (item.kind === "home") {
return (
<Link
to="/home"
className={className}
aria-current={active ? "page" : undefined}
>
{item.label}
</Link>
);
}
return (
<Link
to="/library/$id"
params={{ id: item.libraryId }}
className={className}
aria-current={active ? "page" : undefined}
>
{item.label}
</Link>
);
};
export const AppTitlebar = () => {
const { pathname } = useLocation();
const navigate = useNavigate();
const visible = shouldShowTitlebar(pathname);
const isHome = pathname === "/home";
const scrolled = useScrollTrigger({
disableHysteresis: true,
threshold: 20,
});
const navigation = useAppNavigation(visible);
const navRef = useRef<HTMLElement | null>(null);
const currentMedia = useCurrentMediaItem();
const toggleSearchDialog = useSearchStore(
useShallow((s) => s.toggleSearchDialog),
);
useLayoutEffect(() => {
document.documentElement.classList.toggle("has-app-titlebar", visible);
}, [visible]);
useEffect(() => {
const active = navRef.current?.querySelector<HTMLElement>(
".app-titlebar-nav-link.is-active",
);
active?.scrollIntoView({
behavior: "smooth",
block: "nearest",
inline: "center",
});
}, [pathname, navigation.length]);
if (!visible) return null;
const overlay = isHome && !scrolled;
return (
<>
<header
className={`app-titlebar${overlay ? " app-titlebar--overlay" : ""}`}
data-tauri-drag-region
>
<div className="app-titlebar-top">
<div className="app-titlebar-start" data-tauri-drag-region>
<BackButton />
<Link
to="/home"
className="app-titlebar-brand"
aria-label="Blink — на главную"
>
<BlinkMark />
<span>Blink</span>
</Link>
</div>
<div className="app-titlebar-actions" data-tauri-drag-region>
<span className="app-titlebar-cast">
<CastButton
item={currentMedia}
getTransfer={getLocalMediaTransfer}
/>
</span>
<Tooltip title="Поиск">
<IconButton onClick={toggleSearchDialog} aria-label="Поиск">
<span className="material-symbols-rounded">search</span>
</IconButton>
</Tooltip>
<Tooltip title="Загрузки">
<IconButton
className="app-titlebar-downloads"
onClick={() => navigate({ to: "/downloads" })}
aria-label="Загрузки"
>
<span className="material-symbols-rounded">download</span>
</IconButton>
</Tooltip>
<Tooltip title="Настройки">
<Link
to="/settings/preferences"
className="app-titlebar-icon-link"
aria-label="Настройки"
>
<span className="material-symbols-rounded">settings</span>
</Link>
</Tooltip>
<UserAvatarMenu />
<WindowControls />
</div>
</div>
<nav
ref={navRef}
className="app-titlebar-nav"
aria-label="Основная навигация"
>
{navigation.map((item) => (
<NavItem
key={item.key}
item={item}
active={isItemActive(item, pathname)}
/>
))}
</nav>
</header>
</>
);
};
@@ -0,0 +1,8 @@
const HIDDEN_PREFIXES = ["/login", "/setup", "/server", "/error", "/player"];
/** Routes that keep the global titlebar. Auth, setup and players do not. */
export const shouldShowTitlebar = (pathname: string) =>
pathname !== "/" &&
!HIDDEN_PREFIXES.some(
(prefix) => pathname === prefix || pathname.startsWith(`${prefix}/`),
);
@@ -0,0 +1,72 @@
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import { getUserViewApi } from "@jellyfin/sdk/lib/utils/api/user-view-api";
import { useQuery } from "@tanstack/react-query";
import { useMemo } from "react";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
export type AppNavItem =
| {
kind: "home";
key: "home";
label: string;
}
| {
kind: "library";
key: "movies" | "tvshows" | "music";
label: string;
libraryId: string;
};
const LIBRARY_NAV = [
{ key: "movies", collectionType: "movies", label: "Фильмы" },
{ key: "tvshows", collectionType: "tvshows", label: "Сериалы" },
{ key: "music", collectionType: "music", label: "Музыка" },
] as const;
/**
* The four permanent sections of the app titlebar. Library items are resolved
* from the same cached `getUserViews` query the home page already loads.
*/
export const useAppNavigation = (enabled: boolean) => {
const api = useApiInContext((s) => s.api);
const user = useCentralStore((s) => s.currentUser);
const libraries = useQuery({
queryKey: ["libraries"],
queryFn: async () => {
if (!api?.accessToken || !user?.Id) return undefined;
const response = await getUserViewApi(api).getUserViews({
userId: user.Id,
});
return response.data;
},
enabled: enabled && !!api?.accessToken && !!user?.Id,
staleTime: 5 * 60 * 1000,
networkMode: "always",
});
const items = useMemo<AppNavItem[]>(() => {
const list: AppNavItem[] = [
{ kind: "home", key: "home", label: "Главная" },
];
const views: BaseItemDto[] = libraries.data?.Items ?? [];
for (const entry of LIBRARY_NAV) {
const library = views.find(
(view) => view.Id && view.CollectionType === entry.collectionType,
);
if (!library?.Id) continue;
list.push({
kind: "library",
key: entry.key,
label: entry.label,
libraryId: library.Id,
});
}
return list;
}, [libraries.data]);
return items;
};