feat: add new adv. search page
This commit is contained in:
12 files changed
+886
-1211
No files matched your search
@@ -35,6 +35,7 @@ const HIDDEN_PATHS = [
|
||||
"/error",
|
||||
"/settings",
|
||||
"/library",
|
||||
"/search",
|
||||
];
|
||||
|
||||
export const AppBar = () => {
|
||||
|
||||
@@ -170,7 +170,7 @@ export const FiltersDialog: React.FC<FiltersDialogProps> = React.memo(
|
||||
fullWidth
|
||||
maxWidth="sm"
|
||||
keepMounted
|
||||
PaperProps={{ className: "glass", sx: { borderRadius: "24px" } }}
|
||||
PaperProps={{ className: "glass-dialog-paper" }}
|
||||
>
|
||||
<DialogTitle>Filters</DialogTitle>
|
||||
<DialogContent
|
||||
|
||||
@@ -20,6 +20,7 @@ import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||
// import removed: header reads name/count from Zustand slice
|
||||
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||
import "./libraryHeader.scss";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import BackButton from "../buttons/backButton";
|
||||
import { FiltersDialogTrigger } from "../filtersDialog";
|
||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||
@@ -231,9 +232,8 @@ export const LibraryHeader = () => {
|
||||
const libraryName = libraryNameFromStore ?? currentLibrary.data.Name;
|
||||
const totalCount = itemsTotalCount;
|
||||
|
||||
const handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
const toggleSearchDialog = useSearchStore(
|
||||
useShallow((s) => s.toggleSearchDialog),
|
||||
);
|
||||
const handleNavigateToHome = useCallback(
|
||||
() => navigate({ to: "/home" }),
|
||||
@@ -292,7 +292,19 @@ export const LibraryHeader = () => {
|
||||
size="small"
|
||||
value={String(normalizedViewType)}
|
||||
onChange={handleChangeViewType}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
PaperProps: {
|
||||
className: "glass-menu-paper",
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
<MenuItem disabled value="">
|
||||
<Typography variant="overline" color="textSecondary">
|
||||
View
|
||||
</Typography>
|
||||
</MenuItem>
|
||||
{compatibleViews.map((v) => (
|
||||
<MenuItem key={String(v.value)} value={String(v.value)}>
|
||||
{v.title}
|
||||
@@ -318,7 +330,19 @@ export const LibraryHeader = () => {
|
||||
value={normalizedSortBy}
|
||||
onChange={handleChangeSortBy}
|
||||
disabled={disableSortOption}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
PaperProps: {
|
||||
className: "glass-menu-paper",
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
<MenuItem disabled value="">
|
||||
<Typography variant="overline" color="textSecondary">
|
||||
Sort By
|
||||
</Typography>
|
||||
</MenuItem>
|
||||
{SORT_BY_OPTIONS.map((option) => {
|
||||
const isCompatible =
|
||||
option.compatibleViewTypes?.includes(currentViewType as any) ||
|
||||
@@ -349,7 +373,7 @@ export const LibraryHeader = () => {
|
||||
<FiltersDialogTrigger />
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleNavigateToSearch}>
|
||||
<IconButton onClick={toggleSearchDialog}>
|
||||
<div className="material-symbols-rounded">search</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
|
||||
@@ -1,34 +1,62 @@
|
||||
.library-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
inset: 1em 1em auto 1em !important;
|
||||
border-radius: 9999px;
|
||||
margin: 0 auto;
|
||||
width: fit-content;
|
||||
position: sticky;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
inset: 1em 2em auto 2em !important;
|
||||
border-radius: 9999px;
|
||||
margin: 0 auto;
|
||||
width: fit-content;
|
||||
position: sticky;
|
||||
width: calc(100vw - 4em) !important;
|
||||
z-index: 10;
|
||||
z-index: 10;
|
||||
padding: 0.25em !important;
|
||||
transition: all 0.2s ease-in-out;
|
||||
|
||||
transition: all 0.2s ease-in-out;
|
||||
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
backdrop-filter: blur(40px);
|
||||
inset: -0.35em;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
|
||||
background: rgb(0 0 0 / 0.4);
|
||||
opacity: 0;
|
||||
z-index: -1;
|
||||
transition: opacity $transition-time-fast;
|
||||
}
|
||||
|
||||
&.scrolling {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: -0.35em;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
// Glass styling matching Search Dialog
|
||||
background-color: rgba(20, 20, 30, 0.7);
|
||||
backdrop-filter: blur(24px) saturate(180%);
|
||||
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
||||
opacity: 0;
|
||||
z-index: -1;
|
||||
transition: all 150ms;
|
||||
}
|
||||
&.scrolling {
|
||||
&::after {
|
||||
opacity: 1;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Glass styling for Menus and Dialogs
|
||||
.glass-menu-paper, .glass-dialog-paper {
|
||||
background-color: rgba(20, 20, 30, 0.7) !important;
|
||||
backdrop-filter: blur(24px) saturate(180%) !important;
|
||||
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0)) !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08) !important;
|
||||
box-shadow: 0 20px 50px rgba(0,0,0,0.5) !important;
|
||||
border-radius: 16px !important;
|
||||
}
|
||||
|
||||
// Ensure the menu items themselves look good on the glass background
|
||||
.glass-menu-paper {
|
||||
.MuiMenuItem-root {
|
||||
font-family: inherit;
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
&.Mui-selected {
|
||||
background-color: rgba(255, 255, 255, 0.15);
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,616 +0,0 @@
|
||||
import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api";
|
||||
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
|
||||
import { getSystemApi } from "@jellyfin/sdk/lib/utils/api/system-api";
|
||||
import {
|
||||
Button,
|
||||
Chip,
|
||||
Dialog,
|
||||
DialogActions,
|
||||
DialogContent,
|
||||
DialogTitle,
|
||||
Fab,
|
||||
IconButton,
|
||||
Link,
|
||||
Skeleton,
|
||||
Tab,
|
||||
Tabs,
|
||||
TextField,
|
||||
Typography,
|
||||
} from "@mui/material";
|
||||
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, { useCallback, useMemo, useState } from "react";
|
||||
import logo from "@/assets/logo.png";
|
||||
import { jellyfin, useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useSettingsStore, {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "@/utils/store/settings";
|
||||
import "./settings.scss";
|
||||
|
||||
import type { RecommendedServerInfo } from "@jellyfin/sdk";
|
||||
import { LoadingButton } from "@mui/lab";
|
||||
import { red } from "@mui/material/colors";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { relaunch } from "@tauri-apps/plugin-process";
|
||||
import { check } from "@tauri-apps/plugin-updater";
|
||||
import { useSnackbar } from "notistack";
|
||||
import {
|
||||
delServer,
|
||||
getAllServers,
|
||||
getDefaultServer,
|
||||
setDefaultServer,
|
||||
setServer,
|
||||
} from "@/utils/storage/servers";
|
||||
import { allSettings } from "@/utils/storage/settings";
|
||||
import { delUser } from "@/utils/storage/user";
|
||||
import AddServerDialog from "../addServerDialog";
|
||||
import SettingOption from "../settingOption";
|
||||
import SettingOptionSelect from "../settingOptionSelect";
|
||||
|
||||
const motionConfig = {
|
||||
initial: {
|
||||
opacity: 0,
|
||||
},
|
||||
visible: {
|
||||
opacity: 1,
|
||||
},
|
||||
};
|
||||
|
||||
const Settings = () => {
|
||||
const [open, tabValue] = useSettingsStore((state) => [
|
||||
state.dialogOpen,
|
||||
state.tabValue,
|
||||
]);
|
||||
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const createApi = useApiInContext((s) => s.createApi);
|
||||
|
||||
const user = useCentralStore((state) => state.currentUser);
|
||||
|
||||
const systemInfo = useQuery({
|
||||
queryKey: ["about", "systemInfo"],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getSystemApi(api).getSystemInfo();
|
||||
return result.data;
|
||||
},
|
||||
enabled: Boolean(api) && open,
|
||||
});
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { enqueueSnackbar } = useSnackbar();
|
||||
|
||||
const [applicationVersion] = useCentralStore((state) => [
|
||||
state.clientVersion,
|
||||
]);
|
||||
|
||||
const serversOnDisk = useQuery({
|
||||
queryKey: ["settings", "serversOnDisk"],
|
||||
queryFn: async () => await getAllServers(),
|
||||
enabled: open,
|
||||
});
|
||||
|
||||
const updateInfo = useQuery({
|
||||
queryKey: ["about", "updater"],
|
||||
queryFn: async () => await check(),
|
||||
enabled: open,
|
||||
});
|
||||
|
||||
const defaultServer = useQuery({
|
||||
queryKey: ["settings", "default-server"],
|
||||
queryFn: async () => await getDefaultServer(),
|
||||
enabled: open,
|
||||
});
|
||||
|
||||
const cultures = useQuery({
|
||||
queryKey: ["settings", "cultures"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const result = await getLocalizationApi(api).getCultures();
|
||||
return result.data;
|
||||
},
|
||||
enabled: open,
|
||||
});
|
||||
|
||||
const _clientSettingsOnServer = useQuery({
|
||||
queryKey: ["settings", "clientSettings"],
|
||||
queryFn: async () => {
|
||||
if (!api) return;
|
||||
const result = await getDisplayPreferencesApi(api).getDisplayPreferences({
|
||||
client: "blink",
|
||||
userId: user?.Id,
|
||||
displayPreferencesId: api.deviceInfo.id,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: open,
|
||||
});
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
// Server Management
|
||||
const [updating, setUpdating] = useState(false);
|
||||
const [addServerDialog, setAddServerDialog] = useState(false);
|
||||
|
||||
const handleServerChange = useMutation({
|
||||
mutationFn: async (server: RecommendedServerInfo) => {
|
||||
await delUser();
|
||||
await setDefaultServer(server.systemInfo?.Id ?? "");
|
||||
await defaultServer.refetch();
|
||||
createApi(server.address, undefined);
|
||||
queryClient.removeQueries();
|
||||
},
|
||||
onSuccess: async () => {
|
||||
setSettingsDialogOpen(false);
|
||||
navigate({ to: "/login" });
|
||||
},
|
||||
onError: (error) => {
|
||||
console.error(error);
|
||||
enqueueSnackbar("Error changing the server", {
|
||||
variant: "error",
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
const handleDelete = useMutation({
|
||||
mutationKey: ["server-delete"],
|
||||
mutationFn: async (server: RecommendedServerInfo) => {
|
||||
await delServer(server.systemInfo?.Id ?? "");
|
||||
|
||||
if (server.systemInfo?.Id === defaultServer.data) {
|
||||
await delUser();
|
||||
await serversOnDisk.refetch();
|
||||
|
||||
if (serversOnDisk.data?.length) {
|
||||
setDefaultServer(serversOnDisk.data[0].id);
|
||||
createApi(serversOnDisk.data[0].address, undefined);
|
||||
} else {
|
||||
// TODO: Reset api in context
|
||||
// useApi.setState(useApi.getInitialState());
|
||||
}
|
||||
setSettingsDialogOpen(false);
|
||||
await queryClient.removeQueries();
|
||||
navigate({ to: "/" });
|
||||
}
|
||||
enqueueSnackbar("Server deleted successfully!", { variant: "success" });
|
||||
await serversOnDisk.refetch();
|
||||
await defaultServer.refetch();
|
||||
},
|
||||
});
|
||||
|
||||
// Memoize PaperProps to prevent unnecessary re-renders
|
||||
const paperProps = useMemo(
|
||||
() => ({
|
||||
className: "settings glass",
|
||||
elevation: 10,
|
||||
}),
|
||||
[],
|
||||
);
|
||||
|
||||
// Memoize onClose function to prevent unnecessary re-renders
|
||||
const handleClose = useCallback(() => {
|
||||
setSettingsDialogOpen(false);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
fullWidth
|
||||
maxWidth="md"
|
||||
slotProps={{ paper: paperProps }}
|
||||
hideBackdrop
|
||||
onClose={handleClose}
|
||||
>
|
||||
<Tabs
|
||||
orientation="vertical"
|
||||
value={tabValue}
|
||||
onChange={(_, newValue) => {
|
||||
setSettingsTabValue(newValue);
|
||||
}}
|
||||
style={{
|
||||
background: "rgb(0 0 0 / 0.4)",
|
||||
}}
|
||||
>
|
||||
<Tab
|
||||
icon={<span className="material-symbols-rounded">settings</span>}
|
||||
iconPosition="start"
|
||||
value={1}
|
||||
label="General"
|
||||
className="settings-tab"
|
||||
sx={{
|
||||
minHeight: "48px",
|
||||
height: "48px",
|
||||
}}
|
||||
/>
|
||||
<Tab
|
||||
icon={<span className="material-symbols-rounded">dns</span>}
|
||||
iconPosition="start"
|
||||
value={2}
|
||||
label="Servers"
|
||||
className="settings-tab"
|
||||
sx={{
|
||||
minHeight: "48px",
|
||||
height: "48px",
|
||||
}}
|
||||
/>
|
||||
<Tab
|
||||
icon={<span className="material-symbols-rounded">tune</span>}
|
||||
iconPosition="start"
|
||||
value={3}
|
||||
label="Preferences"
|
||||
className="settings-tab"
|
||||
sx={{
|
||||
minHeight: "48px",
|
||||
height: "48px",
|
||||
}}
|
||||
/>
|
||||
<Tab
|
||||
icon={<span className="material-symbols-rounded">info</span>}
|
||||
iconPosition="start"
|
||||
value={10}
|
||||
label="About"
|
||||
className="settings-tab"
|
||||
sx={{
|
||||
minHeight: "48px",
|
||||
height: "48px",
|
||||
marginTop: "auto",
|
||||
}}
|
||||
/>
|
||||
</Tabs>
|
||||
<AnimatePresence mode="wait">
|
||||
<motion.div
|
||||
variants={motionConfig}
|
||||
initial="initial"
|
||||
animate="visible"
|
||||
exit="initial"
|
||||
key={tabValue}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
}}
|
||||
className="settings-scroll "
|
||||
>
|
||||
{/* General */}
|
||||
{tabValue === 1 && (
|
||||
<div className="settings-container">
|
||||
{allSettings.general.map((setting) => (
|
||||
<SettingOption key={setting.key} setting={setting} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Server */}
|
||||
{tabValue === 2 && (
|
||||
<motion.div
|
||||
layoutScroll
|
||||
className="settings-container settings-server-container"
|
||||
>
|
||||
{serversOnDisk.isSuccess &&
|
||||
serversOnDisk.data.map((server, index) => {
|
||||
return (
|
||||
<motion.div
|
||||
key={server.id}
|
||||
className="settings-server"
|
||||
initial={{
|
||||
transform: "translateY(10px)",
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{ transform: "translateY(0px)", opacity: 1 }}
|
||||
exit={{ transform: "translateY(-10px)", opacity: 0 }}
|
||||
transition={{
|
||||
delay: 0.1 * index,
|
||||
duration: 0.15,
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded settings-server-icon">
|
||||
hard_drive
|
||||
</span>
|
||||
<div className="settings-server-info">
|
||||
<Typography
|
||||
variant="h5"
|
||||
style={{
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
{server.systemInfo?.ServerName}
|
||||
{systemInfo.data?.Id === server.id && (
|
||||
<Chip
|
||||
label={
|
||||
<Typography
|
||||
variant="caption"
|
||||
fontWeight={600}
|
||||
fontFamily="JetBrains Mono Variable"
|
||||
>
|
||||
Current
|
||||
</Typography>
|
||||
}
|
||||
color="info"
|
||||
sx={{
|
||||
ml: 2,
|
||||
width: "5.4em",
|
||||
}}
|
||||
size="medium"
|
||||
/>
|
||||
)}
|
||||
</Typography>
|
||||
<Typography variant="subtitle1">
|
||||
{server.address}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="subtitle2"
|
||||
className="settings-server-info-version"
|
||||
>
|
||||
Version:{" "}
|
||||
<Typography
|
||||
className="gradient-text"
|
||||
variant="subtitle2"
|
||||
fontWeight={700}
|
||||
>
|
||||
{server.systemInfo?.Version}
|
||||
</Typography>
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-buttons">
|
||||
<IconButton
|
||||
style={{
|
||||
fontSize: "1.64em",
|
||||
}}
|
||||
onClick={() => {
|
||||
handleServerChange.mutate(server);
|
||||
}}
|
||||
disabled={handleServerChange.isPending}
|
||||
>
|
||||
<div className="material-symbols-rounded">start</div>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
style={{
|
||||
fontSize: "1.64em",
|
||||
|
||||
color: red[400],
|
||||
}}
|
||||
disabled={handleServerChange.isPending}
|
||||
onClick={() => {
|
||||
handleDelete.mutate(server);
|
||||
}}
|
||||
>
|
||||
<div className="material-symbols-rounded">
|
||||
delete_forever
|
||||
</div>
|
||||
</IconButton>
|
||||
</div>
|
||||
</motion.div>
|
||||
);
|
||||
})}
|
||||
<div className="settings-server-fab-container">
|
||||
<Fab
|
||||
onClick={() => serversOnDisk.refetch()}
|
||||
size="medium"
|
||||
color="info"
|
||||
disabled={serversOnDisk.isFetching}
|
||||
>
|
||||
<span
|
||||
className={
|
||||
serversOnDisk.isFetching
|
||||
? "material-symbols-rounded animate-rotate"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
autorenew
|
||||
</span>
|
||||
</Fab>
|
||||
<Fab
|
||||
variant="extended"
|
||||
onClick={() => setAddServerDialog(true)}
|
||||
>
|
||||
<span
|
||||
className="material-symbols-rounded fill"
|
||||
style={{
|
||||
marginRight: "0.25em",
|
||||
}}
|
||||
>
|
||||
add_circle
|
||||
</span>
|
||||
Add server
|
||||
</Fab>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{/* Preferences */}
|
||||
{tabValue === 3 && cultures.isSuccess && (
|
||||
<div className="settings-container">
|
||||
<SettingOptionSelect
|
||||
setting={{
|
||||
name: "Preferred Audio Language",
|
||||
description: "Select your preferred audio language.",
|
||||
}}
|
||||
userValue={
|
||||
user?.Configuration?.AudioLanguagePreference ?? "anyLanguage"
|
||||
}
|
||||
options={cultures.data ?? []}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* About */}
|
||||
{tabValue === 10 && (
|
||||
<div className="settings-container settings-about">
|
||||
<img src={logo} className="settings-logo" alt="Blink" />
|
||||
<div className="settings-grid">
|
||||
<div className="settings-info-container">
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">Client Version:</Typography>
|
||||
<Chip
|
||||
icon={
|
||||
<span
|
||||
className="material-symbols-rounded"
|
||||
// style={{ "--wght": 500 }}
|
||||
>
|
||||
{updateInfo.data?.available
|
||||
? "release_alert"
|
||||
: "new_releases"}
|
||||
</span>
|
||||
}
|
||||
label={
|
||||
<Typography variant="subtitle2">
|
||||
{applicationVersion}
|
||||
</Typography>
|
||||
}
|
||||
color={updateInfo.data?.available ? "error" : "success"}
|
||||
size="small"
|
||||
style={{
|
||||
width: "fit-content !important",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Update Available:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{updateInfo.isFetching ? (
|
||||
"Checking for new updates..."
|
||||
) : updateInfo.data?.available ? (
|
||||
<Chip
|
||||
icon={
|
||||
<span className="material-symbols-rounded">
|
||||
new_releases
|
||||
</span>
|
||||
}
|
||||
label={
|
||||
<Typography variant="subtitle2">
|
||||
{applicationVersion}
|
||||
</Typography>
|
||||
}
|
||||
color="success"
|
||||
size="small"
|
||||
style={{
|
||||
width: "fit-content !important",
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
"No update found."
|
||||
)}
|
||||
</Typography>
|
||||
</div>
|
||||
<LoadingButton
|
||||
style={{
|
||||
marginTop: "auto",
|
||||
}}
|
||||
loading={updateInfo.isFetching || updating}
|
||||
variant="contained"
|
||||
disabled={!updateInfo.data?.available}
|
||||
loadingPosition="start"
|
||||
onClick={async () => {
|
||||
if (updateInfo.data?.available) {
|
||||
setUpdating(true);
|
||||
await updateInfo.data?.downloadAndInstall();
|
||||
enqueueSnackbar(
|
||||
"Update has been installed! You need to relaunch Blink.",
|
||||
{
|
||||
variant: "success",
|
||||
},
|
||||
);
|
||||
await relaunch();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{updateInfo.isFetching
|
||||
? "Checking for Update..."
|
||||
: updateInfo.data?.available
|
||||
? "Update"
|
||||
: "No Update Found"}
|
||||
</LoadingButton>
|
||||
</div>
|
||||
{systemInfo.isSuccess ? (
|
||||
<div className="settings-info-container">
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">Server:</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.ServerName}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Jellyfin Version:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.Version}
|
||||
</Typography>
|
||||
</div>
|
||||
<div className="settings-info">
|
||||
<Typography variant="subtitle2">
|
||||
Server Architecture:
|
||||
</Typography>
|
||||
<Typography variant="subtitle2">
|
||||
{systemInfo.data?.SystemArchitecture}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Skeleton
|
||||
variant="rectangular"
|
||||
sx={{
|
||||
height: "100%",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
marginTop: "1em",
|
||||
background: "rgb(0 0 0 / 0.3)",
|
||||
padding: "1em",
|
||||
borderRadius: "10px",
|
||||
}}
|
||||
>
|
||||
<Typography variant="subtitle1" mb={1}>
|
||||
Links:
|
||||
</Typography>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "flex-start",
|
||||
gap: "0.1em",
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
component={Link}
|
||||
variant="subtitle2"
|
||||
target="_blank"
|
||||
href="https://github.com/prayag17/Blink"
|
||||
>
|
||||
https://github.com/prayag17/Blink
|
||||
</Typography>
|
||||
<Typography
|
||||
component={Link}
|
||||
variant="subtitle2"
|
||||
target="_blank"
|
||||
href="https://jellyfin.org"
|
||||
>
|
||||
https://jellyfin.org
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
|
||||
<AddServerDialog
|
||||
open={addServerDialog}
|
||||
setAddServerDialog={setAddServerDialog}
|
||||
hideBackdrop
|
||||
sideEffect={async () => {
|
||||
await serversOnDisk.refetch();
|
||||
}}
|
||||
/>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
|
||||
export default Settings;
|
||||
@@ -1,151 +0,0 @@
|
||||
.settings {
|
||||
display: grid !important;
|
||||
grid-template-columns: 20% 1fr;
|
||||
height: 60vh;
|
||||
overflow: hidden !important;
|
||||
.MuiTabs-flexContainerVertical {
|
||||
height: 100%;
|
||||
}
|
||||
&-container {
|
||||
margin: 14px 0 14px 14px;
|
||||
}
|
||||
&-tab {
|
||||
display: grid !important;
|
||||
grid-template-columns: 2em 1fr;
|
||||
align-items: center;
|
||||
justify-items: start !important;
|
||||
gap: 1em;
|
||||
& .material-symbols-rounded {
|
||||
justify-self: center !important;
|
||||
}
|
||||
}
|
||||
&-scroll {
|
||||
overflow-y: auto;
|
||||
scrollbar-gutter: stable;
|
||||
overscroll-behavior: contain;
|
||||
// Magic scrollbar
|
||||
&::-webkit-scrollbar {
|
||||
&-thumb {
|
||||
height: 150px;
|
||||
max-height: 33%;
|
||||
}
|
||||
&-track {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
background: transparent !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
// About page
|
||||
&-grid {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
gap: 1em;
|
||||
}
|
||||
&-logo {
|
||||
width: 100%;
|
||||
background: rgb(255 255 255 / 1);
|
||||
padding: 0em;
|
||||
height: 10em;
|
||||
margin-bottom: 1em;
|
||||
border-radius: $border-radius-default;
|
||||
object-fit: contain;
|
||||
}
|
||||
&-info {
|
||||
display: grid;
|
||||
grid-template-columns: 40% 1fr;
|
||||
gap: 1em;
|
||||
justify-items: start;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid rgb(255 255 255 / 0.1);
|
||||
padding-bottom: 0.5em;
|
||||
&-container {
|
||||
background: rgb(0 0 0 / 0.3);
|
||||
padding: 1em;
|
||||
border-radius: $border-radius-default;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.6em;
|
||||
width: 100%;
|
||||
}
|
||||
&:last-child {
|
||||
border: none;
|
||||
padding-bottom: 0em;
|
||||
}
|
||||
> :last-child {
|
||||
opacity: 0.8;
|
||||
}
|
||||
}
|
||||
//settings
|
||||
&-option {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
padding: 0 !important;
|
||||
margin: 0 !important;
|
||||
margin-bottom: 0.6em !important;
|
||||
&-info-caption {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
//serverList
|
||||
&-server {
|
||||
display: grid;
|
||||
grid-template-columns: 3.4em 1fr auto;
|
||||
justify-items: start;
|
||||
align-items: center;
|
||||
gap: 0.8em;
|
||||
background: rgb(0 0 0 / 0.3);
|
||||
padding: 1em;
|
||||
width: 100%;
|
||||
border-radius: $border-radius-default;
|
||||
&-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1em;
|
||||
align-items: center;
|
||||
padding-bottom: 4.6em;
|
||||
}
|
||||
&-icon {
|
||||
font-size: 3.4em !important;
|
||||
font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 10, "opsz" 40;
|
||||
}
|
||||
&-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
// width: 100%;
|
||||
&-version {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.4em;
|
||||
}
|
||||
}
|
||||
&-buttons {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5em;
|
||||
// width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
&-fab-container {
|
||||
display: flex;
|
||||
position: absolute;
|
||||
bottom: 14px;
|
||||
right: 14px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.8em;
|
||||
}
|
||||
// Dialog
|
||||
&-add {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 1em;
|
||||
}
|
||||
}
|
||||
}
|
||||
.Mui-selected .material-symbols-rounded {
|
||||
font-variation-settings: "FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40;
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import React from "react";
|
||||
import { AppBar } from "@/components/appBar/appBar";
|
||||
// import NProgress from "@/components/nProgress";
|
||||
import AudioPlayer from "@/components/playback/audioPlayer";
|
||||
import Settings from "@/components/settings";
|
||||
|
||||
import "../styles/global.scss";
|
||||
import { theme } from "@/theme";
|
||||
@@ -49,7 +48,6 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<ThemeProvider theme={theme}>
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<CssBaseline />
|
||||
<Settings />
|
||||
<EasterEgg />
|
||||
{/* <NProgress /> */}
|
||||
|
||||
|
||||
@@ -67,11 +67,27 @@
|
||||
transform: translate(-50%);
|
||||
border-radius: 100px;
|
||||
overflow: hidden;
|
||||
transition: background $transition-time-default, box-shadow $transition-time-default;
|
||||
z-index: 1000;
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0 -0.35em;
|
||||
pointer-events: none;
|
||||
border-radius: inherit;
|
||||
// Glass styling matching Search Dialog
|
||||
background-color: rgba(20, 20, 30, 0.7);
|
||||
backdrop-filter: blur(24px) saturate(180%);
|
||||
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
||||
opacity: 0;
|
||||
z-index: -1;
|
||||
transition: all $transition-time-fast;
|
||||
}
|
||||
&.scrolling {
|
||||
background: rgb(0 0 0 / 0.4) !important;
|
||||
box-shadow: 0 0 25px rgb(0 0 0 / 0.45);
|
||||
&::after {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-options {
|
||||
|
||||
+529
-346
@@ -1,23 +1,36 @@
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import TextField from "@mui/material/TextField";
|
||||
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { EmptyNotice } from "@/components/notices/emptyNotice/emptyNotice";
|
||||
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getItemsApi } from "@jellyfin/sdk/lib/utils/api/items-api";
|
||||
import { getPersonsApi } from "@jellyfin/sdk/lib/utils/api/persons-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 { 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,
|
||||
FormControl,
|
||||
Grow,
|
||||
IconButton,
|
||||
InputBase,
|
||||
MenuItem,
|
||||
OutlinedInput,
|
||||
Select,
|
||||
type SelectChangeEvent,
|
||||
Typography,
|
||||
useScrollTrigger,
|
||||
} from "@mui/material";
|
||||
import { createFileRoute, Outlet, useNavigate } from "@tanstack/react-router";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import BackButton from "@/components/buttons/backButton";
|
||||
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
||||
import useDebounce from "@/utils/hooks/useDebounce";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { Fab } from "@mui/material";
|
||||
import { Outlet, createFileRoute, useNavigate } from "@tanstack/react-router";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
|
||||
export const Route = createFileRoute("/_api/search/")({
|
||||
component: SearchPage,
|
||||
@@ -26,358 +39,528 @@ export const Route = createFileRoute("/_api/search/")({
|
||||
},
|
||||
});
|
||||
|
||||
const CATEGORIES = [
|
||||
{ label: "Movies", value: "Movie", kind: BaseItemKind.Movie },
|
||||
{ label: "TV Shows", value: "Series", kind: BaseItemKind.Series },
|
||||
{ label: "Episodes", value: "Episode", kind: "Episode" },
|
||||
{ label: "Music", value: "MusicAlbum", kind: BaseItemKind.MusicAlbum },
|
||||
{ label: "Artists", value: "MusicArtist", kind: BaseItemKind.MusicArtist },
|
||||
{ label: "People", value: "Person", kind: "Person" },
|
||||
{ label: "Books", value: "Book", kind: BaseItemKind.Book },
|
||||
];
|
||||
|
||||
function SearchPage() {
|
||||
const api = Route.useRouteContext().api;
|
||||
|
||||
const navigate = useNavigate();
|
||||
const { query } = Route.useSearch();
|
||||
|
||||
const [searchTerm, setSearchTerm] = useState("");
|
||||
// const searchParam = useDebounce(query, 500);
|
||||
|
||||
const [setBackdrop] = useBackdropStore(useShallow((s) => [s.setBackdrop]));
|
||||
const user = useCentralStore((s) => s.currentUser);
|
||||
|
||||
const itemLimit = 12;
|
||||
|
||||
const movies = useQuery({
|
||||
queryKey: ["search", "items", "Movie", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Movie],
|
||||
recursive: true,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const series = useQuery({
|
||||
queryKey: ["search", "items", "Series", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Series],
|
||||
recursive: true,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const musicAlbum = useQuery({
|
||||
queryKey: ["search", "items", "MusicAlbum", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.MusicAlbum],
|
||||
recursive: true,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const audio = useQuery({
|
||||
queryKey: ["search", "items", "Audio", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Audio],
|
||||
recursive: true,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const book = useQuery({
|
||||
queryKey: ["search", "items", "Book", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.Book],
|
||||
recursive: true,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const musicArtists = useQuery({
|
||||
queryKey: ["search", "items", "MusicArtists", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getItemsApi(api).getItems({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [BaseItemKind.MusicArtist],
|
||||
recursive: true,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const person = useQuery({
|
||||
queryKey: ["search", "items", "Person", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getPersonsApi(api).getPersons({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
limit: itemLimit,
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
const episodes = useQuery({
|
||||
queryKey: ["search", "items", "Episodes", query],
|
||||
queryFn: async () => {
|
||||
if (!api) return null;
|
||||
const result = await getSearchApi(api).getSearchHints({
|
||||
userId: user?.Id,
|
||||
searchTerm: query,
|
||||
limit: itemLimit,
|
||||
includeItemTypes: ["Episode"],
|
||||
});
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!user?.Id,
|
||||
});
|
||||
|
||||
const [setBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
|
||||
const [searchTerm, setSearchTerm] = useState(query ?? "");
|
||||
const debouncedSearchTerm = useDebounce(searchTerm, 300);
|
||||
const [selectedCategories, setSelectedCategories] = useState<string[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
// Removing app's backdrop
|
||||
setBackdrop("", "");
|
||||
if (query && query !== searchTerm) {
|
||||
setSearchTerm(query);
|
||||
}
|
||||
}, [query]);
|
||||
|
||||
useEffect(() => {
|
||||
if (debouncedSearchTerm !== query) {
|
||||
navigate({
|
||||
to: "/search",
|
||||
search: { query: debouncedSearchTerm ?? "" },
|
||||
replace: true,
|
||||
});
|
||||
}
|
||||
}, [debouncedSearchTerm, navigate]);
|
||||
|
||||
useEffect(() => {
|
||||
setBackdrop("");
|
||||
}, []);
|
||||
|
||||
const handleCategoryChange = (event: SelectChangeEvent<string[]>) => {
|
||||
const {
|
||||
target: { value },
|
||||
} = event;
|
||||
setSelectedCategories(typeof value === "string" ? value.split(",") : value);
|
||||
};
|
||||
|
||||
const activeCategories = useMemo(() => {
|
||||
if (selectedCategories.length === 0) return CATEGORIES;
|
||||
return CATEGORIES.filter((cat) => selectedCategories.includes(cat.value));
|
||||
}, [selectedCategories]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className="scrollY"
|
||||
style={{
|
||||
paddingTop: "4.2em",
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: "0.5em",
|
||||
paddingBottom: "2em",
|
||||
}}
|
||||
>
|
||||
<div className="search-header">
|
||||
<TextField
|
||||
variant="outlined"
|
||||
style={{
|
||||
width: "50%",
|
||||
}}
|
||||
placeholder="Search"
|
||||
hiddenLabel
|
||||
className="search-searchbar"
|
||||
slotProps={{
|
||||
input: {
|
||||
style: {
|
||||
border: "100px !important",
|
||||
},
|
||||
autoFocus: true,
|
||||
},
|
||||
htmlInput: {
|
||||
className: "search-searchbar-input",
|
||||
},
|
||||
}}
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.currentTarget.value)}
|
||||
/>
|
||||
<Fab
|
||||
size="medium"
|
||||
onClick={() =>
|
||||
navigate({ search: { query: searchTerm }, replace: true })
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</Fab>
|
||||
</div>
|
||||
<div className="search-page scrollY">
|
||||
<div
|
||||
className={`search-page-bg ${debouncedSearchTerm ? "active" : ""}`}
|
||||
/>
|
||||
|
||||
<SearchAppBar
|
||||
searchTerm={searchTerm}
|
||||
setSearchTerm={setSearchTerm}
|
||||
selectedCategories={selectedCategories}
|
||||
handleCategoryChange={handleCategoryChange}
|
||||
handleClearCategories={() => setSelectedCategories([])}
|
||||
/>
|
||||
|
||||
<div
|
||||
className="search-page-content"
|
||||
style={{
|
||||
height: "100%",
|
||||
paddingTop: "2.4em",
|
||||
}}
|
||||
>
|
||||
{movies.isSuccess && Boolean(movies.data?.Items?.length) && (
|
||||
<CardScroller title="Movies" displayCards={7} disableDecoration>
|
||||
{movies.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="portrait"
|
||||
queryKey={["search", "items", "Movie", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{series.isSuccess && Boolean(series.data?.Items?.length) && (
|
||||
<CardScroller title="TV Shows" displayCards={7} disableDecoration>
|
||||
{series.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={`${item.ProductionYear} - ${
|
||||
item.EndDate
|
||||
? new Date(item.EndDate).toLocaleString([], {
|
||||
year: "numeric",
|
||||
})
|
||||
: "Present"
|
||||
}`}
|
||||
cardType="portrait"
|
||||
queryKey={["search", "items", "Series", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{episodes.isSuccess && Boolean(episodes.data?.TotalRecordCount) && (
|
||||
<CardScroller title="Episodes" displayCards={4} disableDecoration>
|
||||
{episodes.data?.SearchHints?.map((episode) => {
|
||||
return (
|
||||
<Card
|
||||
key={episode.Id}
|
||||
item={episode}
|
||||
cardTitle={episode.Series}
|
||||
cardType="thumb"
|
||||
cardCaption={`S${episode.ParentIndexNumber}:E${episode.IndexNumber} - ${episode.Name}`}
|
||||
queryKey={["search", "items", "Episodes", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
)}
|
||||
{audio.isSuccess && Boolean(audio.data?.Items?.length) && (
|
||||
<CardScroller title="Audio" displayCards={7} disableDecoration>
|
||||
{audio.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.ProductionYear}
|
||||
cardType="square"
|
||||
queryKey={["search", "items", "Audio", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicAlbum.isSuccess && Boolean(musicAlbum.data?.Items?.length) && (
|
||||
<CardScroller title="Albums" displayCards={7} disableDecoration>
|
||||
{musicAlbum.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
seriesId={item.SeriesId}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.AlbumArtist}
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicAlbum", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{book.isSuccess && Boolean(book.data?.Items?.length) && (
|
||||
<CardScroller title="Books" displayCards={7} disableDecoration>
|
||||
{book.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
cardCaption={item.ProductionYear}
|
||||
disableOverlay
|
||||
cardType={"portrait"}
|
||||
queryKey={["search", "items", "Book", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{musicArtists.isSuccess &&
|
||||
Boolean(musicArtists.data?.Items?.length) && (
|
||||
<CardScroller title="Artists" displayCards={7} disableDecoration>
|
||||
{musicArtists.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "MusicArtists", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
)}
|
||||
{person.isSuccess && Boolean(person.data?.Items?.length) && (
|
||||
<CardScroller title="People" displayCards={7} disableDecoration>
|
||||
{person.data?.Items?.map((item) => (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
cardTitle={item.Name}
|
||||
imageType={"Primary"}
|
||||
disableOverlay
|
||||
cardType={"square"}
|
||||
queryKey={["search", "items", "Person", query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
{debouncedSearchTerm ? (
|
||||
<SearchResultsList
|
||||
categories={activeCategories}
|
||||
query={debouncedSearchTerm}
|
||||
api={api}
|
||||
user={user}
|
||||
/>
|
||||
) : (
|
||||
<Fade in timeout={800}>
|
||||
<Box className="search-empty-state">
|
||||
<Box className="icon-stack">
|
||||
<span className="material-symbols-rounded icon-lg">movie</span>
|
||||
<span className="material-symbols-rounded icon-sm">
|
||||
music_note
|
||||
</span>
|
||||
<span className="material-symbols-rounded icon-md">tv</span>
|
||||
</Box>
|
||||
<Typography variant="h4" fontWeight={600} gutterBottom>
|
||||
Explore your library
|
||||
</Typography>
|
||||
<Typography variant="body1" sx={{ opacity: 0.6, maxWidth: 400 }}>
|
||||
Search for movies, tv shows, music, people and more.
|
||||
</Typography>
|
||||
</Box>
|
||||
</Fade>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{movies.isSuccess &&
|
||||
series.isSuccess &&
|
||||
audio.isSuccess &&
|
||||
musicAlbum.isSuccess &&
|
||||
book.isSuccess &&
|
||||
musicArtists.isSuccess &&
|
||||
person.isSuccess &&
|
||||
movies.data?.Items?.length === 0 &&
|
||||
series.data?.Items?.length === 0 &&
|
||||
audio.data?.Items?.length === 0 &&
|
||||
musicAlbum.data?.Items?.length === 0 &&
|
||||
book.data?.Items?.length === 0 &&
|
||||
musicArtists.data?.Items?.length === 0 &&
|
||||
person.data?.Items?.length === 0 &&
|
||||
episodes.data?.SearchHints?.length === 0 && (
|
||||
<div
|
||||
style={{
|
||||
height: "calc(100vh - 12em)",
|
||||
}}
|
||||
>
|
||||
<EmptyNotice extraMsg={"Try using different search terms."} />
|
||||
</div>
|
||||
)}
|
||||
<Outlet />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface SearchAppBarProps {
|
||||
searchTerm: string;
|
||||
setSearchTerm: (term: string) => void;
|
||||
selectedCategories: string[];
|
||||
handleCategoryChange: (event: SelectChangeEvent<string[]>) => void;
|
||||
handleClearCategories: () => void;
|
||||
}
|
||||
|
||||
function SearchAppBar({
|
||||
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 toggleSearchDialog = useSearchStore(
|
||||
useShallow((s) => s.toggleSearchDialog),
|
||||
);
|
||||
|
||||
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 disabled>
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
<BackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<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="Search library..."
|
||||
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={{ mr: 2, p: 0.5 }}
|
||||
>
|
||||
<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 (
|
||||
<Typography
|
||||
variant="body2"
|
||||
color="textSecondary"
|
||||
sx={{ opacity: 0.7 }}
|
||||
>
|
||||
Types
|
||||
</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={{
|
||||
PaperProps: {
|
||||
className: "glass-menu",
|
||||
},
|
||||
disableScrollLock: true,
|
||||
}}
|
||||
size="small"
|
||||
>
|
||||
<MenuItem disabled value="">
|
||||
<Typography variant="overline" color="textSecondary">
|
||||
Filter by Type
|
||||
</Typography>
|
||||
</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={toggleSearchDialog}>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<div className="material-symbols-rounded">favorite</div>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
</div>
|
||||
</AppBar>
|
||||
);
|
||||
}
|
||||
|
||||
function SearchResultsList({ categories, query, api, user }: any) {
|
||||
// Lift state to know if we have ANY results
|
||||
const [resultsStatus, setResultsStatus] = useState<Record<string, boolean>>(
|
||||
{},
|
||||
);
|
||||
|
||||
const handleResultUpdate = (catValue: string, hasResults: boolean) => {
|
||||
setResultsStatus((prev) => {
|
||||
if (prev[catValue] === hasResults) return prev;
|
||||
return { ...prev, [catValue]: hasResults };
|
||||
});
|
||||
};
|
||||
|
||||
// Derived state: are *all* queried categories empty?
|
||||
// We only know for sure if all active categories have reported back false.
|
||||
// This is tricky with async. A better way implies checking isLoading.
|
||||
// For now, we render the sections; if they are empty, they render null.
|
||||
// If ALL render null, we show "No Results".
|
||||
|
||||
// Simpler visual fix: Render "No results found" at the bottom if nothing appears?
|
||||
// No, that looks broken.
|
||||
|
||||
// Let's use a timeout or assume if no results update to true after X time.
|
||||
|
||||
const _hasAnyResults = Object.values(resultsStatus).some((v) => v);
|
||||
|
||||
return (
|
||||
<Box sx={{ display: "flex", flexDirection: "column", gap: "1em", pb: 4 }}>
|
||||
{categories.map((cat: any) => (
|
||||
<CategorySection
|
||||
key={cat.value}
|
||||
category={cat}
|
||||
query={query}
|
||||
api={api}
|
||||
user={user}
|
||||
onResult={(hasItems: boolean) =>
|
||||
handleResultUpdate(cat.value, hasItems)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
|
||||
{/*
|
||||
Only show "No results" if we are confident.
|
||||
Since we don't have a global loading state here,
|
||||
checking `!hasAnyResults` immediately causes flickers.
|
||||
Better to handle "No results" inside the sections or leave it blank?
|
||||
User asked for "User needs to know search result is empty".
|
||||
*/}
|
||||
<NoResultsDetector
|
||||
categories={categories}
|
||||
resultsStatus={resultsStatus}
|
||||
/>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
function NoResultsDetector({ categories, resultsStatus }: any) {
|
||||
// Wait for all categories to report status
|
||||
const allReported = categories.every(
|
||||
(c: any) => resultsStatus[c.value] !== undefined,
|
||||
);
|
||||
const hasAny = Object.values(resultsStatus).some((v) => v);
|
||||
|
||||
if (allReported && !hasAny) {
|
||||
return (
|
||||
<Fade in>
|
||||
<Box className="search-no-results">
|
||||
<Typography variant="h6">No results found</Typography>
|
||||
<Typography variant="body2" sx={{ opacity: 0.6 }}>
|
||||
Try adjusting your search or filters.
|
||||
</Typography>
|
||||
</Box>
|
||||
</Fade>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function CategorySection({ category, query, api, user, onResult }: any) {
|
||||
const limit = 20;
|
||||
|
||||
const { data, isLoading } = useQuery({
|
||||
queryKey: ["search", "category", category.value, query],
|
||||
queryFn: async () => {
|
||||
if (!api || !user?.Id) return { items: [], total: 0 };
|
||||
|
||||
if (category.value === "Person") {
|
||||
const res = await getPersonsApi(api).getPersons({
|
||||
userId: user.Id,
|
||||
searchTerm: query,
|
||||
limit,
|
||||
});
|
||||
return { items: res.data.Items, total: res.data.TotalRecordCount };
|
||||
}
|
||||
|
||||
if (category.value === "Episode") {
|
||||
const res = await getSearchApi(api).getSearchHints({
|
||||
userId: user.Id,
|
||||
searchTerm: query,
|
||||
limit,
|
||||
includeItemTypes: ["Episode"],
|
||||
});
|
||||
return {
|
||||
items: res.data.SearchHints,
|
||||
total: res.data.TotalRecordCount,
|
||||
};
|
||||
}
|
||||
|
||||
const res = await getItemsApi(api).getItems({
|
||||
userId: user.Id,
|
||||
searchTerm: query,
|
||||
includeItemTypes: [category.kind],
|
||||
recursive: true,
|
||||
limit,
|
||||
});
|
||||
return { items: res.data.Items, total: res.data.TotalRecordCount };
|
||||
},
|
||||
enabled: !!query,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!isLoading && data) {
|
||||
onResult((data.items?.length || 0) > 0);
|
||||
} else if (!isLoading && !data) {
|
||||
onResult(false);
|
||||
}
|
||||
}, [data, isLoading, onResult]);
|
||||
|
||||
if (isLoading) return <CategorySkeleton />;
|
||||
if (!data?.items || data.items.length === 0) return null;
|
||||
|
||||
// ... (Card mapping logic same as before) ...
|
||||
return (
|
||||
<Grow in>
|
||||
<div>
|
||||
<CardScroller
|
||||
title={category.label}
|
||||
displayCards={category.value === "Episode" ? 4 : 7}
|
||||
disableDecoration
|
||||
>
|
||||
{data.items.map((item: any) => {
|
||||
let props: any = {
|
||||
cardTitle: item?.Name,
|
||||
imageType: "Primary",
|
||||
cardCaption: item?.ProductionYear,
|
||||
cardType: "portrait",
|
||||
};
|
||||
|
||||
if (category.value === "Series") {
|
||||
props.cardCaption = `${item.ProductionYear || ""}`;
|
||||
} else if (
|
||||
category.value === "MusicAlbum" ||
|
||||
category.value === "MusicArtist" ||
|
||||
category.value === "Person"
|
||||
) {
|
||||
props.cardType = "square";
|
||||
} else if (category.value === "Episode") {
|
||||
props = {
|
||||
cardTitle: item.Series,
|
||||
imageType: "Primary",
|
||||
cardCaption: `S${item.ParentIndexNumber}:E${item.IndexNumber} - ${item.Name}`,
|
||||
cardType: "thumb",
|
||||
};
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
key={item.Id}
|
||||
item={item}
|
||||
{...props}
|
||||
queryKey={["search", "category", category.value, query]}
|
||||
userId={user?.Id}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</CardScroller>
|
||||
</div>
|
||||
</Grow>
|
||||
);
|
||||
}
|
||||
|
||||
function CategorySkeleton() {
|
||||
return (
|
||||
<Box sx={{ mb: 4, ml: 2, mr: 2 }}>
|
||||
<Box
|
||||
sx={{
|
||||
height: 32,
|
||||
width: 200,
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
borderRadius: 2,
|
||||
mb: 2,
|
||||
}}
|
||||
/>
|
||||
<Box sx={{ display: "flex", gap: 2, overflow: "hidden" }}>
|
||||
{[1, 2, 3, 4, 5, 6].map((i) => (
|
||||
<Box
|
||||
key={i}
|
||||
sx={{
|
||||
height: 260,
|
||||
minWidth: 170,
|
||||
bgcolor: "rgba(255,255,255,0.03)",
|
||||
borderRadius: 3,
|
||||
}}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
export default SearchPage;
|
||||
@@ -1,23 +1,221 @@
|
||||
|
||||
.search {
|
||||
&-header {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 1em;
|
||||
height: 4em;
|
||||
}
|
||||
&-searchbar {
|
||||
border-radius: 100px !important;
|
||||
background: rgb(255 255 255 / 0.09);
|
||||
border: none !important;
|
||||
.MuiInputBase-root {
|
||||
border-radius: 100px !important;
|
||||
}
|
||||
&-input {
|
||||
text-align: center;
|
||||
padding: 0.8em 1.5em !important;
|
||||
}
|
||||
}
|
||||
.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;
|
||||
// Glass styling matching Search Dialog
|
||||
background-color: rgba(20, 20, 30, 0.7);
|
||||
backdrop-filter: blur(24px) saturate(180%);
|
||||
background-image: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
|
||||
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;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
.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; }
|
||||
|
||||
&: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;
|
||||
}
|
||||
}
|
||||
|
||||
// Global override for the dropdown menu to match glassmorphism
|
||||
.glass-menu {
|
||||
background-color: rgba(30, 30, 40, 0.9) !important;
|
||||
backdrop-filter: blur(20px) !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1) !important;
|
||||
border-radius: 16px !important;
|
||||
box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
|
||||
|
||||
.MuiMenuItem-root {
|
||||
border-radius: 8px;
|
||||
margin: 4px;
|
||||
font-size: 0.9rem;
|
||||
transition: background-color 0.2s;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
&.Mui-selected {
|
||||
background-color: rgba(255, 255, 255, 0.2) !important;
|
||||
color: #fff;
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.25) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,39 @@
|
||||
&-form{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
align-items: stretch;
|
||||
justify-content: flex-start;
|
||||
gap: 1em;
|
||||
gap: 1.5em;
|
||||
width: 100%;
|
||||
margin-top: 2em;
|
||||
|
||||
button[type="submit"] {
|
||||
align-self: flex-end;
|
||||
min-width: 10em;
|
||||
}
|
||||
}
|
||||
&-option {
|
||||
width: 100%;
|
||||
margin: 0 !important;
|
||||
justify-content: space-between;
|
||||
padding: 1em 0;
|
||||
|
||||
/* Ensure the label text takes available space */
|
||||
.MuiFormControlLabel-label {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
&-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25em;
|
||||
padding-right: 1em;
|
||||
|
||||
&-caption {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
&-sidebar {
|
||||
// padding-top: 4.4em !important;
|
||||
|
||||
@@ -10,16 +10,15 @@ import { createFileRoute } from "@tanstack/react-router";
|
||||
import React from "react";
|
||||
|
||||
import "../settings.scss";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import { getLocalizationApi } from "@jellyfin/sdk/lib/utils/api/localization-api";
|
||||
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
||||
|
||||
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
|
||||
// import { getDisplayPreferencesApi } from "@jellyfin/sdk/lib/utils/api/display-preferences-api";
|
||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||
import { useForm } from "@tanstack/react-form";
|
||||
import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { useSnackbar } from "notistack";
|
||||
import CircularPageLoadingAnimation from "@/components/circularPageLoadingAnimation";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
|
||||
export const Route = createFileRoute("/_api/settings/preferences")({
|
||||
component: RouteComponent,
|
||||
@@ -268,39 +267,6 @@ function RouteComponent() {
|
||||
Save
|
||||
</Button>
|
||||
</form>
|
||||
{/* <FormControlLabel
|
||||
value={currentCulture}
|
||||
control={
|
||||
<TextField select onChange={(e) => setCurrentCulture(e.target.value)}>
|
||||
<MenuItem key={"anyLanguage"} value={"anyLanguage"}>
|
||||
Any Language
|
||||
</MenuItem>
|
||||
{cultures.data?.map((option) => (
|
||||
<MenuItem
|
||||
key={option.ThreeLetterISOLanguageName}
|
||||
value={option.ThreeLetterISOLanguageName ?? "none"}
|
||||
>
|
||||
{option.DisplayName}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
}
|
||||
label={
|
||||
<div className="settings-option-info">
|
||||
<Typography variant="subtitle1" fontWeight={400}>
|
||||
{setting.name}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
className="settings-option-info-caption"
|
||||
>
|
||||
{setting.description}
|
||||
</Typography>
|
||||
</div>
|
||||
}
|
||||
labelPlacement="start"
|
||||
className="settings-option"
|
||||
/> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user