This commit is contained in:
prayag17 committed 2023-06-10 11:17:44 +05:30
commit 458890ba35
10 files changed
+287 -225

No files matched your search

+49 -7
View File
@@ -40,7 +40,7 @@ import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle";
import Button from "@mui/material/Button";
import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import Stack from "@mui/material/Stack";
// Routes
import { ServerSetup, ServerList } from "./routes/setup/server";
@@ -72,6 +72,9 @@ import { delServer, getServer } from "./utils/storage/servers.js";
import { delUser, getUser } from "./utils/storage/user.js";
import axios from "axios";
import { Blurhash } from "react-blurhash";
import zIndex from "@mui/material/styles/zIndex.js";
import { useBackdropStore } from "./utils/store/backdrop.js";
const jellyfin = new Jellyfin({
clientInfo: {
@@ -121,6 +124,9 @@ const AnimationWrapper = () => {
transition={{
duration: 0.35,
}}
style={{
width: "100%",
}}
>
<Outlet />
</motion.div>
@@ -278,9 +284,33 @@ function App() {
appWindow.setFullscreen(false);
}, [location]);
const [hash] = useBackdropStore((state) => [state.hash]);
return (
<SnackbarProvider maxSnack={5}>
<ThemeProvider theme={theme}>
<Box
className="appBackdrop"
sx={{
position: "fixed",
top: 0,
left: 0,
right: 0,
bottom: 0,
zIndex: "-1",
opacity: 0.25,
}}
>
<Blurhash
hash={hash}
width={1920}
height={1080}
style={{
width: "100%",
height: "100%",
}}
/>
</Box>
<Kon resetDelay={1000} action={sixtyNine}></Kon>
<Dialog
open={easterEgg}
@@ -323,11 +353,23 @@ function App() {
</Button>
</DialogActions>
</Dialog>
<AnimatePresence>
<div style={{ display: "flex" }}>
<CssBaseline />
<SideMenu />
<AppBar />
<Box className="scrollContainer">
<Stack
direction="row"
width="100vw"
height="100%"
sx={{
overflow: "hidden",
position: "absolute",
top: 0,
right: 0,
bottom: 0,
left: 0,
}}
>
<SideMenu />
<Routes
key={location.pathname}
location={location}
@@ -395,9 +437,9 @@ function App() {
/>
</Route>
</Routes>
</div>
</AnimatePresence>
<ReactQueryDevtools />
</Stack>
</Box>
<ReactQueryDevtools position="bottom-right" />
</ThemeProvider>
</SnackbarProvider>
);
+1 -1
View File
@@ -87,11 +87,11 @@ export const AppBar = () => {
return (
<MuiAppBar
sx={{
width: `calc(100vw - ${theme.spacing(7)})`,
backgroundColor: "transparent",
}}
className={trigger ? "appBar backdropVisible" : "appBar"}
elevation={0}
position="static"
>
<Toolbar sx={{ justifyContent: "space-between" }}>
<Box
+4 -25
View File
@@ -113,39 +113,18 @@ export const SideMenu = ({}) => {
open={false}
PaperProps={{
sx: {
backgroundColor: "inherit",
backgroundColor: "transparent",
border: "none",
width: `calc(${theme.spacing(7)} + 10px)`,
height: "100vh",
// display: visible ? "block" : "none",
height: "100%",
position: "inherit",
},
}}
sx={{
width: `calc(${theme.spacing(7)} + 10px)`,
background: theme.palette.background.paper,
background: "transparent",
}}
>
<DrawerHeader
className="Mui-DrawerHeader"
sx={{
justifyContent: "center",
}}
>
{/* <div>
<Avatar src={""}/>
<Typography variant="h3">
{user["Name"]}
</Typography>
</div> */}
<IconButton
color="inherit"
aria-label="open drawer"
onClick={handleDrawerOpen}
>
<MdiMenu />
</IconButton>
</DrawerHeader>
<Divider />
{libraries.isLoading ? (
<>
<Skeleton
-3
View File
@@ -38,9 +38,6 @@ const About = () => {
className="scrollY"
sx={{
flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative",
}}
>
-3
View File
@@ -204,9 +204,6 @@ const Home = () => {
className="scrollY"
sx={{
flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative",
}}
>
+137 -101
View File
@@ -66,6 +66,7 @@ import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
import { MdiMusic } from "../../components/icons/mdiMusic";
import { usePlaybackStore } from "../../utils/store/playback";
import { useBackdropStore } from "../../utils/store/backdrop";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -518,8 +519,12 @@ const ItemDetail = () => {
state.setDuration,
state.setItemId,
state.setItemName,
state.setItemName,
,
]);
const [setHash] = useBackdropStore((state) => [state.setHash]);
const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]);
useEffect(() => {
@@ -532,9 +537,31 @@ const ItemDetail = () => {
(itm) => itm.Type == "Writer",
);
setWriters(writeTp);
if (!!item.data.ParentBackdropImageTags) {
setHash(
item.data.ImageBlurHashes.Backdrop[
item.data.ParentBackdropImageTags[0]
],
);
} else if (item.data.BackdropImageTags.length != 0) {
setHash(
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
],
);
} else {
setHash("LGJCbc|t1s1}1{JU|y,uAo=3,s$Q");
}
}
}, [item.isSuccess]);
const [crew, setCrew] = useState([]);
useEffect(() => {
setCrew(directors.concat(...writers));
}, [writers, directors]);
if (item.isLoading || similarItems.isLoading) {
return (
<Box
@@ -553,54 +580,12 @@ const ItemDetail = () => {
if (item.isSuccess && similarItems.isSuccess) {
return (
<>
<Box className="item-detail-backdrop">
{item.data.BackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data.BackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={14}
resolutionY={22}
style={{
aspectRatio: "0.666",
}}
punch={1}
className="item-detail-image-blurhash"
/>
)}
{!!item.data.ParentBackdropImageTags &&
item.data.ParentBackdropImageTags.length != 0 && (
<Blurhash
hash={
item.data.ImageBlurHashes.Backdrop[
item.data
.ParentBackdropImageTags[0]
]
}
width="100%"
height="100%"
resolutionX={14}
resolutionY={22}
style={{
aspectRatio: "0.666",
}}
punch={1}
className="item-detail-image-blurhash"
/>
)}
</Box>
<Box
recomponent="main"
className="scrollY"
sx={{
display: "flex",
pt: 11,
px: 3,
pb: 3,
display: "flex",
position: "relative",
flexFlow: "column",
}}
@@ -608,15 +593,9 @@ const ItemDetail = () => {
<Box
className="item-detail-header"
mb={2}
paddingTop={
item.data.Type.includes("Music") ||
item.data.Type === BaseItemKind.Episode ||
!!item.data.PrimaryImageAspectRatio
? 10
: 0
}
paddingTop={5}
>
<Box className="item-detail-header-backdrop">
{/* <Box className="item-detail-header-backdrop">
{item.data.Type != BaseItemKind.MusicAlbum &&
item.data.Type != BaseItemKind.Episode
? item.data.BackdropImageTags.length !=
@@ -691,7 +670,7 @@ const ItemDetail = () => {
>
{TypeIconCollectionCard[item.data.Type]}
</Box>
</Box>
</Box> */}
<Box
className="item-detail-info-container"
@@ -703,7 +682,7 @@ const ItemDetail = () => {
item.data.Type ===
BaseItemKind.Episode
? "center !important"
: "flex-end",
: "flex-start",
justifyContent: "flex-start",
width: "100%",
}}
@@ -788,6 +767,12 @@ const ItemDetail = () => {
}
</div>
</Box>
<Stack
direction="column"
alignItems="flex-start"
gap={2}
mt={2}
>
<Box
sx={{
display: "flex",
@@ -801,7 +786,9 @@ const ItemDetail = () => {
{item.data.Type ===
BaseItemKind.Episode && (
<Link
component={RouterLink}
component={
RouterLink
}
to={`/item/${item.data.SeriesId}`}
variant="h3"
textOverflow="ellipsis"
@@ -818,7 +805,8 @@ const ItemDetail = () => {
src={`${window.api.basePath}/Items/${item.data.SeriesId}/Images/Logo?cropWhitespace=True&quality=80&tag=${item.data.ParentLogoImageTag}`}
/>
) : (
item.data.SeriesName
item.data
.SeriesName
)}
</Link>
)}
@@ -829,7 +817,9 @@ const ItemDetail = () => {
textOverflow="ellipsis"
whiteSpace="nowrap"
width="100%"
sx={{ opacity: 0.7 }}
sx={{
opacity: 0.7,
}}
>
{`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`}
</Typography>
@@ -840,7 +830,8 @@ const ItemDetail = () => {
whiteSpace="nowrap"
width="100%"
>
{!!item.data.ImageTags
{!!item.data
.ImageTags
.Logo ? (
<img
className="item-detail-title-logo"
@@ -853,7 +844,9 @@ const ItemDetail = () => {
)}
<Typography
variant="h6"
sx={{ opacity: 0.7 }}
sx={{
opacity: 0.7,
}}
>
{item.data.OriginalTitle}
</Typography>
@@ -912,10 +905,14 @@ const ItemDetail = () => {
width: "100%",
}}
>
{item.data.Type != "MusicArtist" &&
item.data.ProductionYear && (
{item.data.Type !=
"MusicArtist" &&
item.data
.ProductionYear && (
<Typography
sx={{ flexGrow: 0 }}
sx={{
flexGrow: 0,
}}
variant="subtitle1"
>
{
@@ -931,7 +928,8 @@ const ItemDetail = () => {
label={
!!item.data
.OfficialRating
? item.data
? item
.data
.OfficialRating
: "Not Rated"
}
@@ -962,12 +960,14 @@ const ItemDetail = () => {
.data
.CommunityRating *
10,
) / 10}
) /
10}
</Typography>
</>
) : (
<Typography variant="subtitle1">
No Community
No
Community
Rating
</Typography>
)}
@@ -991,13 +991,55 @@ const ItemDetail = () => {
)}
</Stack>
</Box>
<Box
className="item-detail-tagline"
sx={{ width: "100%" }}
>
<Typography
variant="h5"
fontStyle="italic"
sx={{ opacity: 0.7 }}
>
{item.data.Taglines[0]}
</Typography>
</Box>
{item.data.Genres.length != 0 && (
<Stack direction="row" gap={1}>
{item.data.Genres.map(
(genre, index) => {
return (
<Chip
key={
index
}
variant="filled"
label={
genre
}
/>
);
},
)}
</Stack>
)}
{!!item.data.Overview && (
<Box>
<Typography
variant="body1"
sx={{
opacity: 0.8,
}}
mb={2}
>
{item.data.Overview}
</Typography>
</Box>
)}
<Stack
direction="row"
gap={1}
alignItems="center"
justifyContent="center"
ml="auto"
mr={2}
>
{item.data.Type != "Person" &&
!item.data.Type.includes(
@@ -1046,6 +1088,20 @@ const ItemDetail = () => {
.data
.RunTimeTicks,
);
if (
subtitleTracks.length !=
0
) {
// setSubtitleTracks(
// {
// kind: "subtitles",
// src: `http://localhost:8096/Videos/e2d0ae00-f458-d4d4-7e09-1768ca0f485c/e2d0ae00f458d4d47e091768ca0f485c/Subtitles/0/0/Stream.vtt?api_key=${window.api.accessToken}`,
// srcLang: "en",
// default: true,
// },
// );
setSubtitleTracks();
}
}
navigate(
`/player`,
@@ -1055,7 +1111,8 @@ const ItemDetail = () => {
{!!item.data
.UserData
.PlayedPercentage &&
item.data.UserData
item.data
.UserData
.PlayedPercentage >
0
? "Resume"
@@ -1105,34 +1162,25 @@ const ItemDetail = () => {
</>
)}
<IconButton onClick={handleLiking}>
{item.data.UserData.IsFavorite ? (
{item.data.UserData
.IsFavorite ? (
<MdiHeart
sx={{ color: pink[700] }}
sx={{
color: pink[700],
}}
/>
) : (
<MdiHeartOutline />
)}
</IconButton>
</Stack>
</Box>
<Box
className="item-detail-tagline"
sx={{ width: "100%" }}
>
<Typography
variant="h5"
fontStyle="italic"
sx={{ opacity: 0.8 }}
>
{item.data.Taglines[0]}
</Typography>
</Stack>
</Box>
</Box>
<TableContainer>
<Table>
<TableBody>
{item.data.Genres != 0 && (
{/* {item.data.Genres != 0 && (
<TableRow
sx={{
"& td, & th": {
@@ -1180,7 +1228,7 @@ const ItemDetail = () => {
</Stack>
</TableCell>
</TableRow>
)}
)} */}
{item.data.ExternalUrls.length != 0 && (
<TableRow
@@ -1716,20 +1764,6 @@ const ItemDetail = () => {
</TableBody>
</Table>
</TableContainer>
{!!item.data.Overview && (
<Box mt={3}>
<Typography variant="h5" mb={1}>
Overview
</Typography>
<Typography
variant="body1"
sx={{ opacity: 0.8 }}
mb={2}
>
{item.data.Overview}
</Typography>
</Box>
)}
{item.data.Type == BaseItemKind.MusicAlbum && (
<TableContainer
@@ -2684,7 +2718,9 @@ const ItemDetail = () => {
label={
episodes.isLoading ? (
<CircularProgress
sx={{ p: 1.5 }}
sx={{
p: 1.5,
}}
/>
) : (
episodes.data
@@ -2753,7 +2789,7 @@ const ItemDetail = () => {
duration: 0.35,
delay:
mindex *
0.1,
0.03,
}}
>
<EpisodeCard
@@ -3161,7 +3197,7 @@ const ItemDetail = () => {
variant: "h5",
fontSize: "1.8em",
}}
displayCards={8}
displayCards={12}
title="Cast"
disableDecoration
boxProps={{
+6 -6
View File
@@ -17,7 +17,7 @@
display: flex;
gap: 1em;
justify-content: flex-start;
align-items: flex-end;
align-items: flex-start;
position: relative;
flex-wrap: wrap;
&-backdrop {
@@ -30,11 +30,11 @@
left: -24px;
z-index: -2;
filter: brightness(0.6);
mask-image: linear-gradient(0deg, transparent, black 75%);
mask-image: linear-gradient(to bottom, black 75%, transparent);
-webkit-mask-image: linear-gradient(
0deg,
transparent,
black 75%
to bottom,
black 75%,
transparent
);
}
}
@@ -49,7 +49,7 @@
z-index: -1;
}
&-container {
width: 15%;
width: 20%;
flex-shrink: 0;
position: relative;
border-radius: $border-radius-default;
+65 -70
View File
@@ -452,21 +452,11 @@ const LibraryView = () => {
<Box
sx={{
display: "flex",
}}
>
<Box
component="main"
className="scrollY"
sx={{
flexGrow: 1,
pt: 19,
px: 3,
pb: 3,
position: "relative",
flexDirection: "column",
}}
>
<AppBar
position="fixed"
position="static"
elevation={trigger ? 1 : 0}
sx={{
width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
@@ -482,9 +472,7 @@ const LibraryView = () => {
>
<Divider
sx={{
transform: trigger
? "scaleX(1)"
: "scaleX(0)",
transform: trigger ? "scaleX(1)" : "scaleX(0)",
transition: "transform 150ms",
transformOrigin: "left",
transitionDelay: "50ms",
@@ -532,8 +520,7 @@ const LibraryView = () => {
>
{currentLib.isSuccess &&
allowedFilterViews.includes(
currentLib.data.Items[0]
.CollectionType,
currentLib.data.Items[0].CollectionType,
) && (
<>
<Button
@@ -545,16 +532,12 @@ const LibraryView = () => {
}
aria-haspopup="true"
aria-expanded={
open
? "true"
: undefined
open ? "true" : undefined
}
startIcon={
<MdiFilterOutline />
}
endIcon={
<MdiChevronDown />
}
endIcon={<MdiChevronDown />}
onClick={openFiltersMenu}
color="white"
// sx={{ p: 1 }}
@@ -568,9 +551,7 @@ const LibraryView = () => {
filterButtonAnchorEl
}
open={filterMenuOpen}
onClose={
closeFiltersMenu
}
onClose={closeFiltersMenu}
MenuListProps={{
"aria-labelledby":
"basic-button",
@@ -578,13 +559,11 @@ const LibraryView = () => {
}}
anchorOrigin={{
vertical: "bottom",
horizontal:
"center",
horizontal: "center",
}}
transformOrigin={{
vertical: "top",
horizontal:
"center",
horizontal: "center",
}}
sx={{
maxHeight: "55%",
@@ -657,8 +636,7 @@ const LibraryView = () => {
</AccordionDetails>
</Accordion>
{!onlyStatusFilterViews.includes(
currentLib.data
.Items[0]
currentLib.data.Items[0]
.CollectionType,
) && (
<Accordion>
@@ -729,8 +707,7 @@ const LibraryView = () => {
</Accordion>
)}
{!onlyStatusFilterViews.includes(
currentLib.data
.Items[0]
currentLib.data.Items[0]
.CollectionType,
) && (
<Accordion>
@@ -747,8 +724,7 @@ const LibraryView = () => {
}}
noWrap
>
Video
Type
Video Type
</Typography>
</AccordionSummary>
<Divider />
@@ -804,9 +780,7 @@ const LibraryView = () => {
</Menu>
</>
)}
{!disabledSortViews.includes(
currentViewType,
) && (
{!disabledSortViews.includes(currentViewType) && (
<>
{sortByData != undefined &&
sortBy != undefined && (
@@ -872,33 +846,31 @@ const LibraryView = () => {
value={currentViewType}
size="small"
variant="filled"
onChange={
handleCurrentViewType
}
onChange={handleCurrentViewType}
>
{viewType.map(
(item, index) => {
{viewType.map((item, index) => {
return (
<MenuItem
key={
item.value
}
value={
item.value
}
key={item.value}
value={item.value}
>
{
item.title
}
{item.title}
</MenuItem>
);
},
)}
})}
</TextField>
)}
</Stack>
</Toolbar>
</AppBar>
<Box
sx={{
flexGrow: 1,
position: "relative",
overflowY: "auto",
}}
>
<Box component="main" className="scrollY">
{items.isLoading || items.isFetching ? (
<Box
sx={{
@@ -926,7 +898,10 @@ const LibraryView = () => {
) : items.data.TotalRecordCount == 0 ? (
<EmptyNotice />
) : currentViewType != BaseItemKind.Audio ? (
<Grid2 container columns={{ xs: 2, sm: 4, md: 8 }}>
<Grid2
container
columns={{ xs: 2, sm: 4, md: 8 }}
>
{items.data.Items.map((item, index) => {
return (
<Grid2
@@ -953,7 +928,8 @@ const LibraryView = () => {
itemName={item.Name}
itemId={item.Id}
imageTags={
!!item.ImageTags.Primary
!!item.ImageTags
.Primary
}
subText={
item.Type.includes(
@@ -976,7 +952,8 @@ const LibraryView = () => {
"MusicAlbum" ||
item.Type ==
"MusicGenre" ||
item.Type == "Playlist"
item.Type ==
"Playlist"
? "square"
: "portait"
}
@@ -994,7 +971,8 @@ const LibraryView = () => {
item.ImageBlurHashes ==
{}
? ""
: !!item.ImageTags
: !!item
.ImageTags
.Primary
? !!item
.ImageBlurHashes
@@ -1011,7 +989,8 @@ const LibraryView = () => {
}
currentUser={user.data}
favourite={
item.UserData?.IsFavorite
item.UserData
?.IsFavorite
}
></Card>
</Grid2>
@@ -1022,19 +1001,26 @@ const LibraryView = () => {
<TableContainer>
<Table>
<TableBody>
{items.data.Items.map((item, index) => {
{items.data.Items.map(
(item, index) => {
return (
<TableRow
component={motion.div}
component={
motion.div
}
key={item.Id}
sx={{
"& td,& th": {
"& td,& th":
{
borderBottom:
"1px solid rgb(255 255 255 / 0.1)",
},
"&:last-child td, &:last-child th":
{ border: 0 },
"&:hover": {
{
border: 0,
},
"&:hover":
{
background:
"rgb(255 255 255 / 0.05)",
},
@@ -1050,7 +1036,9 @@ const LibraryView = () => {
transition={{
duration: 0.25,
ease: "easeInOut",
delay: 0.02 * index,
delay:
0.02 *
index,
}}
>
<TableCell width="4.5em">
@@ -1070,7 +1058,9 @@ const LibraryView = () => {
</TableCell>
<TableCell>
<Typography variant="h6">
{item.Name}
{
item.Name
}
</Typography>
<Stack
direction="row"
@@ -1124,7 +1114,8 @@ const LibraryView = () => {
);
}}
>
{item.UserData
{item
.UserData
.IsFavorite ? (
<MdiHeart />
) : (
@@ -1134,14 +1125,17 @@ const LibraryView = () => {
</TableCell>
</TableRow>
);
})}
},
)}
</TableBody>
</Table>
</TableContainer>
)}
{!items.isFetching &&
!disablePaginationViews.includes(currentViewType) &&
!disablePaginationViews.includes(
currentViewType,
) &&
items.isSuccess &&
items.data.TotalRecordCount > maxDisplayItems && (
<Stack
@@ -1180,6 +1174,7 @@ const LibraryView = () => {
{items.isError && <ErrorNotice />}
</Box>
</Box>
</Box>
);
};
+17 -9
View File
@@ -41,14 +41,18 @@ body {
overflow-y: overlay;
}
#root,
#root {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
}
.root-page {
height: fit-content;
width: 100%;
position: relative;
overflow-y: hidden;
overflow-x: hidden;
min-height: 100vh;
height: 100%;
margin-bottom: 12vh;
overflow-y: auto;
}
.centered {
@@ -96,13 +100,17 @@ h1 {
color: white !important;
}
.scrollContainer {
position: relative;
flex-grow: 1;
}
.scrollY {
overflow-x: hidden;
overflow-y: visible;
height: fit-content;
overflow-y: auto;
width: inherit;
box-sizing: border-box;
min-height: 100vh;
padding: 1.5em;
}
.empty {
+8
View File
@@ -0,0 +1,8 @@
/** @format */
import { create } from "zustand";
export const useBackdropStore = create((set) => ({
hash: "LGJCbc|t1s1}1{JU|y,uAo=3,s$Q",
setHash: (ahash) => set((state) => ({ hash: ahash })),
}));