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

+130 -207
View File
@@ -3,13 +3,12 @@ import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
import { getPersonApi } from "@jellyfin/sdk/lib/utils/api/person-api";
import { getSearchApi } from "@jellyfin/sdk/lib/utils/api/search-api";
import { useQuery } from "@tanstack/react-query";
import React, { useCallback, useEffect, useMemo, useState } from "react";
import React, { useEffect, useMemo, useState } from "react";
import { Card } from "@/components/card/card";
import CardScroller from "@/components/cardScroller/cardScroller";
import { useBackdropStore } from "@/utils/store/backdrop";
import "./search.scss";
import {
AppBar,
Box,
Chip,
Fade,
@@ -22,16 +21,11 @@ import {
Select,
type SelectChangeEvent,
Typography,
useScrollTrigger,
} from "@mui/material";
import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router";
import { useShallow } from "zustand/shallow";
import { NavigationDrawer } from "@/components/appBar/navigationDrawer";
import BackButton from "@/components/buttons/backButton";
import { UserAvatarMenu } from "@/components/userAvatarMenu";
import WindowControls from "@/components/windowControls";
import { useApiInContext } from "@/utils/store/api";
import useDebounce from "@/utils/hooks/useDebounce";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
export const Route = createFileRoute("/_api/search/")({
@@ -46,7 +40,11 @@ const CATEGORIES = [
{ label: "Сериалы", value: "Series", kind: BaseItemKind.Series },
{ label: "Серии", value: "Episode", kind: "Episode" },
{ label: "Музыка", value: "MusicAlbum", kind: BaseItemKind.MusicAlbum },
{ label: "Исполнители", value: "MusicArtist", kind: BaseItemKind.MusicArtist },
{
label: "Исполнители",
value: "MusicArtist",
kind: BaseItemKind.MusicArtist,
},
{ label: "Люди", value: "Person", kind: "Person" },
{ label: "Книги", value: "Book", kind: BaseItemKind.Book },
];
@@ -100,7 +98,7 @@ function SearchPage() {
className={`search-page-bg ${debouncedSearchTerm ? "active" : ""}`}
/>
<SearchAppBar
<SearchToolbar
searchTerm={searchTerm}
setSearchTerm={setSearchTerm}
selectedCategories={selectedCategories}
@@ -147,7 +145,7 @@ function SearchPage() {
);
}
interface SearchAppBarProps {
interface SearchToolbarProps {
searchTerm: string;
setSearchTerm: (term: string) => void;
selectedCategories: string[];
@@ -155,216 +153,141 @@ interface SearchAppBarProps {
handleClearCategories: () => void;
}
function SearchAppBar({
function SearchToolbar({
searchTerm,
setSearchTerm,
selectedCategories,
handleCategoryChange,
handleClearCategories,
}: SearchAppBarProps) {
const scrollTrigger = useScrollTrigger({
disableHysteresis: true,
threshold: 20,
});
const appBarStyling = useMemo(
() => ({ backgroundColor: "transparent", paddingRight: "0 !important" }),
[],
);
const navigate = useNavigate();
const handleNavigateToHome = useCallback(() => navigate({ to: "/home" }), []);
const handleNavigateToFavorite = useCallback(() => {
navigate({ to: "/favorite" });
}, []);
const [showDrawer, setShowDrawer] = useState(false);
}: SearchToolbarProps) {
return (
<>
<AppBar
className={
scrollTrigger
? "appBar search-header scrolling flex flex-row"
: "appBar search-header flex flex-row"
}
style={appBarStyling}
elevation={0}
color="transparent"
>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton
onClick={() => setShowDrawer(true)}
aria-label="Открыть меню"
title="Открыть меню"
>
<div className="material-symbols-rounded">menu</div>
</IconButton>
<BackButton />
<IconButton
onClick={handleNavigateToHome}
aria-label="Главная"
title="Главная"
>
<div
className={
location.pathname === "/home"
? "material-symbols-rounded fill"
: "material-symbols-rounded"
}
>
home
</div>
</IconButton>
</div>
<div
className="flex flex-row library-header-center"
style={{ gap: "0.6em" }}
>
<Box className="search-input-container">
<span className="material-symbols-rounded search-icon">search</span>
<InputBase
className="search-input"
placeholder="Поиск в библиотеке..."
fullWidth
autoFocus
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
endAdornment={
searchTerm && (
<IconButton
size="small"
onClick={() => setSearchTerm("")}
sx={{ color: "white" }}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "1.2rem" }}
>
close
</span>
</IconButton>
)
}
size="small"
/>
<FormControl size="small" className="search-category-select">
<Select
multiple
displayEmpty
value={selectedCategories}
onChange={handleCategoryChange}
input={
<OutlinedInput
endAdornment={
selectedCategories.length > 0 && (
<IconButton
size="small"
onMouseDown={(e) => {
e.stopPropagation();
}}
onClick={(e) => {
e.stopPropagation();
handleClearCategories();
}}
sx={{ p: 0.5 }}
>
<span
className="material-symbols-rounded"
style={{ fontSize: "1rem" }}
>
close
</span>
</IconButton>
)
}
/>
}
IconComponent={(props) => (
<div className="search-toolbar">
<Box className="search-input-container">
<span className="material-symbols-rounded search-icon">search</span>
<InputBase
className="search-input"
placeholder="Поиск в библиотеке..."
fullWidth
autoFocus
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
endAdornment={
searchTerm && (
<IconButton
size="small"
onClick={() => setSearchTerm("")}
sx={{ color: "white" }}
>
<span
{...props}
className={`material-symbols-rounded ${props.className}`}
className="material-symbols-rounded"
style={{ fontSize: "1.2rem" }}
>
expand_more
close
</span>
)}
renderValue={(selected) => {
if (selected.length === 0)
return (
<Typography
variant="body2"
color="textSecondary"
sx={{ opacity: 0.7 }}
</IconButton>
)
}
size="small"
/>
<FormControl size="small" className="search-category-select">
<Select
multiple
displayEmpty
value={selectedCategories}
onChange={handleCategoryChange}
input={
<OutlinedInput
endAdornment={
selectedCategories.length > 0 && (
<IconButton
size="small"
onMouseDown={(e) => {
e.stopPropagation();
}}
onClick={(e) => {
e.stopPropagation();
handleClearCategories();
}}
sx={{ p: 0.5 }}
>
Типы
</Typography>
);
<span
className="material-symbols-rounded"
style={{ fontSize: "1rem" }}
>
close
</span>
</IconButton>
)
}
/>
}
IconComponent={(props) => (
<span
{...props}
className={`material-symbols-rounded ${props.className}`}
>
expand_more
</span>
)}
renderValue={(selected) => {
if (selected.length === 0)
return (
<Box
sx={{
display: "flex",
flexWrap: "nowrap",
gap: 0.5,
overflow: "hidden",
maxWidth: "100%",
maskImage:
"linear-gradient(to right, black 85%, transparent 100%)",
}}
<Typography
variant="body2"
color="textSecondary"
sx={{ opacity: 0.7 }}
>
{selected.map((value) => {
const label =
CATEGORIES.find((c) => c.value === value)?.label ||
value;
return (
<Chip
key={value}
label={label}
size="small"
sx={{ height: 24 }}
/>
);
})}
</Box>
Типы
</Typography>
);
}}
MenuProps={{
slotProps: { paper: { className: "glass-menu-paper" } },
disableScrollLock: true,
}}
size="small"
>
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
Фильтр по типу
</Typography>
return (
<Box
sx={{
display: "flex",
flexWrap: "nowrap",
gap: 0.5,
overflow: "hidden",
maxWidth: "100%",
maskImage:
"linear-gradient(to right, black 85%, transparent 100%)",
}}
>
{selected.map((value) => {
const label =
CATEGORIES.find((c) => c.value === value)?.label || value;
return (
<Chip
key={value}
label={label}
size="small"
sx={{ height: 24 }}
/>
);
})}
</Box>
);
}}
MenuProps={{
slotProps: { paper: { className: "glass-menu-paper" } },
disableScrollLock: true,
}}
size="small"
>
<MenuItem disabled value="">
<Typography variant="overline" color="textSecondary">
Фильтр по типу
</Typography>
</MenuItem>
{CATEGORIES.map((cat) => (
<MenuItem key={cat.value} value={cat.value}>
{cat.label}
</MenuItem>
{CATEGORIES.map((cat) => (
<MenuItem key={cat.value} value={cat.value}>
{cat.label}
</MenuItem>
))}
</Select>
</FormControl>
</Box>
</div>
<div className="flex flex-row" style={{ gap: "0.6em" }}>
<IconButton
onClick={handleNavigateToFavorite}
aria-label="Избранное"
title="Избранное"
>
<div className="material-symbols-rounded">favorite</div>
</IconButton>
<UserAvatarMenu />
<WindowControls />
</div>
</AppBar>
<NavigationDrawer
open={showDrawer}
onClose={() => setShowDrawer(false)}
/>
</>
))}
</Select>
</FormControl>
</Box>
</div>
);
}
+174 -234
View File
@@ -1,248 +1,188 @@
.search-page {
position: relative;
min-height: 100vh;
display: flex;
flex-direction: column;
// Glossy subtle background animation - fixed to viewport so it stays while scrolling
&-bg {
position: fixed;
top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
background: radial-gradient(circle at center, rgba(var(--mui-palette-primary-mainChannel), 0.15) 0%, transparent 60%);
opacity: 0;
transition: opacity 0.8s ease;
pointer-events: none;
z-index: 0;
&.active {
opacity: 1;
}
}
// New Sticky AppBar styles mirroring LibraryHeader exactly
.search-header {
display: flex;
align-items: center;
justify-content: space-between;
inset: 1em 1em auto 1em !important;
border-radius: 9999px;
margin: 0 auto;
position: fixed;
width: calc(100vw - 4em) !important;
z-index: 100;
padding: 0.25em !important;
transition: all 0.2s ease-in-out;
&::after {
content: "";
position: absolute;
inset: 0 -0.35em;
pointer-events: none;
border-radius: inherit;
@include glass-effect;
opacity: 0;
z-index: -1;
transition: all $transition-time-fast;
}
&.scrolling {
&::after {
opacity: 1;
}
}
}
&-content {
flex-grow: 1;
width: 100%;
align-self: center;
z-index: 1;
padding-top: 4.4em;
}
// Input Container adapted for the pill header
.search-input-container {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 9999px; // Match pill
padding: 2px 4px 2px 16px;
flex-grow: 1;
width: 100%;
max-width: 800px;
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
height: 48px; // Match library header elements roughly
&:hover, &:focus-within {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.15);
}
position: relative;
min-height: 100vh;
display: flex;
flex-direction: column;
.search-category-select {
flex-shrink: 0;
max-width: 40%;
.MuiSelect-select {
padding-right: 24px !important; // Make room for clear icon inside select if needed, though we put it in EndAdornment
}
}
}
.search-input {
flex-grow: 1;
.MuiInputBase-input {
font-size: 1rem;
padding: 4px 8px;
color: white;
&::placeholder {
opacity: 0.6;
}
}
.search-icon {
font-size: 1.2rem;
opacity: 0.7;
margin-right: 8px;
}
}
.search-category-select {
flex-shrink: 0;
min-width: 120px;
margin-left: 8px;
.MuiOutlinedInput-root {
border-radius: 20px;
background-color: transparent ;
color: rgba(255, 255, 255, 0.9);
height: 36px;
font-size: 0.85rem;
transition: all 0.2s ease;
fieldset { border: none; }
/* Glossy background that stays put while the results scroll. */
&-bg {
position: fixed;
top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
background: radial-gradient(
circle at center,
rgba(var(--mui-palette-primary-mainChannel), 0.15) 0%,
transparent 60%
);
opacity: 0;
transition: opacity 0.8s ease;
pointer-events: none;
z-index: 0;
// Keep the clear button clear of the absolutely positioned dropdown arrow
&.MuiInputBase-adornedEnd {
padding-right: 32px;
}
&:hover {
background-color: rgba(255, 255, 255, 0.05);
}
}
}
&-empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 60vh; // Take up vertical space to look nice
text-align: center;
width: 100%;
.icon-stack {
position: relative;
height: 120px;
width: 200px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24px;
.icon-lg {
font-size: 5rem;
z-index: 2;
color: var(--mui-palette-primary-main);
filter: drop-shadow(0 0 20px rgba(var(--mui-palette-primary-mainChannel), 0.4));
}
.icon-md {
font-size: 3.5rem;
position: absolute;
right: 30px;
top: 10px;
opacity: 0.4;
transform: rotate(15deg);
}
.icon-sm {
font-size: 3rem;
position: absolute;
left: 40px;
bottom: 10px;
opacity: 0.3;
transform: rotate(-10deg);
}
}
}
&-no-results {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 4em;
opacity: 0.7;
}
&.active {
opacity: 1;
}
}
&-content {
flex-grow: 1;
width: 100%;
align-self: center;
z-index: 1;
}
}
/* Search lives inside the page now; the app titlebar owns navigation. */
.search-toolbar {
display: flex;
justify-content: center;
width: 100%;
padding: 0 0 1.25rem;
z-index: 1;
}
.search-input-container {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 9999px;
padding: 2px 4px 2px 16px;
flex-grow: 1;
width: 100%;
max-width: 800px;
transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
height: 48px;
&:hover,
&:focus-within {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.15);
}
.search-category-select {
flex-shrink: 0;
max-width: 40%;
.MuiSelect-select {
padding-right: 24px !important;
}
}
}
.search-input {
flex-grow: 1;
.MuiInputBase-input {
font-size: 1rem;
padding: 4px 8px;
color: white;
&::placeholder {
opacity: 0.6;
}
}
.search-icon {
font-size: 1.2rem;
opacity: 0.7;
margin-right: 8px;
}
}
.search-category-select {
flex-shrink: 0;
min-width: 120px;
margin-left: 8px;
.MuiOutlinedInput-root {
border-radius: 20px;
background-color: transparent;
color: rgba(255, 255, 255, 0.9);
height: 36px;
font-size: 0.85rem;
transition: all 0.2s ease;
fieldset {
border: none;
}
&.MuiInputBase-adornedEnd {
padding-right: 32px;
}
&:hover {
background-color: rgba(255, 255, 255, 0.05);
}
}
}
.search-empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 60vh;
text-align: center;
width: 100%;
.icon-stack {
position: relative;
height: 120px;
width: 200px;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24px;
.icon-lg {
font-size: 5rem;
z-index: 2;
color: var(--mui-palette-primary-main);
filter: drop-shadow(
0 0 20px rgba(var(--mui-palette-primary-mainChannel), 0.4)
);
}
.icon-md {
font-size: 3.5rem;
position: absolute;
right: 30px;
top: 10px;
opacity: 0.4;
transform: rotate(15deg);
}
.icon-sm {
font-size: 3rem;
position: absolute;
left: 40px;
bottom: 10px;
opacity: 0.3;
transform: rotate(-10deg);
}
}
}
.search-no-results {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 4em;
opacity: 0.7;
}
@media (max-width: 900px) {
.search-page .search-header {
inset: calc(0.5em + var(--safe-top)) 0.5em auto 0.5em !important;
width: auto !important;
flex-wrap: wrap;
border-radius: 22px;
padding: 0.3em 0.5em !important;
row-gap: 0.25em;
html.is-macos & {
left: 76px !important;
right: 0.5em !important;
width: auto !important;
/* The window traffic lights are already cleared by the offset. */
padding-left: 0.5em !important;
}
.library-header-center {
order: 3;
width: 100%;
}
.search-input-container {
height: 42px;
}
.search-category-select {
display: none;
}
> .flex.flex-row:last-child [aria-label="Избранное"] {
display: none;
}
.search-toolbar {
padding-bottom: 1rem;
}
.search-page-content {
padding: calc(8.4em + var(--safe-top)) 1rem calc(8rem + var(--safe-bottom));
.search-input-container {
height: 42px;
}
}
@media (min-width: 701px) and (max-width: 900px) {
.search-page .search-header {
.search-category-select {
display: block;
}
> .flex.flex-row:last-child [aria-label="Избранное"] {
display: inline-flex;
}
.search-category-select {
display: none;
}
}