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",
|
p: "2px 16px",
|
||||||
bgcolor: "rgba(0,0,0,0.2)",
|
bgcolor: "rgba(0,0,0,0.2)",
|
||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
border: "1px solid rgba(255,255,255,0.05)",
|
border: "1px solid",
|
||||||
|
borderColor: "rgba(255,255,255,0.05)",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
gap: 2,
|
gap: 2,
|
||||||
"&:focus-within": {
|
"&:focus-within": {
|
||||||
border: "1px solid var(--mui-palette-primary-main)",
|
borderColor: "var(--mui-palette-primary-main)",
|
||||||
bgcolor: "rgba(0,0,0,0.3)",
|
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 }}>
|
<span className="material-symbols-rounded" style={{ opacity: 0.5 }}>
|
||||||
|
|||||||
@@ -90,48 +90,98 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.library-drawer{
|
.library-drawer {
|
||||||
width: 20em;
|
// Ensure the drawer paper itself gets the styling
|
||||||
margin: 1.4em;
|
&.MuiDrawer-paper {
|
||||||
height: calc(100vh - 2.8em) !important;
|
width: 280px;
|
||||||
border-radius: 20px;
|
margin: 16px;
|
||||||
overflow-x: hidden;
|
height: calc(100% - 32px) !important; // float in the middle
|
||||||
overflow-y: auto;
|
border-radius: 24px;
|
||||||
.library-drawer-item{
|
background: rgba(20, 20, 25, 0.75); // Darker, substantial base
|
||||||
position: relative;
|
backdrop-filter: blur(24px) saturate(180%);
|
||||||
overflow: hidden;
|
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||||
border-radius: 1000px;
|
box-shadow:
|
||||||
> div::before{
|
0 24px 48px rgba(0, 0, 0, 0.4),
|
||||||
content: "";
|
0 4px 8px rgba(0, 0, 0, 0.2);
|
||||||
position: absolute;
|
overflow: hidden; // Contain scrollbars
|
||||||
top: 0;
|
}
|
||||||
left: 0;
|
|
||||||
right: 0;
|
.MuiList-root {
|
||||||
bottom: 0;
|
padding: 8px; // Reduced from 16px
|
||||||
background: transparent;
|
gap: 2px; // Reduced gap
|
||||||
transition: $transition-time-default;
|
}
|
||||||
z-index: -1;
|
|
||||||
border-radius: 100px;
|
.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{
|
// Active State
|
||||||
--fill: 1;
|
.library-drawer-item.active {
|
||||||
}
|
.MuiListItemButton-root {
|
||||||
&> div::before {
|
background: linear-gradient(90deg, rgba($clr-accent-default, 0.2), rgba($clr-accent-default, 0.05));
|
||||||
background: $clr-accent-default;
|
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 {
|
&::-webkit-scrollbar {
|
||||||
&-thumb {
|
width: 4px;
|
||||||
height: 150px;
|
}
|
||||||
max-height: 33%;
|
&::-webkit-scrollbar-track {
|
||||||
}
|
background: transparent;
|
||||||
&-track {
|
}
|
||||||
margin-top: 15px;
|
&::-webkit-scrollbar-thumb {
|
||||||
margin-bottom: 15px;
|
background: rgba(255, 255, 255, 0.1);
|
||||||
background: transparent !important;
|
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 MuiAppBar from "@mui/material/AppBar";
|
||||||
import IconButton from "@mui/material/IconButton";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||||
import { useQuery } from "@tanstack/react-query";
|
|
||||||
|
|
||||||
import { useLocation, useNavigate } from "@tanstack/react-router";
|
import { useLocation, useNavigate } from "@tanstack/react-router";
|
||||||
import React, { useCallback, useMemo, useState } from "react";
|
import React, { useCallback, useMemo, useState } from "react";
|
||||||
|
|
||||||
import "./appBar.scss";
|
import "./appBar.scss";
|
||||||
|
|
||||||
import { Divider, Drawer, List, ListItem, ListItemButton } from "@mui/material";
|
|
||||||
import { useShallow } from "zustand/shallow";
|
import { useShallow } from "zustand/shallow";
|
||||||
// removed search placeholder; library state now managed via zustand
|
// removed search placeholder; library state now managed via zustand
|
||||||
import { useApiInContext } from "@/utils/store/api";
|
import { useApiInContext } from "@/utils/store/api";
|
||||||
import { useCentralStore } from "@/utils/store/central";
|
import { useCentralStore } from "@/utils/store/central";
|
||||||
import useHeaderStore from "@/utils/store/header";
|
import useHeaderStore from "@/utils/store/header";
|
||||||
import useSearchStore from "@/utils/store/search";
|
import useSearchStore from "@/utils/store/search";
|
||||||
import {
|
|
||||||
setSettingsDialogOpen,
|
|
||||||
setSettingsTabValue,
|
|
||||||
} from "@/utils/store/settings";
|
|
||||||
import BackButton from "../buttons/backButton";
|
import BackButton from "../buttons/backButton";
|
||||||
import ListItemLink from "../listItemLink";
|
|
||||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||||
import { getTypeIcon } from "../utils/iconsCollection";
|
import { NavigationDrawer } from "./navigationDrawer";
|
||||||
|
|
||||||
const MemoizeBackButton = React.memo(BackButton);
|
const MemoizeBackButton = React.memo(BackButton);
|
||||||
|
|
||||||
@@ -39,8 +30,6 @@ const HIDDEN_PATHS = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const AppBar = () => {
|
export const AppBar = () => {
|
||||||
const api = useApiInContext((s) => s.api);
|
|
||||||
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
@@ -55,23 +44,6 @@ export const AppBar = () => {
|
|||||||
location.pathname === "/",
|
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({
|
const trigger = useScrollTrigger({
|
||||||
disableHysteresis: true,
|
disableHysteresis: true,
|
||||||
threshold: 20,
|
threshold: 20,
|
||||||
@@ -86,13 +58,6 @@ export const AppBar = () => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const drawerPaperProps = useMemo(() => {
|
|
||||||
return {
|
|
||||||
className: "glass library-drawer",
|
|
||||||
elevation: 6,
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const _handleNavigateToSearch = useCallback(
|
const _handleNavigateToSearch = useCallback(
|
||||||
() => navigate({ to: "/search", search: { query: "" } }),
|
() => navigate({ to: "/search", search: { query: "" } }),
|
||||||
[navigate],
|
[navigate],
|
||||||
@@ -157,92 +122,8 @@ export const AppBar = () => {
|
|||||||
<UserAvatarMenu />
|
<UserAvatarMenu />
|
||||||
</div>
|
</div>
|
||||||
</MuiAppBar>
|
</MuiAppBar>
|
||||||
<Drawer
|
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||||
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>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -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 { useQueryClient, useSuspenseQuery } from "@tanstack/react-query";
|
||||||
import { getRouteApi, useNavigate } from "@tanstack/react-router";
|
import { getRouteApi, useNavigate } from "@tanstack/react-router";
|
||||||
import type { ChangeEvent } from "react";
|
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 { useShallow } from "zustand/shallow";
|
||||||
import { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library";
|
import { AVAILABLE_VIEWS, SORT_BY_OPTIONS } from "@/utils/constants/library";
|
||||||
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
import { getLibraryQueryOptions } from "@/utils/queries/library";
|
||||||
// import removed: header reads name/count from Zustand slice
|
// import removed: header reads name/count from Zustand slice
|
||||||
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
import { useLibraryStateStore } from "@/utils/store/libraryState";
|
||||||
import "./libraryHeader.scss";
|
|
||||||
import useSearchStore from "@/utils/store/search";
|
import useSearchStore from "@/utils/store/search";
|
||||||
|
import { NavigationDrawer } from "../appBar/navigationDrawer";
|
||||||
import BackButton from "../buttons/backButton";
|
import BackButton from "../buttons/backButton";
|
||||||
import { FiltersDialogTrigger } from "../filtersDialog";
|
import { FiltersDialogTrigger } from "../filtersDialog";
|
||||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||||
|
import "./libraryHeader.scss";
|
||||||
|
|
||||||
const route = getRouteApi("/_api/library/$id");
|
const route = getRouteApi("/_api/library/$id");
|
||||||
|
|
||||||
@@ -244,143 +245,156 @@ export const LibraryHeader = () => {
|
|||||||
[navigate],
|
[navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [showDrawer, setShowDrawer] = useState(false);
|
||||||
|
|
||||||
|
const handleDrawerClose = useCallback(() => {
|
||||||
|
setShowDrawer(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleDrawerOpen = useCallback(() => {
|
||||||
|
setShowDrawer(true);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppBar
|
<>
|
||||||
className={
|
<AppBar
|
||||||
scrollTrigger
|
className={
|
||||||
? "library-header scrolling flex flex-row"
|
scrollTrigger
|
||||||
: "library-header flex flex-row"
|
? "library-header scrolling flex flex-row"
|
||||||
}
|
: "library-header flex flex-row"
|
||||||
style={appBarStyling}
|
}
|
||||||
elevation={0}
|
style={appBarStyling}
|
||||||
color="transparent"
|
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" }}
|
|
||||||
>
|
>
|
||||||
<div
|
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
||||||
className="library-title-count flex flex-row flex-align-center"
|
<IconButton onClick={handleDrawerOpen}>
|
||||||
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
|
<div className="material-symbols-rounded">menu</div>
|
||||||
>
|
</IconButton>
|
||||||
<Typography variant="subtitle1" noWrap align="center">
|
<MemoizeBackButton />
|
||||||
{libraryName}
|
<IconButton onClick={handleNavigateToHome}>
|
||||||
</Typography>
|
<div
|
||||||
{typeof totalCount === "number" && (
|
className={
|
||||||
<Chip label={totalCount} sx={{ px: 0.5, ml: 1 }} />
|
location.pathname === "/home"
|
||||||
)}
|
? "material-symbols-rounded fill"
|
||||||
|
: "material-symbols-rounded"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
home
|
||||||
|
</div>
|
||||||
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
<TextField
|
<div
|
||||||
select
|
className="flex flex-row library-header-center"
|
||||||
size="small"
|
style={{ gap: "0.6em" }}
|
||||||
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
|
<div
|
||||||
className="material-symbols-rounded"
|
className="library-title-count flex flex-row flex-align-center"
|
||||||
style={{
|
title={`${libraryName}${typeof totalCount === "number" ? ` · ${totalCount.toLocaleString()} items` : ""}`}
|
||||||
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
|
>
|
||||||
|
<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
|
<MenuItem disabled value="">
|
||||||
</div>
|
<Typography variant="overline" color="textSecondary">
|
||||||
</IconButton>
|
View
|
||||||
<TextField
|
</Typography>
|
||||||
select
|
</MenuItem>
|
||||||
size="small"
|
{compatibleViews.map((v) => (
|
||||||
value={normalizedSortBy}
|
<MenuItem key={String(v.value)} value={String(v.value)}>
|
||||||
onChange={handleChangeSortBy}
|
{v.title}
|
||||||
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>
|
</MenuItem>
|
||||||
);
|
))}
|
||||||
})}
|
</TextField>
|
||||||
</TextField>
|
<IconButton
|
||||||
<FiltersDialogTrigger />
|
onClick={handleSortAscendingToggle}
|
||||||
</div>
|
aria-label="Toggle sort order"
|
||||||
<div className="flex flex-row" style={{ gap: "0.6em" }}>
|
>
|
||||||
<IconButton onClick={toggleSearchDialog}>
|
<div
|
||||||
<div className="material-symbols-rounded">search</div>
|
className="material-symbols-rounded"
|
||||||
</IconButton>
|
style={{
|
||||||
<IconButton onClick={handleNavigateToFavorite}>
|
transform: sortAscending ? "rotateX(0deg)" : "rotateX(180deg)",
|
||||||
<div className="material-symbols-rounded">favorite</div>
|
}}
|
||||||
</IconButton>
|
>
|
||||||
<UserAvatarMenu />
|
sort
|
||||||
</div>
|
</div>
|
||||||
</AppBar>
|
</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) => (
|
(props, ref) => (
|
||||||
<ListItem component="a" ref={ref} {...props}>
|
<ListItem component="a" ref={ref} {...props}>
|
||||||
<ListItemButton
|
<ListItemButton
|
||||||
style={{
|
sx={{
|
||||||
borderRadius: "100px",
|
color: "inherit",
|
||||||
gap: "0.85em",
|
|
||||||
color: "white",
|
|
||||||
textDecoration: "none",
|
textDecoration: "none",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -40,7 +38,7 @@ export default ListItemLink;
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<li>
|
<li>
|
||||||
{/* @ts-ignore /*}
|
{/* @ts-expect-error /*}
|
||||||
<ListItem
|
<ListItem
|
||||||
component={Link}
|
component={Link}
|
||||||
activeClassName="active"
|
activeClassName="active"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@use "../../styles/variables.scss" as *;
|
||||||
|
|
||||||
.settings {
|
.settings {
|
||||||
&-page {
|
&-page {
|
||||||
&-container {
|
&-container {
|
||||||
@@ -51,46 +53,114 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
&-sidebar {
|
&-sidebar {
|
||||||
// padding-top: 4.4em !important;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: stretch;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
background: rgb(0 0 0 / 0.4);
|
background: $clr-background-dark;
|
||||||
border-right: 1px solid rgba(255, 255, 255, 0.12);
|
border-right: 1px solid rgba(255, 255, 255, 0.05);
|
||||||
// padding-top: 1em;s
|
padding: 1.5em 1em; // Reduced padding
|
||||||
|
gap: 1em; // Reduced gap
|
||||||
|
|
||||||
&-controls {
|
&-controls {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
justify-content: space-between;
|
||||||
gap: 0.5em;
|
padding-bottom: 0.5em; // Reduced
|
||||||
width: 100%;
|
|
||||||
padding: 1em;
|
// 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 {
|
&-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
text-align: center;
|
||||||
width: 100%;
|
gap: 0.75em;
|
||||||
padding: 1em;
|
padding: 1em; // Reduced padding
|
||||||
flex-direction: row;
|
background: rgba(255, 255, 255, 0.03);
|
||||||
gap: 1em;
|
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 {
|
&-image {
|
||||||
$size: 3em;
|
$size: 3.5em; // Reduced size slightly (was 4.5em)
|
||||||
width: $size;
|
width: $size;
|
||||||
height: $size;
|
height: $size;
|
||||||
border-radius: 50%;
|
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%;
|
&-list {
|
||||||
.MuiButtonBase-root {
|
display: flex;
|
||||||
border-radius: 5px !important;
|
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;
|
&-item {
|
||||||
background: $clr-gradient-default;
|
.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">
|
||||||
<div className="settings-sidebar-controls">
|
<div className="settings-sidebar-controls">
|
||||||
<BackButton />
|
<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>
|
<span className="material-symbols-rounded">home</span>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</div>
|
</div>
|
||||||
<Divider flexItem />
|
|
||||||
<div className="settings-sidebar-header">
|
<div className="settings-sidebar-header">
|
||||||
<img
|
<img
|
||||||
className="settings-sidebar-header-image"
|
className="settings-sidebar-header-image"
|
||||||
@@ -42,21 +48,36 @@ function SettingsRoute() {
|
|||||||
alt="user"
|
alt="user"
|
||||||
/>
|
/>
|
||||||
<div className="flex flex-column">
|
<div className="flex flex-column">
|
||||||
<Typography variant="h6">{user?.Name}</Typography>
|
<Typography variant="h6" fontWeight="bold">
|
||||||
<Typography variant="caption" style={{ opacity: 0.5 }}>
|
{user?.Name}
|
||||||
{user?.Policy?.IsAdministrator ? "administrator" : "user"}
|
</Typography>
|
||||||
|
<Typography variant="body2" sx={{ opacity: 0.5 }}>
|
||||||
|
{user?.Policy?.IsAdministrator ? "Administrator" : "User"}
|
||||||
</Typography>
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Divider flexItem variant="middle" />
|
|
||||||
<List
|
<List
|
||||||
component="nav"
|
component="nav"
|
||||||
aria-label="main mailbox folders"
|
aria-label="settings navigation"
|
||||||
className="settings-sidebar-list"
|
className="settings-sidebar-list"
|
||||||
style={{
|
sx={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
|
padding: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Typography
|
||||||
|
variant="overline"
|
||||||
|
sx={{
|
||||||
|
px: 2,
|
||||||
|
py: 1,
|
||||||
|
opacity: 0.5,
|
||||||
|
fontWeight: "bold",
|
||||||
|
letterSpacing: "0.1em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
General
|
||||||
|
</Typography>
|
||||||
<ListItemLink
|
<ListItemLink
|
||||||
to="/settings/preferences"
|
to="/settings/preferences"
|
||||||
icon="tune"
|
icon="tune"
|
||||||
@@ -69,6 +90,20 @@ function SettingsRoute() {
|
|||||||
primary="Servers"
|
primary="Servers"
|
||||||
className="settings-sidebar-list-item"
|
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
|
<ListItemLink
|
||||||
to="/settings/about"
|
to="/settings/about"
|
||||||
icon="info"
|
icon="info"
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ function ChangeServerRoute() {
|
|||||||
border: "1px solid rgba(211, 47, 47, 0.8)",
|
border: "1px solid rgba(211, 47, 47, 0.8)",
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
disabled={isActive}
|
||||||
>
|
>
|
||||||
<span className="material-symbols-rounded">delete</span>
|
<span className="material-symbols-rounded">delete</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in new issue
Block a user