refactor: redesign sidebar component
This commit is contained in:
9 files changed
+487
-330
No files matched your search
@@ -106,15 +106,16 @@ export default function AddServerDialog(props: AddServerDialogProps) {
|
||||
p: "2px 16px",
|
||||
bgcolor: "rgba(0,0,0,0.2)",
|
||||
borderRadius: 2,
|
||||
border: "1px solid rgba(255,255,255,0.05)",
|
||||
border: "1px solid",
|
||||
borderColor: "rgba(255,255,255,0.05)",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
gap: 2,
|
||||
"&:focus-within": {
|
||||
border: "1px solid var(--mui-palette-primary-main)",
|
||||
borderColor: "var(--mui-palette-primary-main)",
|
||||
bgcolor: "rgba(0,0,0,0.3)",
|
||||
},
|
||||
transition: "all 0.2s",
|
||||
transition: "border-color 0.2s, background-color 0.2s",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
|
||||
|
||||
@@ -90,48 +90,98 @@
|
||||
}
|
||||
}
|
||||
|
||||
.library-drawer{
|
||||
width: 20em;
|
||||
margin: 1.4em;
|
||||
height: calc(100vh - 2.8em) !important;
|
||||
border-radius: 20px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
.library-drawer-item{
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 1000px;
|
||||
> div::before{
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: transparent;
|
||||
transition: $transition-time-default;
|
||||
z-index: -1;
|
||||
border-radius: 100px;
|
||||
.library-drawer {
|
||||
// Ensure the drawer paper itself gets the styling
|
||||
&.MuiDrawer-paper {
|
||||
width: 280px;
|
||||
margin: 16px;
|
||||
height: calc(100% - 32px) !important; // float in the middle
|
||||
border-radius: 24px;
|
||||
background: rgba(20, 20, 25, 0.75); // Darker, substantial base
|
||||
backdrop-filter: blur(24px) saturate(180%);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
box-shadow:
|
||||
0 24px 48px rgba(0, 0, 0, 0.4),
|
||||
0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
overflow: hidden; // Contain scrollbars
|
||||
}
|
||||
|
||||
.MuiList-root {
|
||||
padding: 8px; // Reduced from 16px
|
||||
gap: 2px; // Reduced gap
|
||||
}
|
||||
|
||||
.MuiDivider-root {
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
margin: 4px 12px; // Reduced margins
|
||||
}
|
||||
|
||||
// Navigation Items
|
||||
.MuiListItemButton-root {
|
||||
border-radius: 12px !important; // Slightly smaller radius
|
||||
padding: 8px 12px; // Reduced padding (was 12px 16px)
|
||||
margin-bottom: 2px;
|
||||
transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
color: #fff;
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
margin-right: 12px; // Reduced spacing
|
||||
font-size: 22px; // Slightly smaller icons usually look better with less padding
|
||||
transition: all 0.2s ease;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.MuiListItemText-primary {
|
||||
font-weight: 600;
|
||||
font-size: 0.9rem; // Slightly smaller text
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
}
|
||||
.active.library-drawer-item {
|
||||
.material-symbols-rounded{
|
||||
--fill: 1;
|
||||
}
|
||||
&> div::before {
|
||||
background: $clr-accent-default;
|
||||
|
||||
// Active State
|
||||
.library-drawer-item.active {
|
||||
.MuiListItemButton-root {
|
||||
background: linear-gradient(90deg, rgba($clr-accent-default, 0.2), rgba($clr-accent-default, 0.05));
|
||||
color: $clr-accent-default;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-variation-settings: 'FILL' 1;
|
||||
color: $clr-accent-default;
|
||||
}
|
||||
|
||||
// Active Indicator Bar
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
height: 24px;
|
||||
width: 4px;
|
||||
background: $clr-accent-default;
|
||||
border-radius: 0 4px 4px 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Magic scrollbar
|
||||
|
||||
// Custom Scrollbar for the drawer content
|
||||
&::-webkit-scrollbar {
|
||||
&-thumb {
|
||||
height: 150px;
|
||||
max-height: 33%;
|
||||
}
|
||||
&-track {
|
||||
margin-top: 15px;
|
||||
margin-bottom: 15px;
|
||||
background: transparent !important;
|
||||
width: 4px;
|
||||
}
|
||||
&::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 4px;
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,20 @@
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import MuiAppBar from "@mui/material/AppBar";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
import { useLocation, useNavigate } from "@tanstack/react-router";
|
||||
import React, { useCallback, useMemo, useState } from "react";
|
||||
|
||||
import "./appBar.scss";
|
||||
|
||||
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
// removed search placeholder; library state now managed via zustand
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useHeaderStore from "@/utils/store/header";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import {
|
||||
setSettingsDialogOpen,
|
||||
setSettingsTabValue,
|
||||
} from "@/utils/store/settings";
|
||||
import BackButton from "../buttons/backButton";
|
||||
import ListItemLink from "../listItemLink";
|
||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
import { NavigationDrawer } from "./navigationDrawer";
|
||||
|
||||
const MemoizeBackButton = React.memo(BackButton);
|
||||
|
||||
@@ -39,8 +30,6 @@ const HIDDEN_PATHS = [
|
||||
];
|
||||
|
||||
export const AppBar = () => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
@@ -55,23 +44,6 @@ export const AppBar = () => {
|
||||
location.pathname === "/",
|
||||
);
|
||||
|
||||
|
||||
const [user] = useCentralStore((s) => [s.currentUser]);
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
if (!user?.Id || !api?.accessToken) {
|
||||
return;
|
||||
}
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user?.Id && !!api?.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
@@ -86,13 +58,6 @@ export const AppBar = () => {
|
||||
};
|
||||
}, []);
|
||||
|
||||
const drawerPaperProps = useMemo(() => {
|
||||
return {
|
||||
className: "glass library-drawer",
|
||||
elevation: 6,
|
||||
};
|
||||
}, []);
|
||||
|
||||
const _handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
@@ -157,92 +122,8 @@ export const AppBar = () => {
|
||||
<UserAvatarMenu />
|
||||
</div>
|
||||
</MuiAppBar>
|
||||
<Drawer
|
||||
open={showDrawer}
|
||||
slotProps={{ paper: drawerPaperProps }}
|
||||
className="library-drawer"
|
||||
onClose={handleDrawerClose}
|
||||
>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={handleDrawerClose}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">menu_open</span>
|
||||
Close
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Divider variant="middle" />
|
||||
<List>
|
||||
<ListItemLink
|
||||
className="library-drawer-item"
|
||||
to="/home"
|
||||
icon="home"
|
||||
primary="Home"
|
||||
/>
|
||||
{libraries.isSuccess &&
|
||||
libraries.data?.Items?.map((library) => (
|
||||
<ListItemLink
|
||||
className="library-drawer-item"
|
||||
key={library.Id}
|
||||
to="/library/$id"
|
||||
params={{ id: library.Id ?? "" }}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
<Divider variant="middle" />
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemLink
|
||||
to="/settings"
|
||||
icon="settings"
|
||||
primary="Settings"
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
/>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
disabled
|
||||
>
|
||||
<span className="material-symbols-rounded">dns</span>
|
||||
Change Server
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
<ListItem>
|
||||
<ListItemButton
|
||||
onClick={() => {
|
||||
setSettingsDialogOpen(true);
|
||||
setSettingsTabValue(10);
|
||||
}}
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
}}
|
||||
>
|
||||
<span className="material-symbols-rounded">info</span>
|
||||
About
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
</Drawer>
|
||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,107 @@
|
||||
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useMemo } from "react";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import ListItemLink from "../listItemLink";
|
||||
import { getTypeIcon } from "../utils/iconsCollection";
|
||||
|
||||
interface NavigationDrawerProps {
|
||||
open: boolean;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
export const NavigationDrawer = ({ open, onClose }: NavigationDrawerProps) => {
|
||||
const api = useApiInContext((s) => s.api);
|
||||
const [user] = useCentralStore((s) => [s.currentUser]);
|
||||
|
||||
const libraries = useQuery({
|
||||
queryKey: ["libraries"],
|
||||
queryFn: async () => {
|
||||
if (!user?.Id || !api?.accessToken) {
|
||||
return;
|
||||
}
|
||||
const libs = await getUserViewsApi(api).getUserViews({
|
||||
userId: user.Id,
|
||||
});
|
||||
return libs.data;
|
||||
},
|
||||
enabled: !!user?.Id && !!api?.accessToken,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
const drawerPaperProps = useMemo(() => {
|
||||
return {
|
||||
className: "glass library-drawer",
|
||||
elevation: 6,
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
open={open}
|
||||
slotProps={{ paper: drawerPaperProps }}
|
||||
className="library-drawer"
|
||||
onClose={onClose}
|
||||
>
|
||||
<List>
|
||||
<ListItem>
|
||||
<ListItemButton onClick={onClose}>
|
||||
<span className="material-symbols-rounded">menu_open</span>
|
||||
<div style={{ marginLeft: "8px" }}>Close</div>
|
||||
</ListItemButton>
|
||||
</ListItem>
|
||||
</List>
|
||||
<Divider variant="middle" />
|
||||
<List>
|
||||
<ListItemLink
|
||||
className="library-drawer-item"
|
||||
to="/home"
|
||||
icon="home"
|
||||
primary="Home"
|
||||
onClick={onClose}
|
||||
/>
|
||||
{libraries.isSuccess &&
|
||||
libraries.data?.Items?.map((library) => (
|
||||
<ListItemLink
|
||||
className="library-drawer-item"
|
||||
key={library.Id}
|
||||
to="/library/$id"
|
||||
params={{ id: library.Id ?? "" }}
|
||||
icon={
|
||||
library.CollectionType &&
|
||||
getTypeIcon(library.CollectionType)
|
||||
}
|
||||
primary={library.Name ?? "Library"}
|
||||
onClick={onClose}
|
||||
/>
|
||||
))}
|
||||
</List>
|
||||
<Divider variant="middle" />
|
||||
<List>
|
||||
<ListItemLink
|
||||
to="/settings/preferences"
|
||||
icon="settings"
|
||||
primary="Settings"
|
||||
className="library-drawer-item"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<ListItemLink
|
||||
to="/settings/changeServer"
|
||||
icon="dns"
|
||||
primary="Change Server"
|
||||
className="library-drawer-item"
|
||||
onClick={onClose}
|
||||
/>
|
||||
<ListItemLink
|
||||
to="/settings/about"
|
||||
icon="info"
|
||||
primary="About"
|
||||
className="library-drawer-item"
|
||||
onClick={onClose}
|
||||
/>
|
||||
</List>
|
||||
</Drawer>
|
||||
);
|
||||
};
|
||||
@@ -13,17 +13,18 @@ import {
|
||||
import { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { getRouteApi, useNavigate } from "@tanstack/react-router";
|
||||
import type { ChangeEvent } from "react";
|
||||
import React, { useCallback, useEffect, useMemo } from "react";
|
||||
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useShallow } from "zustand/shallow";
|
||||
import { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library";
|
||||
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 { NavigationDrawer } from "../appBar/navigationDrawer";
|
||||
import BackButton from "../buttons/backButton";
|
||||
import { FiltersDialogTrigger } from "../filtersDialog";
|
||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||
import "./libraryHeader.scss";
|
||||
|
||||
const route = getRouteApi("/_api/library/$id");
|
||||
|
||||
@@ -244,143 +245,156 @@ export const LibraryHeader = () => {
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
|
||||
const handleDrawerClose = useCallback(() => {
|
||||
setShowDrawer(false);
|
||||
}, []);
|
||||
|
||||
const handleDrawerOpen = useCallback(() => {
|
||||
setShowDrawer(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AppBar
|
||||
className={
|
||||
scrollTrigger
|
||||
? "library-header scrolling flex flex-row"
|
||||
: "library-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>
|
||||
<MemoizeBackButton />
|
||||
<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" }}
|
||||
<>
|
||||
<AppBar
|
||||
className={
|
||||
scrollTrigger
|
||||
? "library-header scrolling flex flex-row"
|
||||
: "library-header flex flex-row"
|
||||
}
|
||||
style={appBarStyling}
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
>
|
||||
<div
|
||||
className="library-title-count flex flex-row flex-align-center"
|
||||
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
|
||||
>
|
||||
<Typography variant="subtitle1" noWrap align="center">
|
||||
{libraryName}
|
||||
</Typography>
|
||||
{typeof totalCount === "number" && (
|
||||
<Chip label={totalCount} sx={{ px: 0.5, ml: 1 }} />
|
||||
)}
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<div className="material-symbols-rounded">menu</div>
|
||||
</IconButton>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<div
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
? "material-symbols-rounded fill"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
home
|
||||
</div>
|
||||
</IconButton>
|
||||
</div>
|
||||
<TextField
|
||||
select
|
||||
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}
|
||||
</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
<IconButton
|
||||
onClick={handleSortAscendingToggle}
|
||||
aria-label="Toggle sort order"
|
||||
<div
|
||||
className="flex flex-row library-header-center"
|
||||
style={{ gap: "0.6em" }}
|
||||
>
|
||||
<div
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
|
||||
className="library-title-count flex flex-row flex-align-center"
|
||||
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
|
||||
>
|
||||
<Typography variant="subtitle1" noWrap align="center">
|
||||
{libraryName}
|
||||
</Typography>
|
||||
{typeof totalCount === "number" && (
|
||||
<Chip label={totalCount} sx={{ px: 0.5, ml: 1 }} />
|
||||
)}
|
||||
</div>
|
||||
<TextField
|
||||
select
|
||||
size="small"
|
||||
value={String(normalizedViewType)}
|
||||
onChange={handleChangeViewType}
|
||||
SelectProps={{
|
||||
MenuProps: {
|
||||
PaperProps: {
|
||||
className: "glass-menu-paper",
|
||||
},
|
||||
},
|
||||
}}
|
||||
>
|
||||
sort
|
||||
</div>
|
||||
</IconButton>
|
||||
<TextField
|
||||
select
|
||||
size="small"
|
||||
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) ||
|
||||
option.compatibleCollectionTypes?.includes(
|
||||
currentLibrary.data.CollectionType as any,
|
||||
);
|
||||
if (!isCompatible) return null;
|
||||
const valueStr = Array.isArray(option.value)
|
||||
? option.value.join(",")
|
||||
: option.value;
|
||||
return (
|
||||
<MenuItem
|
||||
key={
|
||||
Array.isArray(option.value)
|
||||
? option.value.join(",")
|
||||
: option.value
|
||||
}
|
||||
value={valueStr}
|
||||
onMouseEnter={() =>
|
||||
prefetchItems(String(valueStr), sortAscending)
|
||||
}
|
||||
>
|
||||
{option.title}
|
||||
<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}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
<FiltersDialogTrigger />
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={toggleSearchDialog}>
|
||||
<div className="material-symbols-rounded">search</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<div className="material-symbols-rounded">favorite</div>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
</div>
|
||||
</AppBar>
|
||||
))}
|
||||
</TextField>
|
||||
<IconButton
|
||||
onClick={handleSortAscendingToggle}
|
||||
aria-label="Toggle sort order"
|
||||
>
|
||||
<div
|
||||
className="material-symbols-rounded"
|
||||
style={{
|
||||
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
|
||||
}}
|
||||
>
|
||||
sort
|
||||
</div>
|
||||
</IconButton>
|
||||
<TextField
|
||||
select
|
||||
size="small"
|
||||
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) ||
|
||||
option.compatibleCollectionTypes?.includes(
|
||||
currentLibrary.data.CollectionType as any,
|
||||
);
|
||||
if (!isCompatible) return null;
|
||||
const valueStr = Array.isArray(option.value)
|
||||
? option.value.join(",")
|
||||
: option.value;
|
||||
return (
|
||||
<MenuItem
|
||||
key={
|
||||
Array.isArray(option.value)
|
||||
? option.value.join(",")
|
||||
: option.value
|
||||
}
|
||||
value={valueStr}
|
||||
onMouseEnter={() =>
|
||||
prefetchItems(String(valueStr), sortAscending)
|
||||
}
|
||||
>
|
||||
{option.title}
|
||||
</MenuItem>
|
||||
);
|
||||
})}
|
||||
</TextField>
|
||||
<FiltersDialogTrigger />
|
||||
</div>
|
||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={toggleSearchDialog}>
|
||||
<div className="material-symbols-rounded">search</div>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<div className="material-symbols-rounded">favorite</div>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
</div>
|
||||
</AppBar>
|
||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -17,10 +17,8 @@ const CreatedListItemLink = forwardRef<HTMLAnchorElement, MUIListItemLinkProps>(
|
||||
(props, ref) => (
|
||||
<ListItem component="a" ref={ref} {...props}>
|
||||
<ListItemButton
|
||||
style={{
|
||||
borderRadius: "100px",
|
||||
gap: "0.85em",
|
||||
color: "white",
|
||||
sx={{
|
||||
color: "inherit",
|
||||
textDecoration: "none",
|
||||
}}
|
||||
>
|
||||
@@ -40,7 +38,7 @@ export default ListItemLink;
|
||||
|
||||
return (
|
||||
<li>
|
||||
{/* @ts-ignore /*}
|
||||
{/* @ts-expect-error /*}
|
||||
<ListItem
|
||||
component={Link}
|
||||
activeClassName="active"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
@use "../../styles/variables.scss" as *;
|
||||
|
||||
.settings {
|
||||
&-page {
|
||||
&-container {
|
||||
@@ -51,46 +53,114 @@
|
||||
|
||||
}
|
||||
&-sidebar {
|
||||
// padding-top: 4.4em !important;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
align-items: stretch;
|
||||
justify-content: flex-start;
|
||||
background: rgb(0 0 0 / 0.4);
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.12);
|
||||
// padding-top: 1em;s
|
||||
background: $clr-background-dark;
|
||||
border-right: 1px solid rgba(255, 255, 255, 0.05);
|
||||
padding: 1.5em 1em; // Reduced padding
|
||||
gap: 1em; // Reduced gap
|
||||
|
||||
&-controls {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
gap: 0.5em;
|
||||
width: 100%;
|
||||
padding: 1em;
|
||||
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;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
padding: 1em;
|
||||
flex-direction: row;
|
||||
gap: 1em;
|
||||
text-align: center;
|
||||
gap: 0.75em;
|
||||
padding: 1em; // Reduced padding
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-radius: 16px; // Slightly tighter radius
|
||||
border: 1px solid rgba(255, 255, 255, 0.05);
|
||||
transition: all 0.3s ease;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-color: rgba(255, 255, 255, 0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
&-image {
|
||||
$size: 3em;
|
||||
$size: 3.5em; // Reduced size slightly (was 4.5em)
|
||||
width: $size;
|
||||
height: $size;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
border: 3px solid rgba(0,0,0,0.2);
|
||||
box-shadow: 0 8px 16px rgba(0,0,0,0.3);
|
||||
}
|
||||
}
|
||||
&-list-item {
|
||||
width: 100%;
|
||||
.MuiButtonBase-root {
|
||||
border-radius: 5px !important;
|
||||
|
||||
&-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.25em;
|
||||
|
||||
// Section headers
|
||||
.MuiTypography-overline {
|
||||
color: rgba(255,255,255,0.4);
|
||||
font-size: 0.7rem;
|
||||
margin-top: 1em; // Reduced
|
||||
margin-bottom: 0.25em; // Reduced
|
||||
padding-left: 12px;
|
||||
}
|
||||
&.active .MuiButtonBase-root {
|
||||
--fill: 1;
|
||||
background: $clr-gradient-default;
|
||||
|
||||
&-item {
|
||||
.MuiButtonBase-root {
|
||||
border-radius: 12px !important;
|
||||
padding: 8px 12px !important; // Reduced padding
|
||||
transition: all 0.2s ease;
|
||||
color: rgba(255,255,255,0.6);
|
||||
font-weight: 500;
|
||||
|
||||
&:hover {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: rgba(255,255,255,0.9);
|
||||
}
|
||||
|
||||
.material-symbols-rounded {
|
||||
margin-right: 12px;
|
||||
opacity: 0.7;
|
||||
font-size: 20px; // Slightly smaller icons
|
||||
}
|
||||
}
|
||||
|
||||
&.active .MuiButtonBase-root {
|
||||
background: rgba($clr-accent-default, 0.1) !important;
|
||||
color: $clr-accent-default;
|
||||
font-weight: 600;
|
||||
|
||||
.material-symbols-rounded {
|
||||
opacity: 1;
|
||||
font-variation-settings: 'FILL' 1;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: 12px;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,11 +30,17 @@ function SettingsRoute() {
|
||||
<div className="settings-sidebar">
|
||||
<div className="settings-sidebar-controls">
|
||||
<BackButton />
|
||||
<IconButton onClick={handleNavigateHome}>
|
||||
<IconButton
|
||||
onClick={handleNavigateHome}
|
||||
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>
|
||||
<Divider flexItem />
|
||||
|
||||
<div className="settings-sidebar-header">
|
||||
<img
|
||||
className="settings-sidebar-header-image"
|
||||
@@ -42,21 +48,36 @@ function SettingsRoute() {
|
||||
alt="user"
|
||||
/>
|
||||
<div className="flex flex-column">
|
||||
<Typography variant="h6">{user?.Name}</Typography>
|
||||
<Typography variant="caption" style={{ opacity: 0.5 }}>
|
||||
{user?.Policy?.IsAdministrator ? "administrator" : "user"}
|
||||
<Typography variant="h6" fontWeight="bold">
|
||||
{user?.Name}
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ opacity: 0.5 }}>
|
||||
{user?.Policy?.IsAdministrator ? "Administrator" : "User"}
|
||||
</Typography>
|
||||
</div>
|
||||
</div>
|
||||
<Divider flexItem variant="middle" />
|
||||
|
||||
<List
|
||||
component="nav"
|
||||
aria-label="main mailbox folders"
|
||||
aria-label="settings navigation"
|
||||
className="settings-sidebar-list"
|
||||
style={{
|
||||
sx={{
|
||||
width: "100%",
|
||||
padding: 0,
|
||||
}}
|
||||
>
|
||||
<Typography
|
||||
variant="overline"
|
||||
sx={{
|
||||
px: 2,
|
||||
py: 1,
|
||||
opacity: 0.5,
|
||||
fontWeight: "bold",
|
||||
letterSpacing: "0.1em",
|
||||
}}
|
||||
>
|
||||
General
|
||||
</Typography>
|
||||
<ListItemLink
|
||||
to="/settings/preferences"
|
||||
icon="tune"
|
||||
@@ -69,6 +90,20 @@ function SettingsRoute() {
|
||||
primary="Servers"
|
||||
className="settings-sidebar-list-item"
|
||||
/>
|
||||
|
||||
<Typography
|
||||
variant="overline"
|
||||
sx={{
|
||||
px: 2,
|
||||
py: 1,
|
||||
mt: 2,
|
||||
opacity: 0.5,
|
||||
fontWeight: "bold",
|
||||
letterSpacing: "0.1em",
|
||||
}}
|
||||
>
|
||||
System
|
||||
</Typography>
|
||||
<ListItemLink
|
||||
to="/settings/about"
|
||||
icon="info"
|
||||
|
||||
@@ -264,6 +264,7 @@ function ChangeServerRoute() {
|
||||
border: "1px solid rgba(211, 47, 47, 0.8)",
|
||||
},
|
||||
}}
|
||||
disabled={isActive}
|
||||
>
|
||||
<span className="material-symbols-rounded">delete</span>
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user