Start working on new appBar
This commit is contained in:
9 files changed
+244
-30
No files matched your search
+1
-1
@@ -456,7 +456,7 @@ function App() {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CssBaseline />
|
<CssBaseline />
|
||||||
<SideMenu />
|
{/* <SideMenu /> */}
|
||||||
<AppBar />
|
<AppBar />
|
||||||
<AudioPlayer key={audioPlayerVisible} />
|
<AudioPlayer key={audioPlayerVisible} />
|
||||||
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
<ErrorBoundary FallbackComponent={ErrorNotice}>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
|
|
||||||
import { relaunch } from "@tauri-apps/api/process";
|
import { relaunch } from "@tauri-apps/api/process";
|
||||||
|
|
||||||
@@ -11,12 +11,16 @@ import ListItemIcon from "@mui/material/ListItemIcon";
|
|||||||
import Menu from "@mui/material/Menu";
|
import Menu from "@mui/material/Menu";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||||
|
import Typography from "@mui/material/Typography";
|
||||||
|
import Popper from "@mui/material/Popper";
|
||||||
|
|
||||||
import { red } from "@mui/material/colors";
|
import { red } from "@mui/material/colors";
|
||||||
|
|
||||||
import { useLocation, useNavigate } from "react-router-dom";
|
import { useLocation, useNavigate, NavLink } from "react-router-dom";
|
||||||
|
|
||||||
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
|
||||||
|
import { getUserViewsApi } from "@jellyfin/sdk/lib/utils/api/user-views-api";
|
||||||
|
|
||||||
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
import "./appBar.module.scss";
|
import "./appBar.module.scss";
|
||||||
@@ -35,6 +39,10 @@ import { MdiLogoutVariant } from "../icons/mdiLogoutVariant";
|
|||||||
import { EventEmitter as event } from "../../eventEmitter";
|
import { EventEmitter as event } from "../../eventEmitter";
|
||||||
import { useApi } from "../../utils/store/api";
|
import { useApi } from "../../utils/store/api";
|
||||||
|
|
||||||
|
import { getTypeIcon } from "../../components/utils/iconsCollection";
|
||||||
|
|
||||||
|
import logo from "../../assets/logo.svg";
|
||||||
|
|
||||||
export const AppBar = () => {
|
export const AppBar = () => {
|
||||||
const [api] = useApi((state) => [state.api]);
|
const [api] = useApi((state) => [state.api]);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@@ -53,6 +61,17 @@ export const AppBar = () => {
|
|||||||
enabled: display,
|
enabled: display,
|
||||||
networkMode: "always",
|
networkMode: "always",
|
||||||
});
|
});
|
||||||
|
let libraries = useQuery({
|
||||||
|
queryKey: ["libraries"],
|
||||||
|
queryFn: async () => {
|
||||||
|
let libs = await getUserViewsApi(api).getUserViews({
|
||||||
|
userId: user.data.Id,
|
||||||
|
});
|
||||||
|
return libs.data;
|
||||||
|
},
|
||||||
|
enabled: !!user.data,
|
||||||
|
networkMode: "always",
|
||||||
|
});
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (user.isError) {
|
if (user.isError) {
|
||||||
console.error(user.error);
|
console.error(user.error);
|
||||||
@@ -91,6 +110,20 @@ export const AppBar = () => {
|
|||||||
navigate("/login/index");
|
navigate("/login/index");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const [librariesPopover, setLibrariesPopover] = useState(false);
|
||||||
|
const librariesText = useRef(null);
|
||||||
|
const popoverEnter = (event) => {
|
||||||
|
if (anchorEl !== event.currentTarget) {
|
||||||
|
setLibrariesPopover(event.currentTarget);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const popoverLeave = () => {
|
||||||
|
setLibrariesPopover(null);
|
||||||
|
};
|
||||||
|
|
||||||
|
const [isBrowsingLibrary, setIsBrowsingLibrary] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (
|
||||||
location.pathname.includes("login") ||
|
location.pathname.includes("login") ||
|
||||||
@@ -104,14 +137,18 @@ export const AppBar = () => {
|
|||||||
} else {
|
} else {
|
||||||
setDisplay(true);
|
setDisplay(true);
|
||||||
}
|
}
|
||||||
}, [location]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (location.pathname == "/home") {
|
if (location.pathname == "/home") {
|
||||||
setBackButtonVisible(false);
|
setBackButtonVisible(false);
|
||||||
} else {
|
} else {
|
||||||
setBackButtonVisible(true);
|
setBackButtonVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (location.pathname.includes("library")) {
|
||||||
|
setIsBrowsingLibrary(true);
|
||||||
|
} else {
|
||||||
|
setIsBrowsingLibrary(false);
|
||||||
|
}
|
||||||
}, [location]);
|
}, [location]);
|
||||||
|
|
||||||
if (!display) {
|
if (!display) {
|
||||||
@@ -123,28 +160,125 @@ export const AppBar = () => {
|
|||||||
style={{
|
style={{
|
||||||
backgroundColor: "transparent",
|
backgroundColor: "transparent",
|
||||||
paddingRight: "0 !important",
|
paddingRight: "0 !important",
|
||||||
width: "fit-content",
|
|
||||||
}}
|
}}
|
||||||
className={trigger ? "appBar backdropVisible" : "appBar"}
|
className={trigger ? "appBar backdropVisible" : "appBar"}
|
||||||
elevation={0}
|
elevation={0}
|
||||||
>
|
>
|
||||||
<Toolbar
|
<Toolbar
|
||||||
sx={{
|
sx={{
|
||||||
justifyContent: "space-between",
|
display: "grid",
|
||||||
padding: "13px !important",
|
gap: "0.6em",
|
||||||
display: "flex",
|
gridTemplateColumns: "30% 1fr 30%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="flex flex-row flex-center"
|
||||||
|
style={{
|
||||||
gap: "1.2em",
|
gap: "1.2em",
|
||||||
|
justifySelf: "start",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => navigate(-1)}
|
onClick={() => navigate(-1)}
|
||||||
disabled={!backButtonVisible}
|
disabled={!backButtonVisible}
|
||||||
|
style={{
|
||||||
|
justifySelf: "left",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div className="material-symbols-rounded">
|
<div className="material-symbols-rounded">
|
||||||
arrow_back
|
arrow_back
|
||||||
</div>
|
</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
<img src={logo} className="appBar-logo" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="flex flex-row flex-center"
|
||||||
|
style={{
|
||||||
|
gap: "2.6em",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<NavLink to="/home" className="appBar-text">
|
||||||
|
<Typography variant="subtitle1">
|
||||||
|
Home
|
||||||
|
</Typography>
|
||||||
|
</NavLink>
|
||||||
|
<Typography
|
||||||
|
ref={librariesText}
|
||||||
|
variant="subtitle1"
|
||||||
|
className={
|
||||||
|
isBrowsingLibrary
|
||||||
|
? "appBar-text active"
|
||||||
|
: "appBar-text"
|
||||||
|
}
|
||||||
|
onMouseEnter={popoverEnter}
|
||||||
|
// onMouseLeave={popoverLeave}
|
||||||
|
>
|
||||||
|
Libraries
|
||||||
|
</Typography>
|
||||||
|
<Menu
|
||||||
|
open={Boolean(librariesPopover)}
|
||||||
|
anchorEl={librariesPopover}
|
||||||
|
// anchorOrigin={{
|
||||||
|
// vertical: "bottom",
|
||||||
|
// horizontal: "right",
|
||||||
|
// }}
|
||||||
|
// transformOrigin={{
|
||||||
|
// vertical: "top",
|
||||||
|
// horizontal: "left",
|
||||||
|
// }}
|
||||||
|
// slotProps={{
|
||||||
|
// paper: {
|
||||||
|
// onMouseEnter: popoverEnter,
|
||||||
|
// onMouseLeave: popoverLeave,
|
||||||
|
// },
|
||||||
|
// }}
|
||||||
|
anchorOrigin={{
|
||||||
|
horizontal: "center",
|
||||||
|
vertical: "bottom",
|
||||||
|
}}
|
||||||
|
transformOrigin={{
|
||||||
|
horizontal: "center",
|
||||||
|
vertical: "top",
|
||||||
|
}}
|
||||||
|
sx={{
|
||||||
|
mt: 3,
|
||||||
|
maxHeight: "72em",
|
||||||
|
}}
|
||||||
|
onClose={popoverLeave}
|
||||||
|
MenuListProps={{
|
||||||
|
onMouseLeave: popoverLeave,
|
||||||
|
}}
|
||||||
|
disableScrollLock
|
||||||
|
>
|
||||||
|
{libraries.isPending
|
||||||
|
? "loading..."
|
||||||
|
: libraries.data.Items.map(
|
||||||
|
(library) => (
|
||||||
|
<MenuItem
|
||||||
|
key={library.Id}
|
||||||
|
onClick={() =>
|
||||||
|
navigate(
|
||||||
|
`/library/${library.Id}`,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<ListItemIcon>
|
||||||
|
{getTypeIcon(
|
||||||
|
library.CollectionType,
|
||||||
|
)}
|
||||||
|
</ListItemIcon>
|
||||||
|
{library.Name}
|
||||||
|
</MenuItem>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</Menu>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className="flex flex-row"
|
||||||
|
style={{ justifySelf: "right", gap: "0.6em" }}
|
||||||
|
>
|
||||||
<IconButton onClick={() => navigate("/search")}>
|
<IconButton onClick={() => navigate("/search")}>
|
||||||
<div className="material-symbols-rounded">
|
<div className="material-symbols-rounded">
|
||||||
search
|
search
|
||||||
@@ -155,9 +289,13 @@ export const AppBar = () => {
|
|||||||
favorite
|
favorite
|
||||||
</div>
|
</div>
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton sx={{ p: 0 }} onClick={handleMenuOpen}>
|
<IconButton
|
||||||
|
sx={{ p: 0 }}
|
||||||
|
onClick={handleMenuOpen}
|
||||||
|
>
|
||||||
{user.isSuccess &&
|
{user.isSuccess &&
|
||||||
(user.data.PrimaryImageTag == undefined ? (
|
(user.data.PrimaryImageTag ==
|
||||||
|
undefined ? (
|
||||||
<Avatar
|
<Avatar
|
||||||
className="appBar-avatar"
|
className="appBar-avatar"
|
||||||
alt={user.data.Name}
|
alt={user.data.Name}
|
||||||
@@ -183,7 +321,7 @@ export const AppBar = () => {
|
|||||||
anchorEl={anchorEl}
|
anchorEl={anchorEl}
|
||||||
open={openMenu}
|
open={openMenu}
|
||||||
onClose={handleMenuClose}
|
onClose={handleMenuClose}
|
||||||
sx={{ mt: 1 }}
|
sx={{ mt: 2 }}
|
||||||
disableScrollLock
|
disableScrollLock
|
||||||
>
|
>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
@@ -226,6 +364,7 @@ export const AppBar = () => {
|
|||||||
Select Server
|
Select Server
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
|
</div>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
</MuiAppBar>
|
</MuiAppBar>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
/** @format */
|
/** @format */
|
||||||
|
|
||||||
.appBar {
|
.appBar {
|
||||||
top: 8px !important;
|
|
||||||
right: 8px !important;
|
|
||||||
border-radius: 10000px;
|
|
||||||
transition: background-color $transition-time-fast,
|
transition: background-color $transition-time-fast,
|
||||||
backdrop-filter $transition-time-fast,
|
backdrop-filter $transition-time-fast,
|
||||||
box-shadow $transition-time-default !important;
|
box-shadow $transition-time-default !important;
|
||||||
@@ -20,6 +17,49 @@
|
|||||||
&-logo {
|
&-logo {
|
||||||
height: 1.8em !important;
|
height: 1.8em !important;
|
||||||
}
|
}
|
||||||
|
&-text {
|
||||||
|
cursor: default;
|
||||||
|
opacity: 0.7;
|
||||||
|
transition: opacity $transition-time-fast;
|
||||||
|
position: relative;
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
&::after {
|
||||||
|
content: "";
|
||||||
|
width: 100%;
|
||||||
|
height: 1.2px;
|
||||||
|
background: white;
|
||||||
|
opacity: 0.7;
|
||||||
|
position: absolute;
|
||||||
|
bottom: -2.6px;
|
||||||
|
left: 0;
|
||||||
|
transform: scaleX(0);
|
||||||
|
transition: transform $transition-time-fast,
|
||||||
|
background $transition-time-fast,
|
||||||
|
opacity $transition-time-fast;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
opacity: 0.8;
|
||||||
|
&::after {
|
||||||
|
transform: scaleX(0.5);
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&.active {
|
||||||
|
opacity: 1;
|
||||||
|
color: $clr-accent-default;
|
||||||
|
&::after {
|
||||||
|
transform: scaleX(0.75);
|
||||||
|
opacity: 1;
|
||||||
|
background: $clr-accent-default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
&-logo {
|
||||||
|
width: 20em;
|
||||||
|
object-fit: contain;
|
||||||
|
object-position: center;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.appLoading {
|
.appLoading {
|
||||||
|
|||||||
@@ -32,23 +32,29 @@ export const CardScroller = ({
|
|||||||
partialVisibilityGutter: 40,
|
partialVisibilityGutter: 40,
|
||||||
},
|
},
|
||||||
desktop: {
|
desktop: {
|
||||||
breakpoint: { max: 3000, min: 625 },
|
breakpoint: { max: 3000, min: 925 },
|
||||||
items: displayCards,
|
items: displayCards,
|
||||||
slidesToSlide: displayCards, // optional, default to 1.
|
slidesToSlide: displayCards, // optional, default to 1.
|
||||||
partialVisibilityGutter: 30,
|
partialVisibilityGutter: 30,
|
||||||
},
|
},
|
||||||
tablet: {
|
tablet: {
|
||||||
breakpoint: { max: 624, min: 464 },
|
breakpoint: { max: 925, min: 600 },
|
||||||
items: displayCards - 2,
|
items: displayCards - 3,
|
||||||
slidesToSlide: displayCards - 2, // optional, default to 1.
|
slidesToSlide: displayCards - 3, // optional, default to 1.
|
||||||
partialVisibilityGutter: 20,
|
partialVisibilityGutter: 20,
|
||||||
},
|
},
|
||||||
mobile: {
|
mobile: {
|
||||||
breakpoint: { max: 464, min: 0 },
|
breakpoint: { max: 600, min: 424 },
|
||||||
items: displayCards - 5,
|
items: displayCards - 5,
|
||||||
slidesToSlide: displayCards - 5, // optional, default to 1.
|
slidesToSlide: displayCards - 5, // optional, default to 1.
|
||||||
partialVisibilityGutter: 10,
|
partialVisibilityGutter: 10,
|
||||||
},
|
},
|
||||||
|
smallScreen: {
|
||||||
|
breakpoint: { max: 424, min: 0 },
|
||||||
|
items: 1,
|
||||||
|
slidesToSlide: 1, // optional, default to 1.
|
||||||
|
partialVisibilityGutter: 10,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [carouselRef, setCarouselRef] = useState();
|
const [carouselRef, setCarouselRef] = useState();
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { getTypeIcon } from "../../components/utils/iconsCollection.jsx";
|
|||||||
import "./sidemenu.module.scss";
|
import "./sidemenu.module.scss";
|
||||||
import { useApi } from "../../utils/store/api";
|
import { useApi } from "../../utils/store/api";
|
||||||
|
|
||||||
import Icon from "../../assets/icon.png";
|
import Icon from "../../assets/icon.svg";
|
||||||
|
|
||||||
const DrawerHeader = styled("div")(({ theme }) => ({
|
const DrawerHeader = styled("div")(({ theme }) => ({
|
||||||
display: "flex",
|
display: "flex",
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ const LibraryView = () => {
|
|||||||
);
|
);
|
||||||
} else if (currentLib.isSuccess) {
|
} else if (currentLib.isSuccess) {
|
||||||
return (
|
return (
|
||||||
<main className="scrollY library">
|
<main className="scrollY library padded-top">
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
padding: "1em 1em 1em 0.6em",
|
padding: "1em 1em 1em 0.6em",
|
||||||
@@ -378,7 +378,7 @@ const LibraryView = () => {
|
|||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
justifyContent: "center",
|
justifyContent: "flex-start",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@@ -386,6 +386,7 @@ const LibraryView = () => {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
width: "fit-content",
|
width: "fit-content",
|
||||||
|
padding: "0 1em",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography
|
||||||
|
|||||||
@@ -36,7 +36,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.library {
|
.library {
|
||||||
padding: 0 !important;
|
padding-left: 0 !important;
|
||||||
|
padding-right: 0 !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -48,12 +49,10 @@
|
|||||||
align-items: start;
|
align-items: start;
|
||||||
}
|
}
|
||||||
&-items {
|
&-items {
|
||||||
height: calc(100vh - 4em);
|
height: calc(100vh - 8.4em);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
padding-bottom: 1em;
|
padding: 1.5em 1em;
|
||||||
padding-right: 1em;
|
|
||||||
padding-top: 4.5em;
|
|
||||||
&-header {
|
&-header {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 4.4em;
|
top: 4.4em;
|
||||||
|
|||||||
+15
-2
@@ -122,8 +122,10 @@ h1 {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding-left: 1em;
|
padding: 0 1.2em;
|
||||||
padding-right: calc(1em + 14px);
|
&.padded-top {
|
||||||
|
padding-top: 4.4em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.home {
|
.home {
|
||||||
@@ -199,3 +201,14 @@ h1 {
|
|||||||
transform: translate(-50%, -50%) scale(4);
|
transform: translate(-50%, -50%) scale(4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flex {
|
||||||
|
display: flex;
|
||||||
|
&-row {
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
&-center {
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,5 +49,21 @@ export const theme = createTheme({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MuiPaper: {
|
||||||
|
styleOverrides: {
|
||||||
|
root: {},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
MuiMenu: {
|
||||||
|
styleOverrides: {
|
||||||
|
paper: {
|
||||||
|
borderRadius: "10px",
|
||||||
|
// boxShadow: "0 0 5px hsl(273, 100%, 36%)",
|
||||||
|
background: "hsl(256, 100%, 2%, 40%)",
|
||||||
|
backdropFilter: "blur(20px)",
|
||||||
|
// border: "1.8px solid hsl(273, 100%, 36%)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user