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
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:
1 parent
7fb3d6cfa4
commit
cbb750a413
67 files changed
+5399
-3413
No files matched your search
@@ -4,7 +4,7 @@ import { ThemeProvider } from "@mui/material/styles";
|
||||
import { createRootRouteWithContext, Outlet } from "@tanstack/react-router";
|
||||
import { SnackbarProvider } from "notistack";
|
||||
import React from "react";
|
||||
import { AppBar } from "@/components/appBar/appBar";
|
||||
import { AppTitlebar } from "@/components/appTitlebar";
|
||||
import MobilePreview from "@/components/mobilePreview";
|
||||
// import NProgress from "@/components/nProgress";
|
||||
import AudioPlayer from "@/components/playback/audioPlayer";
|
||||
@@ -25,22 +25,22 @@ import Backdrop from "@/components/backdrop";
|
||||
import DeepLinkHandler from "@/components/deepLinks";
|
||||
import FollowMe from "@/components/followMe";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import QuickConnectApprovalDialog from "@/components/quickConnectApproval";
|
||||
import ShareDialog from "@/components/share";
|
||||
import OverlayScrollbar from "@/components/overlayScrollbar";
|
||||
import PlaybackSync from "@/components/playback/PlaybackSync";
|
||||
import QuickConnectApprovalDialog from "@/components/quickConnectApproval";
|
||||
import RealtimeBridge from "@/components/realtime";
|
||||
import SplashHider from "@/components/splash";
|
||||
import RemoteControlDialog from "@/components/remoteControl";
|
||||
import RouterLoading from "@/components/routerLoading";
|
||||
import SpatialNavigation from "@/components/spatialNavigation";
|
||||
import SyncPlayController from "@/components/syncPlay/controller";
|
||||
import SyncPlayDialog from "@/components/syncPlay";
|
||||
import Search from "@/components/search";
|
||||
import ShareDialog from "@/components/share";
|
||||
import SpatialNavigation from "@/components/spatialNavigation";
|
||||
import SplashHider from "@/components/splash";
|
||||
import SyncPlayDialog from "@/components/syncPlay";
|
||||
import SyncPlayController from "@/components/syncPlay/controller";
|
||||
import Updater from "@/components/updater";
|
||||
import WindowResizeHandles from "@/components/windowControls/resizeHandles";
|
||||
import WindowChrome from "@/components/windowControls/windowChrome";
|
||||
import WindowDrag from "@/components/windowControls/windowDrag";
|
||||
import WindowResizeHandles from "@/components/windowControls/resizeHandles";
|
||||
|
||||
type ApiContext = {
|
||||
api: Api | undefined;
|
||||
@@ -72,7 +72,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<ShareDialog />
|
||||
<QuickConnectApprovalDialog />
|
||||
<DeepLinkHandler />
|
||||
<AppBar />
|
||||
<AppTitlebar />
|
||||
<MobilePreview />
|
||||
<WindowChrome />
|
||||
<WindowDrag />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/* Home page: a full-bleed cinema window with an integrated header. */
|
||||
/* Home page: a full-bleed cinema window under the global titlebar. The route
|
||||
root starts at y=0; the titlebar floats over the hero. */
|
||||
.home-cinema {
|
||||
--home-trending-space: 200px;
|
||||
|
||||
@@ -22,107 +23,6 @@ body.has-player-bar .home-cinema {
|
||||
background: #08090d;
|
||||
}
|
||||
|
||||
/* Header floating over the hero artwork. */
|
||||
.home-header {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 20;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr auto 1fr;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
padding: 1.3rem clamp(1.5rem, 3vw, 2.5rem) 1.4rem;
|
||||
color: #fff;
|
||||
background: linear-gradient(180deg, rgb(0 0 0 / 0.42), transparent);
|
||||
|
||||
&-left,
|
||||
&-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.35rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-right {
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
// Keep the menu clear of the macOS traffic lights now that the frame
|
||||
// reaches the window edges, and align it vertically with them.
|
||||
html.is-macos & {
|
||||
padding-top: 0.6rem;
|
||||
|
||||
&-left {
|
||||
padding-left: 64px;
|
||||
}
|
||||
}
|
||||
|
||||
&-logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
font-family: "Medeo Sans", system-ui, sans-serif;
|
||||
font-size: 2.55rem;
|
||||
font-weight: 700;
|
||||
font-style: normal;
|
||||
letter-spacing: 0;
|
||||
line-height: 0.9;
|
||||
user-select: none;
|
||||
text-shadow: 0 2px 18px rgb(0 0 0 / 0.5);
|
||||
|
||||
&-mark {
|
||||
width: 2.15rem;
|
||||
height: 1.72rem;
|
||||
flex: 0 0 auto;
|
||||
color: currentColor;
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.home-nav-link {
|
||||
padding: 0.5rem 0.7rem;
|
||||
border: 0;
|
||||
border-radius: 999px;
|
||||
background: transparent;
|
||||
color: rgb(255 255 255 / 0.76);
|
||||
font: inherit;
|
||||
font-size: 0.92rem;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
color 0.18s ease,
|
||||
background-color 0.18s ease;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
}
|
||||
}
|
||||
|
||||
.MuiIconButton-root {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
color: rgb(255 255 255 / 0.88);
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
border: 1px solid rgb(255 255 255 / 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
transition:
|
||||
background-color 0.18s ease,
|
||||
color 0.18s ease;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.16);
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.home-sections {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -244,14 +144,9 @@ body.has-player-bar .home-sections {
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.home-header {
|
||||
.home-nav-link {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-logo {
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
.cinema-trending {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,30 +161,6 @@ body.has-player-bar .home-sections {
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.home-header {
|
||||
padding: calc(0.55rem + var(--safe-top)) 0.8rem 1rem;
|
||||
|
||||
.home-header-groups,
|
||||
.home-header-cast {
|
||||
display: none;
|
||||
}
|
||||
|
||||
&-logo {
|
||||
font-size: 1.4rem;
|
||||
gap: 0.35rem;
|
||||
|
||||
&-mark {
|
||||
width: 1.7rem;
|
||||
height: 1.4rem;
|
||||
}
|
||||
}
|
||||
|
||||
.MuiIconButton-root {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
}
|
||||
|
||||
.cinema-trending {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
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="Открыть меню"
|
||||
onClick={() => setDrawerOpen(true)}
|
||||
>
|
||||
<span className="material-symbols-rounded">menu</span>
|
||||
</IconButton>
|
||||
{moviesLibrary?.Id && (
|
||||
<button
|
||||
type="button"
|
||||
className="home-nav-link"
|
||||
onClick={openMovies}
|
||||
>
|
||||
Фильмы
|
||||
</button>
|
||||
)}
|
||||
{showsLibrary?.Id && (
|
||||
<button
|
||||
type="button"
|
||||
className="home-nav-link"
|
||||
onClick={openShows}
|
||||
>
|
||||
Сериалы
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="home-nav-link"
|
||||
onClick={onNewAndPopular}
|
||||
>
|
||||
Новинки
|
||||
</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
|
||||
className="home-header-groups"
|
||||
aria-label="Смотреть вместе"
|
||||
title="Смотреть вместе"
|
||||
onClick={openSyncPlayDialog}
|
||||
>
|
||||
<span className="material-symbols-rounded">groups</span>
|
||||
</IconButton>
|
||||
<IconButton aria-label="Поиск" onClick={toggleSearchDialog}>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<span className="home-header-cast">
|
||||
<CastButton />
|
||||
</span>
|
||||
<IconButton
|
||||
aria-label="Избранное"
|
||||
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;
|
||||
+181
-190
@@ -28,7 +28,6 @@ import { getLatestItemsQueryOptions } from "@/utils/queries/items";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import HomeHeader from "./homeHeader";
|
||||
|
||||
export const Route = createFileRoute("/_api/home/")({
|
||||
component: Home,
|
||||
@@ -62,9 +61,7 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const latestMedia = useQuery(
|
||||
getLatestItemsQueryOptions(api, user.Id),
|
||||
);
|
||||
const latestMedia = useQuery(getLatestItemsQueryOptions(api, user.Id));
|
||||
|
||||
const resumeItemsVideo = useQuery({
|
||||
queryKey: ["home", "resume", "video"],
|
||||
@@ -172,12 +169,6 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
[heroItems, setBackdropForItem],
|
||||
);
|
||||
|
||||
const scrollToNewAndPopular = useCallback(() => {
|
||||
document
|
||||
.getElementById("home-sections")
|
||||
?.scrollIntoView({ behavior: "smooth", block: "start" });
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!libraries.data || !latestMedia.data) return;
|
||||
performance.mark("blink:home-ready");
|
||||
@@ -188,10 +179,6 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
return (
|
||||
<main className="home-cinema">
|
||||
<div className="home-frame">
|
||||
<HomeHeader
|
||||
libraries={libraries.data?.Items ?? []}
|
||||
onNewAndPopular={scrollToNewAndPopular}
|
||||
/>
|
||||
<section
|
||||
className="home-skeleton"
|
||||
aria-busy="true"
|
||||
@@ -220,11 +207,6 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
return (
|
||||
<main className="home-cinema">
|
||||
<div className="home-frame">
|
||||
<HomeHeader
|
||||
libraries={libraries.data?.Items ?? []}
|
||||
onNewAndPopular={scrollToNewAndPopular}
|
||||
/>
|
||||
|
||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||
{heroItems.length > 0 && (
|
||||
<Carousel content={heroItems} onChange={handleOnChangeCarousel} />
|
||||
@@ -232,178 +214,187 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
</ErrorBoundary>
|
||||
|
||||
<div className="home-sections" id="home-sections">
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка карусели</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<CardScroller displayCards={4} title="Библиотеки">
|
||||
{libraries.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType="Primary"
|
||||
cardType="thumb"
|
||||
disableOverlay
|
||||
onClick={() => {
|
||||
if (item.Id) {
|
||||
navigate({ to: "/library/$id", params: { id: item.Id } });
|
||||
}
|
||||
}}
|
||||
overrideIcon={item.CollectionType}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка библиотек</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{upNextItems.isSuccess &&
|
||||
(upNextItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller displayCards={4} title="Далее">
|
||||
{upNextItems.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: item.ImageTags?.Thumb
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.ParentIndexNumber === 0
|
||||
? `${item.SeasonName} - ${item.Name}`
|
||||
: item.IndexNumberEnd
|
||||
? `${item.IndexNumber}-${item.IndexNumberEnd}. ${item.Name}`
|
||||
: `${item.IndexNumber}. ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString("ru-RU", {
|
||||
year: "numeric",
|
||||
})
|
||||
: "н.в."
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "upNext"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка карусели</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<CardScroller displayCards={4} title="Библиотеки">
|
||||
{libraries.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType="Primary"
|
||||
cardType="thumb"
|
||||
disableOverlay
|
||||
onClick={() => {
|
||||
if (item.Id) {
|
||||
navigate({
|
||||
to: "/library/$id",
|
||||
params: { id: item.Id },
|
||||
});
|
||||
}
|
||||
}}
|
||||
overrideIcon={item.CollectionType}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка библиотек</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{upNextItems.isSuccess &&
|
||||
(upNextItems.data?.TotalRecordCount ?? 0) > 0 && (
|
||||
<CardScroller displayCards={4} title="Далее">
|
||||
{upNextItems.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: item.ImageTags?.Thumb
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.ParentIndexNumber === 0
|
||||
? `${item.SeasonName} - ${item.Name}`
|
||||
: item.IndexNumberEnd
|
||||
? `${item.IndexNumber}-${item.IndexNumberEnd}. ${item.Name}`
|
||||
: `${item.IndexNumber}. ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString(
|
||||
"ru-RU",
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "н.в."
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "upNext"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка продолжения просмотра</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsVideo.isSuccess &&
|
||||
!resumeItemsVideo.data?.TotalRecordCount ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Продолжить просмотр">
|
||||
{resumeItemsVideo.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: item.ImageTags?.Thumb
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString(
|
||||
"ru-RU",
|
||||
{
|
||||
year: "numeric",
|
||||
},
|
||||
)
|
||||
: "н.в."
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "video"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка продолжения прослушивания</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsAudio.isSuccess &&
|
||||
!resumeItemsAudio.data?.TotalRecordCount ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Продолжить прослушивание">
|
||||
{resumeItemsAudio.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType="Primary"
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "audio"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка новых материалов</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{latestMediaLibs?.map((lib) => {
|
||||
return <LatestMediaSection key={lib.Id} latestMediaLib={lib} />;
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка продолжения просмотра</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsVideo.isSuccess &&
|
||||
!resumeItemsVideo.data?.TotalRecordCount ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Продолжить просмотр">
|
||||
{resumeItemsVideo.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? item.SeriesName
|
||||
: item.Name
|
||||
}
|
||||
imageType={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? "Primary"
|
||||
: item.ImageTags?.Thumb
|
||||
? "Thumb"
|
||||
: "Backdrop"
|
||||
}
|
||||
cardCaption={
|
||||
item.Type === BaseItemKind.Episode
|
||||
? `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`
|
||||
: item.Type === BaseItemKind.Series
|
||||
? `${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString("ru-RU", {
|
||||
year: "numeric",
|
||||
})
|
||||
: "н.в."
|
||||
}`
|
||||
: item.ProductionYear
|
||||
}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "video"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка продолжения прослушивания</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{resumeItemsAudio.isSuccess &&
|
||||
!resumeItemsAudio.data?.TotalRecordCount ? (
|
||||
<></>
|
||||
) : (
|
||||
<CardScroller displayCards={4} title="Продолжить прослушивание">
|
||||
{resumeItemsAudio.data?.Items?.map((item) => {
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType="Primary"
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="thumb"
|
||||
queryKey={["home", "resume", "audio"]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
</ErrorBoundary>
|
||||
<ErrorBoundary
|
||||
fallback={
|
||||
<div className="error">
|
||||
<Typography>Ошибка новых материалов</Typography>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{latestMediaLibs?.map((lib) => {
|
||||
return <LatestMediaSection key={lib.Id} latestMediaLib={lib} />;
|
||||
})}
|
||||
</ErrorBoundary>
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { BaseItemKind, ItemSortBy } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import React, { Suspense, useEffect } from "react";
|
||||
import React, { Suspense } from "react";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import "./library.scss";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
@@ -13,7 +13,6 @@ import { getDefaultSortByForCollectionType } from "@/utils/constants/library";
|
||||
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useHeaderStore from "@/utils/store/header";
|
||||
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||
|
||||
// type SortByObject = { title: string; value: string };
|
||||
@@ -66,16 +65,14 @@ function Library() {
|
||||
getLibraryQueryOptions(api, user?.Id, id),
|
||||
);
|
||||
const updateLibrary = useLibraryStateStore((s) => s.updateLibrary);
|
||||
const { libraryName: storeLibraryName, currentViewType } =
|
||||
useLibraryStateStore(
|
||||
useShallow((s) => {
|
||||
const sl = s.libraries[id || ""];
|
||||
return {
|
||||
libraryName: sl?.libraryName,
|
||||
currentViewType: sl?.currentViewType,
|
||||
} as const;
|
||||
}),
|
||||
);
|
||||
const { currentViewType } = useLibraryStateStore(
|
||||
useShallow((s) => {
|
||||
const sl = s.libraries[id || ""];
|
||||
return {
|
||||
currentViewType: sl?.currentViewType,
|
||||
} as const;
|
||||
}),
|
||||
);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!id || !currentLib.data) return;
|
||||
@@ -83,18 +80,6 @@ function Library() {
|
||||
updateLibrary(id, { libraryName: currentLib.data.Name ?? undefined });
|
||||
}, [id, updateLibrary, currentLib.data]);
|
||||
|
||||
const { setPageTitle } = useHeaderStore(
|
||||
useShallow((state) => ({
|
||||
setPageTitle: state.setPageTitle,
|
||||
})),
|
||||
);
|
||||
// Derive top app title from Zustand slice (library name)
|
||||
useEffect(() => {
|
||||
const title = storeLibraryName ?? "Библиотека";
|
||||
setPageTitle(title);
|
||||
return () => setPageTitle(null);
|
||||
}, [storeLibraryName, setPageTitle]);
|
||||
|
||||
/* if (!id) {
|
||||
// show loading if any route param is missing
|
||||
return <LoadingIndicator />;
|
||||
@@ -122,7 +107,20 @@ function Library() {
|
||||
</div>
|
||||
)}
|
||||
>
|
||||
<Suspense fallback={<LibraryItemsSkeleton />}>
|
||||
<Suspense
|
||||
fallback={
|
||||
<LibraryItemsSkeleton
|
||||
square={
|
||||
currentViewType === BaseItemKind.MusicAlbum ||
|
||||
currentViewType === BaseItemKind.Audio ||
|
||||
currentViewType === BaseItemKind.Genre ||
|
||||
currentViewType === BaseItemKind.MusicGenre ||
|
||||
currentViewType === BaseItemKind.Studio ||
|
||||
currentViewType === BaseItemKind.Playlist
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<div className="library-items">
|
||||
<LibraryItemsGrid />
|
||||
</div>
|
||||
@@ -134,7 +132,7 @@ function Library() {
|
||||
currentLib.data.CollectionType === "music"
|
||||
? "max(14px, calc((100vw - 1180px) / 2 + 18px))"
|
||||
: 14,
|
||||
top: 80,
|
||||
top: "calc(var(--app-titlebar-height) + 96px)",
|
||||
}}
|
||||
>
|
||||
<AlphaSelector />
|
||||
@@ -144,4 +142,4 @@ function Library() {
|
||||
</ErrorBoundary>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -215,13 +215,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.alpha-selector {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.library.padded-top {
|
||||
padding-top: 0 !important;
|
||||
padding-top: calc(var(--app-titlebar-height) + 0.75rem) !important;
|
||||
}
|
||||
|
||||
.library-items {
|
||||
padding-top: calc(8.4em + var(--safe-top)) !important;
|
||||
padding-top: 0.5rem !important;
|
||||
padding-bottom: calc(7.5em + var(--safe-bottom)) !important;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
max-width: 1180px;
|
||||
margin: 0 auto;
|
||||
padding: clamp(3.4em, 6vw, 4.6em) clamp(1.5em, 4vw, 3.5em) 7em;
|
||||
padding-top: calc(var(--app-titlebar-height) + clamp(3.4em, 6vw, 4.6em));
|
||||
|
||||
.music-hero {
|
||||
display: flex;
|
||||
|
||||
@@ -10,7 +10,11 @@ import "./videoPlayer.scss";
|
||||
|
||||
import { RepeatMode } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { createFileRoute, useNavigate, useRouter } from "@tanstack/react-router";
|
||||
import {
|
||||
createFileRoute,
|
||||
useNavigate,
|
||||
useRouter,
|
||||
} from "@tanstack/react-router";
|
||||
import JASSUB from "jassub";
|
||||
import wasmUrl from "jassub/dist/wasm/jassub-worker.wasm?url"; // non-SIMD fallback
|
||||
import modernWasmUrl from "jassub/dist/wasm/jassub-worker-modern.wasm?url"; // SIMD
|
||||
@@ -27,14 +31,6 @@ import StatsForNerds from "@/components/playback/videoPlayer/StatsForNerds";
|
||||
import UpNextFlyout from "@/components/playback/videoPlayer/upNextFlyout";
|
||||
import VolumeChangeOverlay from "@/components/playback/videoPlayer/VolumeChangeOverlay";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import {
|
||||
getAutoSkipSegments,
|
||||
getVideoFitMode,
|
||||
setVideoFitMode,
|
||||
} from "@/utils/storage/player";
|
||||
import type { VideoFitMode } from "@/utils/types/videoFitMode";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import {
|
||||
inSyncPlayGroup,
|
||||
nextSyncPlayItem,
|
||||
@@ -44,9 +40,17 @@ import {
|
||||
reportSyncPlayResume,
|
||||
reportSyncPlaySeek,
|
||||
} from "@/utils/methods/syncPlay";
|
||||
import {
|
||||
getAutoSkipSegments,
|
||||
getVideoFitMode,
|
||||
setVideoFitMode,
|
||||
} from "@/utils/storage/player";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useQueue, { clearQueue } from "@/utils/store/queue";
|
||||
import type subtitlePlaybackInfo from "@/utils/types/subtitlePlaybackInfo";
|
||||
import type { VideoFitMode } from "@/utils/types/videoFitMode";
|
||||
import font from "./Noto-Sans-Indosphere.ttf?url";
|
||||
|
||||
/**
|
||||
@@ -100,6 +104,7 @@ export function VideoPlayer() {
|
||||
const navigate = useNavigate();
|
||||
const { history } = useRouter();
|
||||
const player = useRef<HTMLVideoElement | null>(null);
|
||||
const exitingPlayerRef = useRef(false);
|
||||
/** Re-apply the transfer/resume position until the HLS player stabilises. */
|
||||
const startSeekRef = useRef<{ target: number; expiresAt: number } | null>(
|
||||
null,
|
||||
@@ -204,11 +209,7 @@ export function VideoPlayer() {
|
||||
const cycleFitMode = useCallback(() => {
|
||||
setFitMode((current) => {
|
||||
const next =
|
||||
current === "fit"
|
||||
? "fill"
|
||||
: current === "fill"
|
||||
? "stretch"
|
||||
: "fit";
|
||||
current === "fit" ? "fill" : current === "fill" ? "stretch" : "fit";
|
||||
void setVideoFitMode(next);
|
||||
return next;
|
||||
});
|
||||
@@ -312,24 +313,24 @@ export function VideoPlayer() {
|
||||
) {
|
||||
if (typeof MediaMetadata !== "undefined") {
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
title: isEpisode
|
||||
? `${itemName} - ${episodeTitle}`
|
||||
: (itemName ?? "Blink"),
|
||||
album: isEpisode ? (itemName ?? "Blink") : undefined,
|
||||
artwork: [
|
||||
{
|
||||
src: getImageUrlsApi(api).getItemImageUrlById(
|
||||
itemId ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
},
|
||||
),
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
},
|
||||
],
|
||||
});
|
||||
title: isEpisode
|
||||
? `${itemName} - ${episodeTitle}`
|
||||
: (itemName ?? "Blink"),
|
||||
album: isEpisode ? (itemName ?? "Blink") : undefined,
|
||||
artwork: [
|
||||
{
|
||||
src: getImageUrlsApi(api).getItemImageUrlById(
|
||||
itemId ?? "",
|
||||
"Primary",
|
||||
{
|
||||
quality: 80,
|
||||
},
|
||||
),
|
||||
sizes: "512x512",
|
||||
type: "image/png",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
navigator.mediaSession.setActionHandler("play", () => {
|
||||
toggleIsPlaying();
|
||||
@@ -393,15 +394,24 @@ export function VideoPlayer() {
|
||||
VolumeLevel: Math.floor(volume * 100),
|
||||
},
|
||||
});
|
||||
const player = getVideoElement();
|
||||
reportSyncPlayReady(
|
||||
api,
|
||||
secToTicks(getVideoElement()?.currentTime ?? 0),
|
||||
true,
|
||||
secToTicks(player?.currentTime ?? 0),
|
||||
Boolean(player && !player.paused),
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const lastReportTimeRef = useRef<number>(0);
|
||||
const bufferReportTimer = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
useEffect(
|
||||
() => () => {
|
||||
if (bufferReportTimer.current) clearTimeout(bufferReportTimer.current);
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const handleTimeUpdate = useCallback(async () => {
|
||||
const videoElement = getVideoElement();
|
||||
@@ -491,7 +501,9 @@ export function VideoPlayer() {
|
||||
VolumeLevel: Math.floor(volume * 100),
|
||||
},
|
||||
});
|
||||
reportSyncPlayPause(api);
|
||||
// Leaving the player is not a request to pause the whole SyncPlay
|
||||
// group; the player pauses as it unmounts.
|
||||
if (!exitingPlayerRef.current) reportSyncPlayPause(api);
|
||||
}, [
|
||||
setCurrentTime,
|
||||
api,
|
||||
@@ -505,6 +517,7 @@ export function VideoPlayer() {
|
||||
]);
|
||||
|
||||
const handleExitPlayer = useCallback(async () => {
|
||||
exitingPlayerRef.current = true;
|
||||
appWindow.getCurrent().setFullscreen(false);
|
||||
|
||||
history.back();
|
||||
@@ -531,61 +544,64 @@ export function VideoPlayer() {
|
||||
clearQueue();
|
||||
}, []);
|
||||
|
||||
const handleKeyPress = useCallback((event: KeyboardEvent) => {
|
||||
const videoElement = getVideoElement();
|
||||
if (videoElement) {
|
||||
event.preventDefault();
|
||||
const currentTime = videoElement.currentTime ?? 0;
|
||||
const handleKeyPress = useCallback(
|
||||
(event: KeyboardEvent) => {
|
||||
const videoElement = getVideoElement();
|
||||
if (videoElement) {
|
||||
event.preventDefault();
|
||||
const currentTime = videoElement.currentTime ?? 0;
|
||||
|
||||
const seekTo = (time: number) => {
|
||||
startSeekRef.current = null;
|
||||
videoElement.currentTime = time;
|
||||
};
|
||||
const seekTo = (time: number) => {
|
||||
startSeekRef.current = null;
|
||||
videoElement.currentTime = time;
|
||||
};
|
||||
|
||||
switch (event.key) {
|
||||
case "ArrowRight":
|
||||
seekTo(currentTime + 10);
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
seekTo(currentTime - 10);
|
||||
break;
|
||||
case "F8":
|
||||
case " ":
|
||||
toggleIsPlaying();
|
||||
break;
|
||||
case "ArrowUp":
|
||||
// setVolume((state) => (state <= 0.9 ? state + 0.1 : state));
|
||||
break;
|
||||
case "ArrowDown":
|
||||
// setVolume((state) => (state >= 0.1 ? state - 0.1 : state));
|
||||
break;
|
||||
case "F":
|
||||
case "f":
|
||||
toggleIsPlayerFullscreen();
|
||||
break;
|
||||
case "P":
|
||||
case "p":
|
||||
// setIsPIP((state) => !state);
|
||||
break;
|
||||
case "M":
|
||||
case "m":
|
||||
toggleIsPlayerMuted();
|
||||
break;
|
||||
case "Z":
|
||||
case "z":
|
||||
cycleFitMode();
|
||||
break;
|
||||
case "F7":
|
||||
playItemFromQueue("previous", user?.Id, api);
|
||||
break;
|
||||
case "F9":
|
||||
playItemFromQueue("next", user?.Id, api);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (event.key) {
|
||||
case "ArrowRight":
|
||||
seekTo(currentTime + 10);
|
||||
break;
|
||||
case "ArrowLeft":
|
||||
seekTo(currentTime - 10);
|
||||
break;
|
||||
case "F8":
|
||||
case " ":
|
||||
toggleIsPlaying();
|
||||
break;
|
||||
case "ArrowUp":
|
||||
// setVolume((state) => (state <= 0.9 ? state + 0.1 : state));
|
||||
break;
|
||||
case "ArrowDown":
|
||||
// setVolume((state) => (state >= 0.1 ? state - 0.1 : state));
|
||||
break;
|
||||
case "F":
|
||||
case "f":
|
||||
toggleIsPlayerFullscreen();
|
||||
break;
|
||||
case "P":
|
||||
case "p":
|
||||
// setIsPIP((state) => !state);
|
||||
break;
|
||||
case "M":
|
||||
case "m":
|
||||
toggleIsPlayerMuted();
|
||||
break;
|
||||
case "Z":
|
||||
case "z":
|
||||
cycleFitMode();
|
||||
break;
|
||||
case "F7":
|
||||
playItemFromQueue("previous", user?.Id, api);
|
||||
break;
|
||||
case "F9":
|
||||
playItemFromQueue("next", user?.Id, api);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [cycleFitMode]);
|
||||
},
|
||||
[cycleFitMode],
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
// attach the event listener
|
||||
@@ -718,22 +734,35 @@ export function VideoPlayer() {
|
||||
|
||||
const handleOnBuffer = useCallback(() => {
|
||||
setIsBuffering(true);
|
||||
reportSyncPlayBuffering(
|
||||
// A few hundred milliseconds of network jitter should not pause the
|
||||
// whole group; only report a real stall.
|
||||
if (bufferReportTimer.current) clearTimeout(bufferReportTimer.current);
|
||||
bufferReportTimer.current = setTimeout(() => {
|
||||
bufferReportTimer.current = null;
|
||||
reportSyncPlayBuffering(
|
||||
api,
|
||||
true,
|
||||
secToTicks(getVideoElement()?.currentTime ?? 0),
|
||||
isPlayerPlaying,
|
||||
);
|
||||
}, 700);
|
||||
}, [setIsBuffering, api, isPlayerPlaying]);
|
||||
const handleOnBufferEnd = useCallback(() => {
|
||||
setIsBuffering(false);
|
||||
if (bufferReportTimer.current) {
|
||||
clearTimeout(bufferReportTimer.current);
|
||||
bufferReportTimer.current = null;
|
||||
}
|
||||
// A Buffer request always marks the session as buffering on the
|
||||
// server. When buffering ends the session is ready, not buffering:
|
||||
// sending another Buffer request here would leave the whole group
|
||||
// waiting for a client that is already playing.
|
||||
reportSyncPlayReady(
|
||||
api,
|
||||
true,
|
||||
secToTicks(getVideoElement()?.currentTime ?? 0),
|
||||
isPlayerPlaying,
|
||||
);
|
||||
}, [setIsBuffering, api, isPlayerPlaying]);
|
||||
const handleOnBufferEnd = useCallback(() => {
|
||||
setIsBuffering(false);
|
||||
reportSyncPlayBuffering(
|
||||
api,
|
||||
false,
|
||||
secToTicks(getVideoElement()?.currentTime ?? 0),
|
||||
true,
|
||||
);
|
||||
}, [setIsBuffering, api]);
|
||||
|
||||
const handleError = useCallback((e: any) => {
|
||||
console.error("Video playback error:", e);
|
||||
|
||||
+115
-74
@@ -14,8 +14,10 @@
|
||||
--remote-surface-hover: rgb(255 255 255 / 0.14);
|
||||
--remote-border: rgb(255 255 255 / 0.1);
|
||||
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
padding-top: var(--app-titlebar-height);
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
@@ -29,62 +31,6 @@
|
||||
sans-serif;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ top */
|
||||
|
||||
.remote-topbar {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
height: 58px;
|
||||
padding: 0 var(--remote-gutter);
|
||||
box-sizing: border-box;
|
||||
|
||||
html.is-macos & {
|
||||
padding-left: calc(var(--remote-gutter) + 64px);
|
||||
}
|
||||
|
||||
.MuiIconButton-root {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
color: rgb(255 255 255 / 0.88);
|
||||
background: rgb(255 255 255 / 0.08);
|
||||
border: 1px solid rgb(255 255 255 / 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
transition:
|
||||
background-color 0.18s ease,
|
||||
color 0.18s ease;
|
||||
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.16);
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
&-left,
|
||||
&-right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
&-divider {
|
||||
width: 1px;
|
||||
height: 26px;
|
||||
background: rgb(255 255 255 / 0.12);
|
||||
}
|
||||
}
|
||||
|
||||
html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.remote-chevron {
|
||||
opacity: 0.6;
|
||||
font-size: 1.15rem !important;
|
||||
@@ -109,6 +55,9 @@ html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
}
|
||||
|
||||
.remote-devices-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5em;
|
||||
margin: 0 0 0.5em 0.45em;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 500;
|
||||
@@ -117,14 +66,29 @@ html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
color: rgb(255 255 255 / 0.5);
|
||||
}
|
||||
|
||||
.remote-devices-count {
|
||||
display: inline-grid;
|
||||
place-items: center;
|
||||
min-width: 1.35rem;
|
||||
height: 1.35rem;
|
||||
padding: 0 0.3rem;
|
||||
border-radius: 999px;
|
||||
letter-spacing: 0;
|
||||
font-size: 0.66rem;
|
||||
color: #fff;
|
||||
background: rgb(255 255 255 / 0.1);
|
||||
border: 1px solid rgb(255 255 255 / 0.1);
|
||||
}
|
||||
|
||||
.remote-device-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25em;
|
||||
gap: 0.55em;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-y: auto;
|
||||
list-style: none;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgb(255 255 255 / 0.16) transparent;
|
||||
}
|
||||
|
||||
.remote-device {
|
||||
@@ -282,6 +246,95 @@ html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.remote-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.remote-action {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
height: 2.4rem;
|
||||
padding: 0 0.95rem;
|
||||
border: 1px solid rgb(255 255 255 / 0.12);
|
||||
border-radius: 999px;
|
||||
background: rgb(255 255 255 / 0.07);
|
||||
color: rgb(255 255 255 / 0.85);
|
||||
font: inherit;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
backdrop-filter: blur(14px);
|
||||
transition:
|
||||
background-color 160ms ease,
|
||||
border-color 160ms ease,
|
||||
color 160ms ease,
|
||||
opacity 160ms ease;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
&:hover:not(:disabled) {
|
||||
background: rgb(255 255 255 / 0.13);
|
||||
border-color: rgb(255 255 255 / 0.22);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
&.is-primary {
|
||||
border-color: transparent;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgb(255 79 154 / 0.92),
|
||||
rgb(166 107 255 / 0.92)
|
||||
);
|
||||
color: #fff;
|
||||
box-shadow: 0 8px 24px rgb(255 79 154 / 0.24);
|
||||
}
|
||||
}
|
||||
|
||||
.remote-group-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
height: 2.2rem;
|
||||
padding: 0 0.8rem;
|
||||
border-radius: 999px;
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
color: #c9f8dd;
|
||||
background: rgb(94 227 154 / 0.1);
|
||||
border: 1px solid rgb(94 227 154 / 0.2);
|
||||
}
|
||||
|
||||
.remote-group-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
background: #5ee39a;
|
||||
box-shadow: 0 0 10px #5ee39a;
|
||||
}
|
||||
|
||||
@media (max-width: 820px) {
|
||||
.remote-actions {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.remote-action {
|
||||
font-size: 0.74rem;
|
||||
padding: 0 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
.remote-overview {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 4;
|
||||
@@ -515,10 +568,6 @@ html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
/* ------------------------------------------------------------ adapt */
|
||||
|
||||
@media (max-height: 780px) {
|
||||
.remote-topbar {
|
||||
height: 52px;
|
||||
}
|
||||
|
||||
.remote-title {
|
||||
font-size: clamp(1.6rem, 2.6vw, 2.3rem);
|
||||
}
|
||||
@@ -578,15 +627,6 @@ html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.remote-topbar {
|
||||
height: calc(52px + var(--safe-top));
|
||||
padding: var(--safe-top) 16px 0;
|
||||
}
|
||||
|
||||
html.is-macos .remote-topbar {
|
||||
padding-left: 76px;
|
||||
}
|
||||
|
||||
.remote-body {
|
||||
flex: 0 0 auto;
|
||||
flex-direction: column;
|
||||
@@ -649,7 +689,8 @@ html.is-macos .remote-topbar-right .remote-topbar-divider {
|
||||
|
||||
.remote-transport {
|
||||
justify-content: center;
|
||||
gap: 0.55rem;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.45rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
|
||||
+378
-221
@@ -9,23 +9,43 @@ import Menu from "@mui/material/Menu";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
import Slider from "@mui/material/Slider";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import { useSnackbar } from "notistack";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import CachedImage from "@/components/cachedImage";
|
||||
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
||||
import WindowControls from "@/components/windowControls";
|
||||
import SessionCard from "@/components/remoteControl/sessionCard";
|
||||
import { getRuntimeCompact } from "@/utils/date/time";
|
||||
import {
|
||||
getBlinkDeviceName,
|
||||
useBlinkSessions,
|
||||
} from "@/utils/methods/blinkSessions";
|
||||
import { getCoverPalette } from "@/utils/methods/coverColor";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import {
|
||||
getLocalMediaTransfer,
|
||||
useCurrentMediaItem,
|
||||
} from "@/utils/methods/localTransfer";
|
||||
import { openSyncPlayDialog } from "@/utils/methods/syncPlay";
|
||||
import {
|
||||
playOnSession,
|
||||
queueStartingWith,
|
||||
transferSessionToLocal,
|
||||
} from "@/utils/methods/transferPlayback";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { stopPlayback } from "@/utils/store/audioPlayback";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import { usePlaybackStore } from "@/utils/store/playback";
|
||||
import { clearQueue } from "@/utils/store/queue";
|
||||
import useSyncPlayStore from "@/utils/store/syncPlay";
|
||||
|
||||
import "./remote.scss";
|
||||
|
||||
export const Route = createFileRoute("/_api/remote")({
|
||||
component: RemotePage,
|
||||
validateSearch: (search: Record<string, unknown>): { device?: string } => ({
|
||||
device: typeof search.device === "string" ? search.device : undefined,
|
||||
}),
|
||||
});
|
||||
|
||||
const TICKS_PER_SECOND = 10_000_000;
|
||||
@@ -40,11 +60,7 @@ const formatTime = (ticks: number | null | undefined) => {
|
||||
: `${m}:${String(s).padStart(2, "0")}`;
|
||||
};
|
||||
|
||||
const sessionLabel = (session: SessionInfoDto) =>
|
||||
session.DeviceName ||
|
||||
session.Client ||
|
||||
session.DeviceId ||
|
||||
"Неизвестное устройство";
|
||||
const sessionLabel = (session: SessionInfoDto) => getBlinkDeviceName(session);
|
||||
|
||||
const channelLabel = (channels?: number | null) => {
|
||||
if (!channels) return null;
|
||||
@@ -55,30 +71,33 @@ const channelLabel = (channels?: number | null) => {
|
||||
return `${channels} ch`;
|
||||
};
|
||||
|
||||
const sessionKind = (session: SessionInfoDto) => {
|
||||
const type = session.NowPlayingItem?.Type;
|
||||
if (type === "TvChannel") return "tv";
|
||||
if (type === "Audio" || type === "MusicAlbum") return "speaker";
|
||||
if (type) return "tv";
|
||||
return session.Client?.toLowerCase().includes("web") ? "computer" : "tv";
|
||||
};
|
||||
|
||||
function RemotePage() {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
const { device: requestedDevice } = Route.useSearch();
|
||||
const navigate = useNavigate();
|
||||
const toggleSearchDialog = useSearchStore((s) => s.toggleSearchDialog);
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const blink = useBlinkSessions();
|
||||
const group = useSyncPlayStore((state) => state.group);
|
||||
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null);
|
||||
const [selectedId, setSelectedId] = useState<string | null>(
|
||||
requestedDevice ?? null,
|
||||
);
|
||||
const [subtitleAnchor, setSubtitleAnchor] = useState<HTMLElement | null>(
|
||||
null,
|
||||
);
|
||||
const [audioAnchor, setAudioAnchor] = useState<HTMLElement | null>(null);
|
||||
const [subtitleIndex, setSubtitleIndex] = useState<number>(-1);
|
||||
const [audioIndex, setAudioIndex] = useState<number>(-1);
|
||||
const [volumeDraft, setVolumeDraft] = useState<number | null>(null);
|
||||
const [displayPosition, setDisplayPosition] = useState(0);
|
||||
const [isSeeking, setIsSeeking] = useState(false);
|
||||
const volumeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (requestedDevice) setSelectedId(requestedDevice);
|
||||
}, [requestedDevice]);
|
||||
|
||||
const clearVolumeTimer = () => {
|
||||
if (volumeTimerRef.current) {
|
||||
clearTimeout(volumeTimerRef.current);
|
||||
@@ -88,28 +107,7 @@ function RemotePage() {
|
||||
|
||||
useEffect(() => clearVolumeTimer, []);
|
||||
|
||||
const sessions = useQuery({
|
||||
queryKey: ["remoteSessions"],
|
||||
queryFn: async () => {
|
||||
if (!api || !user?.Id) return [];
|
||||
const result = await getSessionApi(api).getSessions();
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!api && !!user?.Id,
|
||||
refetchInterval: () => {
|
||||
if (document.visibilityState !== "visible") return false;
|
||||
return 2500;
|
||||
},
|
||||
refetchIntervalInBackground: false,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const remoteSessions = (sessions.data ?? []).filter(
|
||||
(session) =>
|
||||
session.Id &&
|
||||
session.DeviceId !== api?.deviceInfo.id &&
|
||||
session.UserId === user?.Id,
|
||||
);
|
||||
const remoteSessions = blink.sessions;
|
||||
|
||||
const playing = remoteSessions.find((session) => session.NowPlayingItem);
|
||||
const selected =
|
||||
@@ -120,6 +118,7 @@ function RemotePage() {
|
||||
useEffect(() => {
|
||||
setVolumeDraft(null);
|
||||
setSubtitleIndex(-1);
|
||||
setAudioIndex(-1);
|
||||
clearVolumeTimer();
|
||||
}, [selected?.Id]);
|
||||
|
||||
@@ -147,7 +146,7 @@ function RemotePage() {
|
||||
seekPositionTicks,
|
||||
controllingUserId: user?.Id,
|
||||
});
|
||||
await sessions.refetch();
|
||||
await blink.refetch();
|
||||
} catch (error) {
|
||||
console.error("Remote command failed", error);
|
||||
}
|
||||
@@ -168,12 +167,101 @@ function RemotePage() {
|
||||
ControllingUserId: user?.Id,
|
||||
},
|
||||
});
|
||||
await sessions.refetch();
|
||||
await blink.refetch();
|
||||
} catch (error) {
|
||||
console.error("Remote general command failed", error);
|
||||
enqueueSnackbar("Команда не выполнена", { variant: "error" });
|
||||
}
|
||||
};
|
||||
|
||||
const takeHere = useMutation({
|
||||
mutationFn: async (session: SessionInfoDto) => {
|
||||
if (!api || !user?.Id) return "none";
|
||||
return transferSessionToLocal(api, user.Id, session);
|
||||
},
|
||||
onSuccess: (kind, session) => {
|
||||
if (kind === "none") {
|
||||
enqueueSnackbar("На устройстве нечего забирать", { variant: "info" });
|
||||
return;
|
||||
}
|
||||
enqueueSnackbar(`Забрано с ${sessionLabel(session)}`, {
|
||||
variant: "success",
|
||||
});
|
||||
navigate({ to: kind === "audio" ? "/player/audio" : "/player" });
|
||||
},
|
||||
onError: () =>
|
||||
enqueueSnackbar("Не удалось забрать воспроизведение", {
|
||||
variant: "error",
|
||||
}),
|
||||
});
|
||||
|
||||
const sendLocalHere = useMutation({
|
||||
mutationFn: async (session: SessionInfoDto) => {
|
||||
if (!api || !user?.Id || !session.Id) {
|
||||
throw new Error("Нет устройства или сессии");
|
||||
}
|
||||
const transfer = getLocalMediaTransfer();
|
||||
if (!transfer?.item?.Id) {
|
||||
throw new Error("На этом устройстве ничего не играет");
|
||||
}
|
||||
const queueIds = queueStartingWith(
|
||||
transfer.queue ?? [],
|
||||
transfer.item.Id,
|
||||
);
|
||||
await playOnSession(api, user.Id, session.Id, {
|
||||
itemIds: queueIds.length > 0 ? queueIds : [transfer.item.Id],
|
||||
startIndex: 0,
|
||||
startPositionTicks: transfer.positionTicks ?? 0,
|
||||
mediaSourceId: transfer.item.MediaSources?.[0]?.Id ?? undefined,
|
||||
});
|
||||
if (transfer.kind === "audio") {
|
||||
stopPlayback();
|
||||
} else if (transfer.kind === "video") {
|
||||
const playback = usePlaybackStore.getState();
|
||||
const stoppedItemId = playback.metadata.item?.Id;
|
||||
const stoppedPosition = playback.playerState.currentTime;
|
||||
const mediaSourceId = playback.mediaSource.id;
|
||||
const playSessionId = playback.playsessionId;
|
||||
(
|
||||
document
|
||||
.querySelector("hls-video")
|
||||
?.shadowRoot?.querySelector("video") as HTMLVideoElement | null
|
||||
)?.pause();
|
||||
usePlaybackStore.setState(usePlaybackStore.getInitialState());
|
||||
clearQueue();
|
||||
if (stoppedItemId) {
|
||||
await getSessionApi(api)
|
||||
.reportPlaybackStopped({
|
||||
playbackStopInfo: {
|
||||
Failed: false,
|
||||
ItemId: stoppedItemId,
|
||||
MediaSourceId: mediaSourceId,
|
||||
PlaySessionId: playSessionId,
|
||||
PositionTicks: stoppedPosition,
|
||||
},
|
||||
})
|
||||
.catch((error) =>
|
||||
console.warn("Could not report local playback stopped", error),
|
||||
);
|
||||
}
|
||||
}
|
||||
return transfer.item.Name ?? "медиа";
|
||||
},
|
||||
onSuccess: (name, session) => {
|
||||
enqueueSnackbar(`${name} передано на ${sessionLabel(session)}`, {
|
||||
variant: "success",
|
||||
});
|
||||
},
|
||||
onError: (error) =>
|
||||
enqueueSnackbar(
|
||||
error instanceof Error ? error.message : "Не удалось передать медиа",
|
||||
{ variant: "error" },
|
||||
),
|
||||
});
|
||||
|
||||
const localMediaItem = useCurrentMediaItem();
|
||||
const canSendLocal = Boolean(localMediaItem);
|
||||
|
||||
const nowPlaying = selected?.NowPlayingItem;
|
||||
const playState = selected?.PlayState;
|
||||
const isPaused = playState?.IsPaused ?? true;
|
||||
@@ -242,9 +330,16 @@ function RemotePage() {
|
||||
const audioStream = nowPlaying?.MediaStreams?.find(
|
||||
(stream) => stream.Type === "Audio",
|
||||
);
|
||||
const audioStreams =
|
||||
nowPlaying?.MediaStreams?.filter((stream) => stream.Type === "Audio") ?? [];
|
||||
const subtitleStreams =
|
||||
nowPlaying?.MediaStreams?.filter((stream) => stream.Type === "Subtitle") ??
|
||||
[];
|
||||
const audioLabel =
|
||||
audioIndex < 0
|
||||
? (audioStreams.find((s) => s.IsDefault)?.DisplayTitle ?? "Авто")
|
||||
: (audioStreams.find((s) => s.Index === audioIndex)?.DisplayTitle ??
|
||||
`Дорожка ${audioIndex}`);
|
||||
|
||||
const chips = [
|
||||
nowPlaying?.OfficialRating,
|
||||
@@ -279,6 +374,15 @@ function RemotePage() {
|
||||
});
|
||||
};
|
||||
|
||||
const chooseAudio = (index: number) => {
|
||||
if (!selected) return;
|
||||
setAudioIndex(index);
|
||||
setAudioAnchor(null);
|
||||
void general(selected, GeneralCommandType.SetAudioStreamIndex, {
|
||||
Index: String(index),
|
||||
});
|
||||
};
|
||||
|
||||
const transport = (name: PlaystateCommand) => {
|
||||
if (!selected) return;
|
||||
void command(selected, name);
|
||||
@@ -294,198 +398,212 @@ function RemotePage() {
|
||||
} as React.CSSProperties
|
||||
}
|
||||
>
|
||||
<header className="remote-topbar" data-tauri-drag-region>
|
||||
<div className="remote-topbar-left">
|
||||
<IconButton
|
||||
aria-label="Главная"
|
||||
title="Главная"
|
||||
onClick={() => navigate({ to: "/home" })}
|
||||
>
|
||||
<span className="material-symbols-rounded">home</span>
|
||||
</IconButton>
|
||||
{blink.isLoading ? (
|
||||
<div className="remote-empty">
|
||||
<span className="material-symbols-rounded animate-rotate">
|
||||
progress_activity
|
||||
</span>
|
||||
<h1>Ищем Blink-устройства</h1>
|
||||
<p>Подключаемся к серверу и собираем список клиентов Blink.</p>
|
||||
</div>
|
||||
|
||||
<div className="remote-topbar-right">
|
||||
<IconButton
|
||||
aria-label="Поиск"
|
||||
title="Поиск"
|
||||
onClick={toggleSearchDialog}
|
||||
>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
<IconButton
|
||||
aria-label="Настройки"
|
||||
title="Настройки"
|
||||
onClick={() => navigate({ to: "/settings/preferences" })}
|
||||
>
|
||||
<span className="material-symbols-rounded">settings</span>
|
||||
</IconButton>
|
||||
<span className="remote-topbar-divider" />
|
||||
<WindowControls />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{!selected ? (
|
||||
) : !selected ? (
|
||||
<div className="remote-empty">
|
||||
<span className="material-symbols-rounded">settings_remote</span>
|
||||
<h1>Нет доступных устройств</h1>
|
||||
<h1>Нет Blink-устройств</h1>
|
||||
<p>
|
||||
Откройте клиент Jellyfin (телевизор, браузер, телефон) под этой
|
||||
учётной записью, и он появится здесь.
|
||||
Запустите Blink на другом устройстве под этой учётной записью. В
|
||||
пульте показываются только клиенты Blink — Jellyfin Web, телевизоры
|
||||
и другие приложения не попадают в этот список.
|
||||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="remote-body">
|
||||
<aside className="remote-devices" aria-label="Устройства">
|
||||
<div className="remote-devices-title">Устройства</div>
|
||||
<ul className="remote-device-list">
|
||||
{remoteSessions.map((session) => {
|
||||
const isActive = session.Id === selected?.Id;
|
||||
const sessionItem = session.NowPlayingItem;
|
||||
return (
|
||||
<li key={session.Id}>
|
||||
<button
|
||||
type="button"
|
||||
className={`remote-device${isActive ? " is-active" : ""}`}
|
||||
onClick={() => setSelectedId(session.Id ?? null)}
|
||||
>
|
||||
<span className="material-symbols-rounded remote-device-icon">
|
||||
{sessionKind(session)}
|
||||
</span>
|
||||
<span className="remote-device-info">
|
||||
<span className="remote-device-name">
|
||||
{sessionLabel(session)}
|
||||
</span>
|
||||
<span className="remote-device-meta">
|
||||
{sessionItem?.Name
|
||||
? session.PlayState?.IsPaused
|
||||
? `Пауза · ${sessionItem.Name}`
|
||||
: `Играет · ${sessionItem.Name}`
|
||||
: "Свободно"}
|
||||
</span>
|
||||
</span>
|
||||
{sessionItem && (
|
||||
<span
|
||||
className={`remote-device-dot${
|
||||
session.PlayState?.IsPaused ? " is-paused" : ""
|
||||
}`}
|
||||
/>
|
||||
)}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
<aside className="remote-devices" aria-label="Blink-устройства">
|
||||
<div className="remote-devices-title">
|
||||
Устройства Blink
|
||||
<span className="remote-devices-count">
|
||||
{remoteSessions.length}
|
||||
</span>
|
||||
</div>
|
||||
<div className="remote-device-list">
|
||||
{remoteSessions.map((session) => (
|
||||
<SessionCard
|
||||
key={session.Id}
|
||||
session={session}
|
||||
api={api}
|
||||
compact
|
||||
selected={session.Id === selected?.Id}
|
||||
onSelect={(target) => setSelectedId(target.Id ?? null)}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<main className="remote-hero">
|
||||
<div className="remote-poster">
|
||||
<div className="remote-poster-frame">
|
||||
{coverUrl ? (
|
||||
<CachedImage src={coverUrl} alt={title ?? "Постер"} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">live_tv</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section className="remote-details">
|
||||
<h1 className="remote-title">
|
||||
{title ?? sessionLabel(selected)}
|
||||
</h1>
|
||||
{subtitle && <h2 className="remote-subtitle">{subtitle}</h2>}
|
||||
|
||||
{chips.length > 0 && (
|
||||
<div className="remote-chips">
|
||||
{chips.map((chip) => (
|
||||
<span key={chip} className="remote-chip">
|
||||
{chip}
|
||||
</span>
|
||||
))}
|
||||
<div className="remote-poster">
|
||||
<div className="remote-poster-frame">
|
||||
{coverUrl ? (
|
||||
<CachedImage src={coverUrl} alt={title ?? "Постер"} />
|
||||
) : (
|
||||
<span className="material-symbols-rounded">live_tv</span>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{nowPlaying?.Overview && (
|
||||
<p className="remote-overview">{nowPlaying.Overview}</p>
|
||||
)}
|
||||
{!nowPlaying && (
|
||||
<p className="remote-overview">
|
||||
Устройство свободно. Запустите воспроизведение на нём, и
|
||||
здесь появятся название, постер и управление.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="remote-transport">
|
||||
<Tooltip title="Назад">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.Rewind)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Назад"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
fast_rewind
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Предыдущий">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() =>
|
||||
transport(PlaystateCommand.PreviousTrack)
|
||||
}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Предыдущий"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
skip_previous
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round remote-round-primary"
|
||||
onClick={() => transport(PlaystateCommand.PlayPause)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label={isPaused ? "Играть" : "Пауза"}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{isPaused ? "play_arrow" : "pause"}
|
||||
</span>
|
||||
</button>
|
||||
<Tooltip title="Следующий">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.NextTrack)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Следующий"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
skip_next
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Вперёд">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.FastForward)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Вперёд"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
fast_forward
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
<section className="remote-details">
|
||||
<h1 className="remote-title">
|
||||
{title ?? sessionLabel(selected)}
|
||||
</h1>
|
||||
{subtitle && <h2 className="remote-subtitle">{subtitle}</h2>}
|
||||
|
||||
{chips.length > 0 && (
|
||||
<div className="remote-chips">
|
||||
{chips.map((chip) => (
|
||||
<span key={chip} className="remote-chip">
|
||||
{chip}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="remote-actions">
|
||||
{nowPlaying && (
|
||||
<button
|
||||
type="button"
|
||||
className="remote-action is-primary"
|
||||
disabled={takeHere.isPending}
|
||||
onClick={() => takeHere.mutate(selected)}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{takeHere.isPending ? "progress_activity" : "download"}
|
||||
</span>
|
||||
{takeHere.isPending ? "Забираем…" : "Забрать сюда"}
|
||||
</button>
|
||||
)}
|
||||
{canSendLocal && localMediaItem && (
|
||||
<button
|
||||
type="button"
|
||||
className="remote-action"
|
||||
disabled={sendLocalHere.isPending}
|
||||
onClick={() => sendLocalHere.mutate(selected)}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{sendLocalHere.isPending ? "progress_activity" : "send"}
|
||||
</span>
|
||||
{sendLocalHere.isPending
|
||||
? "Отправляем…"
|
||||
: `Отправить «${localMediaItem.Name ?? "медиа"}»`}
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="remote-action"
|
||||
onClick={openSyncPlayDialog}
|
||||
>
|
||||
<span className="material-symbols-rounded">groups</span>
|
||||
{group ? "Группа" : "Смотреть вместе"}
|
||||
</button>
|
||||
{group && (
|
||||
<span className="remote-group-chip">
|
||||
<span className="remote-group-dot" />
|
||||
{group.GroupName?.replace("Blink ·", "").trim() ||
|
||||
"В группе"}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{nowPlaying?.Overview && (
|
||||
<p className="remote-overview">{nowPlaying.Overview}</p>
|
||||
)}
|
||||
{!nowPlaying && (
|
||||
<p className="remote-overview">
|
||||
Устройство свободно. Запустите воспроизведение на нём, и
|
||||
здесь появятся название, постер и управление.
|
||||
</p>
|
||||
)}
|
||||
|
||||
<div className="remote-transport">
|
||||
<Tooltip title="Назад">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.Rewind)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Назад"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
fast_rewind
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Предыдущий">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.PreviousTrack)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Предыдущий"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
skip_previous
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round remote-round-primary"
|
||||
onClick={() => transport(PlaystateCommand.PlayPause)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label={isPaused ? "Играть" : "Пауза"}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{isPaused ? "play_arrow" : "pause"}
|
||||
</span>
|
||||
</button>
|
||||
<Tooltip title="Следующий">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.NextTrack)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Следующий"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
skip_next
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Вперёд">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => transport(PlaystateCommand.FastForward)}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Вперёд"
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
fast_forward
|
||||
</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
<Tooltip title="Остановить">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-round"
|
||||
onClick={() => {
|
||||
if (!selected) return;
|
||||
void command(selected, PlaystateCommand.Stop);
|
||||
}}
|
||||
disabled={!nowPlaying}
|
||||
aria-label="Остановить"
|
||||
>
|
||||
<span className="material-symbols-rounded">stop</span>
|
||||
</button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<div className="remote-timeline">
|
||||
@@ -519,6 +637,19 @@ function RemotePage() {
|
||||
</div>
|
||||
|
||||
<footer className="remote-bottombar">
|
||||
<button
|
||||
type="button"
|
||||
className="remote-bottom-item"
|
||||
onClick={(event) => setAudioAnchor(event.currentTarget)}
|
||||
disabled={!nowPlaying || audioStreams.length === 0}
|
||||
>
|
||||
<span className="material-symbols-rounded">audiotrack</span>
|
||||
<span>Аудио: {audioLabel}</span>
|
||||
<span className="material-symbols-rounded remote-chevron">
|
||||
expand_more
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="remote-bottom-item"
|
||||
@@ -582,10 +713,36 @@ function RemotePage() {
|
||||
</button>
|
||||
</footer>
|
||||
|
||||
<Menu
|
||||
anchorEl={audioAnchor}
|
||||
open={Boolean(audioAnchor)}
|
||||
onClose={() => setAudioAnchor(null)}
|
||||
slotProps={{ paper: { className: "glass-menu-paper" } }}
|
||||
>
|
||||
<MenuItem
|
||||
selected={audioIndex === -1}
|
||||
onClick={() => chooseAudio(-1)}
|
||||
>
|
||||
Авто
|
||||
</MenuItem>
|
||||
{audioStreams.map((stream) => (
|
||||
<MenuItem
|
||||
key={stream.Index}
|
||||
selected={audioIndex === stream.Index}
|
||||
onClick={() => chooseAudio(stream.Index ?? -1)}
|
||||
>
|
||||
{stream.DisplayTitle ??
|
||||
stream.Language ??
|
||||
`Дорожка ${stream.Index}`}
|
||||
</MenuItem>
|
||||
))}
|
||||
</Menu>
|
||||
|
||||
<Menu
|
||||
anchorEl={subtitleAnchor}
|
||||
open={Boolean(subtitleAnchor)}
|
||||
onClose={() => setSubtitleAnchor(null)}
|
||||
slotProps={{ paper: { className: "glass-menu-paper" } }}
|
||||
>
|
||||
<MenuItem
|
||||
selected={subtitleIndex === -1}
|
||||
|
||||
+130
-207
@@ -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
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,52 @@
|
||||
@use "../../styles/variables.scss" as *;
|
||||
|
||||
.settings-device-name {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.8rem;
|
||||
margin-bottom: 1.4rem;
|
||||
padding: 1rem;
|
||||
border-radius: 18px;
|
||||
background:
|
||||
linear-gradient(135deg, rgb(255 255 255 / 0.08), rgb(255 255 255 / 0.02)),
|
||||
rgb(17 15 32 / 0.42);
|
||||
border: 1px solid rgb(255 255 255 / 0.09);
|
||||
box-shadow:
|
||||
0 14px 34px rgb(0 0 0 / 0.2),
|
||||
inset 0 1px 0 rgb(255 255 255 / 0.06);
|
||||
backdrop-filter: blur(20px) saturate(150%);
|
||||
|
||||
&-hint {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
&-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 0.7rem;
|
||||
|
||||
.MuiTextField-root {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.MuiButton-root {
|
||||
flex: 0 0 auto;
|
||||
height: 40px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.settings {
|
||||
&-page {
|
||||
&-container {
|
||||
display: grid;
|
||||
grid-template-columns: 16em 1fr;
|
||||
padding: 0;
|
||||
padding: var(--app-titlebar-height) 0 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
|
||||
// Frameless window on Windows/Linux: the floating window buttons
|
||||
// sit in the top 44px, so the settings grid starts below that strip.
|
||||
html.is-windows &,
|
||||
html.is-linux & {
|
||||
padding-top: 44px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
box-sizing: border-box;
|
||||
}
|
||||
&-scrollY {
|
||||
padding: 2em;
|
||||
@@ -89,27 +120,6 @@
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
html.is-macos & {
|
||||
// Overlay titlebar: leave room for the traffic lights.
|
||||
padding-top: 2.9em;
|
||||
}
|
||||
|
||||
&-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 0.5em; // Reduced
|
||||
|
||||
// Adjust back button for this context
|
||||
.MuiIconButton-root {
|
||||
color: rgba(255,255,255,0.7);
|
||||
&:hover {
|
||||
color: white;
|
||||
background: rgba(255,255,255,0.05);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -198,10 +208,21 @@
|
||||
}
|
||||
}
|
||||
@media (max-width: 700px) {
|
||||
.settings-device-name-row {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
|
||||
.MuiButton-root {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-page-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100vh;
|
||||
padding-top: var(--app-titlebar-height);
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -211,28 +232,18 @@
|
||||
align-items: center;
|
||||
gap: 0.25em;
|
||||
width: 100%;
|
||||
padding: calc(0.4rem + var(--safe-top)) 0.6rem 0.4rem;
|
||||
padding: 0.4rem 0.6rem;
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.06);
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
box-sizing: border-box;
|
||||
|
||||
html.is-macos & {
|
||||
padding-top: calc(0.4rem + var(--safe-top));
|
||||
padding-left: 76px;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-sidebar-header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.settings-sidebar-controls {
|
||||
padding-bottom: 0;
|
||||
gap: 0.15em;
|
||||
}
|
||||
|
||||
.settings-sidebar-list {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
@@ -317,15 +328,6 @@
|
||||
padding-right: 2em !important;
|
||||
}
|
||||
|
||||
.settings-sidebar-controls {
|
||||
display: flex;
|
||||
flex: 0 0 auto;
|
||||
|
||||
[aria-label="Главная"] {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.settings-page-scrollY {
|
||||
padding: 0.75rem 1rem calc(7.5rem + var(--safe-bottom)) !important;
|
||||
}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import {
|
||||
createFileRoute,
|
||||
Outlet,
|
||||
useLocation,
|
||||
useNavigate,
|
||||
} from "@tanstack/react-router";
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import { createFileRoute, Outlet, useLocation } from "@tanstack/react-router";
|
||||
import React, { useEffect } from "react";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import "./settings.scss";
|
||||
import { IconButton, List, Typography } from "@mui/material";
|
||||
import { List, Typography } from "@mui/material";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import BackButton from "@/components/buttons/backButton";
|
||||
import ListItemLink from "@/components/listItemLink";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
@@ -26,11 +20,7 @@ function SettingsRoute() {
|
||||
useEffect(() => {
|
||||
setBackdrop("");
|
||||
});
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const handleNavigateHome = useCallback(() => {
|
||||
navigate({ to: "/home" });
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const active = document.querySelector(
|
||||
@@ -39,23 +29,8 @@ function SettingsRoute() {
|
||||
active?.scrollIntoView({ block: "nearest", inline: "center" });
|
||||
}, [location.pathname]);
|
||||
return (
|
||||
<div className="settings-page-container" data-tauri-drag-region>
|
||||
<div className="settings-page-container">
|
||||
<div className="settings-sidebar">
|
||||
<div className="settings-sidebar-controls">
|
||||
<BackButton />
|
||||
<IconButton
|
||||
onClick={handleNavigateHome}
|
||||
aria-label="Главная"
|
||||
title="Главная"
|
||||
sx={{
|
||||
background: "rgba(255, 255, 255, 0.05)",
|
||||
"&:hover": { background: "rgba(255, 255, 255, 0.1)" },
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">home</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
<div className="settings-sidebar-header">
|
||||
<img
|
||||
className="settings-sidebar-header-image"
|
||||
|
||||
@@ -8,6 +8,12 @@ import {
|
||||
} from "@mui/material";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
import {
|
||||
getDefaultDeviceName,
|
||||
getDeviceDisplayName,
|
||||
getOrCreateDeviceId,
|
||||
setDeviceDisplayName,
|
||||
} from "@/utils/deviceIdentity";
|
||||
|
||||
import "../settings.scss";
|
||||
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
|
||||
@@ -38,6 +44,19 @@ function RouteComponent() {
|
||||
});
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
const deviceId = getOrCreateDeviceId();
|
||||
const defaultDeviceName = getDefaultDeviceName(deviceId);
|
||||
const [deviceName, setDeviceName] = React.useState(() =>
|
||||
getDeviceDisplayName(deviceId),
|
||||
);
|
||||
const saveDeviceName = () => {
|
||||
const next = setDeviceDisplayName(deviceName);
|
||||
setDeviceName(next);
|
||||
enqueueSnackbar(
|
||||
"Имя устройства сохранено. Перезапустите Blink, чтобы оно обновилось на сервере.",
|
||||
{ variant: "success" },
|
||||
);
|
||||
};
|
||||
|
||||
const form = useForm({
|
||||
defaultValues: {
|
||||
@@ -81,6 +100,27 @@ function RouteComponent() {
|
||||
return (
|
||||
<div className="settings-page-scrollY">
|
||||
<Typography variant="h4">Настройки</Typography>
|
||||
<div className="settings-device-name">
|
||||
<div>
|
||||
<Typography variant="h6">Это устройство</Typography>
|
||||
<Typography variant="body2" className="settings-device-name-hint">
|
||||
Имя видно другим клиентам Blink в пульте и SyncPlay.
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-device-name-row">
|
||||
<TextField
|
||||
size="small"
|
||||
fullWidth
|
||||
label="Имя устройства"
|
||||
value={deviceName}
|
||||
onChange={(event) => setDeviceName(event.target.value)}
|
||||
helperText={`По умолчанию: ${defaultDeviceName}`}
|
||||
/>
|
||||
<Button variant="outlined" onClick={saveDeviceName}>
|
||||
Сохранить имя
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/* <form.Pro */}
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
@@ -89,7 +129,9 @@ function RouteComponent() {
|
||||
form.handleSubmit();
|
||||
}}
|
||||
onError={() =>
|
||||
enqueueSnackbar("Не удалось сохранить настройки", { variant: "error" })
|
||||
enqueueSnackbar("Не удалось сохранить настройки", {
|
||||
variant: "error",
|
||||
})
|
||||
}
|
||||
className="settings-form"
|
||||
>
|
||||
@@ -171,14 +213,15 @@ function RouteComponent() {
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
Воспроизводить аудиодорожку по умолчанию независимо от языка
|
||||
Воспроизводить аудиодорожку по умолчанию независимо от
|
||||
языка
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
className="settings-option-info-caption"
|
||||
>
|
||||
Воспроизводить аудиодорожку по умолчанию, даже если она
|
||||
не совпадает с предпочитаемым языком.
|
||||
Воспроизводить аудиодорожку по умолчанию, даже если она не
|
||||
совпадает с предпочитаемым языком.
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user