From d9644f325cc77226f1b0f5ba534797d7a35c53f5 Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Sat, 10 Jun 2023 11:25:29 +0530 Subject: [PATCH] Revert "Merge branch 'main' of https://github.com/prayag17/JellyPlayer" This reverts commit 38dde2a63d625fa975ab99decc043e411ef4b2be, reversing changes made to 8aef2fc22d708661ef34f652b21173790ecfe6b7. --- src/App.jsx | 58 +- src/components/appBar/appBar.jsx | 2 +- src/components/menu/sidemenu.jsx | 29 +- src/routes/about/index.jsx | 3 + src/routes/home/index.jsx | 3 + src/routes/item/index.jsx | 820 ++++++++++--------- src/routes/item/item.module.scss | 12 +- src/routes/library/index.jsx | 1253 +++++++++++++++--------------- src/styles/global.scss | 26 +- src/utils/store/backdrop.js | 8 - 10 files changed, 1076 insertions(+), 1138 deletions(-) delete mode 100644 src/utils/store/backdrop.js diff --git a/src/App.jsx b/src/App.jsx index 901d1e8..ce10953 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -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 Stack from "@mui/material/Stack"; +import CircularProgress from "@mui/material/CircularProgress"; // Routes import { ServerSetup, ServerList } from "./routes/setup/server"; @@ -72,9 +72,6 @@ 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: { @@ -124,9 +121,6 @@ const AnimationWrapper = () => { transition={{ duration: 0.35, }} - style={{ - width: "100%", - }} > @@ -284,33 +278,9 @@ function App() { appWindow.setFullscreen(false); }, [location]); - const [hash] = useBackdropStore((state) => [state.hash]); - return ( - - - - - - - + +
+ + - - - +
+
+
); diff --git a/src/components/appBar/appBar.jsx b/src/components/appBar/appBar.jsx index 4d877db..2369925 100644 --- a/src/components/appBar/appBar.jsx +++ b/src/components/appBar/appBar.jsx @@ -87,11 +87,11 @@ export const AppBar = () => { return ( { open={false} PaperProps={{ sx: { - backgroundColor: "transparent", + backgroundColor: "inherit", border: "none", width: `calc(${theme.spacing(7)} + 10px)`, - height: "100%", - position: "inherit", + height: "100vh", + // display: visible ? "block" : "none", }, }} sx={{ width: `calc(${theme.spacing(7)} + 10px)`, - background: "transparent", + background: theme.palette.background.paper, }} > + + {/*
+ + + {user["Name"]} + +
*/} + + + +
+ {libraries.isLoading ? ( <> { className="scrollY" sx={{ flexGrow: 1, + pt: 11, + px: 3, + pb: 3, position: "relative", }} > diff --git a/src/routes/home/index.jsx b/src/routes/home/index.jsx index 0baf1aa..6898a75 100644 --- a/src/routes/home/index.jsx +++ b/src/routes/home/index.jsx @@ -204,6 +204,9 @@ const Home = () => { className="scrollY" sx={{ flexGrow: 1, + pt: 11, + px: 3, + pb: 3, position: "relative", }} > diff --git a/src/routes/item/index.jsx b/src/routes/item/index.jsx index 14d3347..4538a75 100644 --- a/src/routes/item/index.jsx +++ b/src/routes/item/index.jsx @@ -66,7 +66,6 @@ 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; @@ -519,12 +518,8 @@ 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(() => { @@ -537,31 +532,9 @@ 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 ( { if (item.isSuccess && similarItems.isSuccess) { return ( <> + + {item.data.BackdropImageTags.length != 0 && ( + + )} + {!!item.data.ParentBackdropImageTags && + item.data.ParentBackdropImageTags.length != 0 && ( + + )} + { - {/* + {item.data.Type != BaseItemKind.MusicAlbum && item.data.Type != BaseItemKind.Episode ? item.data.BackdropImageTags.length != @@ -670,7 +691,7 @@ const ItemDetail = () => { > {TypeIconCollectionCard[item.data.Type]} - */} + { item.data.Type === BaseItemKind.Episode ? "center !important" - : "flex-start", + : "flex-end", justifyContent: "flex-start", width: "100%", }} @@ -767,420 +788,351 @@ const ItemDetail = () => { } - - - {item.data.Type === - BaseItemKind.Episode && ( - - {!!item.data - .ParentLogoItemId ? ( - - ) : ( - item.data - .SeriesName - )} - - )} - {item.data.Type === - BaseItemKind.Episode ? ( - - {`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`} - - ) : ( - - {!!item.data - .ImageTags - .Logo ? ( - - ) : ( - item.data.Name - )} - - )} - - {item.data.OriginalTitle} - - {!!item.data.AlbumArtists && ( - - , - - } - > - {item.data.AlbumArtists.map( - ( - artist, - aindex, - ) => { - return ( - - { - artist.Name - } - - ); - }, - )} - - )} - - - } - sx={{ - alignItems: "center", - width: "100%", - }} - > - {item.data.Type != - "MusicArtist" && - item.data - .ProductionYear && ( - - { - item.data - .ProductionYear - } - + {!!item.data + .ParentLogoItemId ? ( + + ) : ( + item.data.SeriesName )} - {item.data.Type != - "MusicArtist" && ( - - )} - {item.data.Type != - "MusicArtist" && ( - - {!!item.data - .CommunityRating ? ( - <> - - - {Math.round( - item - .data - .CommunityRating * - 10, - ) / - 10} - - - ) : ( - - No - Community - Rating - - )} - - )} - {!!item.data.RunTimeTicks && ( - - {getRuntimeFull( - item.data - .RunTimeTicks, - )} - - )} - {!!item.data.RunTimeTicks && ( - - {endsAt( - item.data - .RunTimeTicks, - )} - - )} - - - + + )} + {item.data.Type === + BaseItemKind.Episode ? ( + + {`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`} + + ) : ( + + {!!item.data.ImageTags + .Logo ? ( + + ) : ( + item.data.Name + )} + + )} - {item.data.Taglines[0]} + {item.data.OriginalTitle} - - {item.data.Genres.length != 0 && ( - - {item.data.Genres.map( - (genre, index) => { - return ( - - ); - }, - )} - - )} - {!!item.data.Overview && ( - - + , + + } > - {item.data.Overview} - - - )} + {item.data.AlbumArtists.map( + ( + artist, + aindex, + ) => { + return ( + + { + artist.Name + } + + ); + }, + )} + + )} + + } + sx={{ + alignItems: "center", + width: "100%", + }} > - {item.data.Type != "Person" && - !item.data.Type.includes( - "Music", - ) && ( - <> - - - - + )} + {item.data.Type != + "MusicArtist" && ( + + )} + {item.data.Type != + "MusicArtist" && ( + + {!!item.data + .CommunityRating ? ( + <> + - - - )} - - {item.data.UserData - .IsFavorite ? ( - - ) : ( - - )} - + + {Math.round( + item + .data + .CommunityRating * + 10, + ) / 10} + + + ) : ( + + No Community + Rating + + )} + + )} + {!!item.data.RunTimeTicks && ( + + {getRuntimeFull( + item.data + .RunTimeTicks, + )} + + )} + {!!item.data.RunTimeTicks && ( + + {endsAt( + item.data + .RunTimeTicks, + )} + + )} +
+ + {item.data.Type != "Person" && + !item.data.Type.includes( + "Music", + ) && ( + <> + + + + + + + )} + + {item.data.UserData.IsFavorite ? ( + + ) : ( + + )} + + + + + {item.data.Taglines[0]} + + - {/* {item.data.Genres != 0 && ( + {item.data.Genres != 0 && ( { - )} */} + )} {item.data.ExternalUrls.length != 0 && ( {
+ {!!item.data.Overview && ( + + + Overview + + + {item.data.Overview} + + + )} {item.data.Type == BaseItemKind.MusicAlbum && ( { label={ episodes.isLoading ? ( ) : ( episodes.data @@ -2789,7 +2753,7 @@ const ItemDetail = () => { duration: 0.35, delay: mindex * - 0.03, + 0.1, }} > { variant: "h5", fontSize: "1.8em", }} - displayCards={12} + displayCards={8} title="Cast" disableDecoration boxProps={{ diff --git a/src/routes/item/item.module.scss b/src/routes/item/item.module.scss index 1222a47..6d24093 100644 --- a/src/routes/item/item.module.scss +++ b/src/routes/item/item.module.scss @@ -17,7 +17,7 @@ display: flex; gap: 1em; justify-content: flex-start; - align-items: flex-start; + align-items: flex-end; position: relative; flex-wrap: wrap; &-backdrop { @@ -30,11 +30,11 @@ left: -24px; z-index: -2; filter: brightness(0.6); - mask-image: linear-gradient(to bottom, black 75%, transparent); + mask-image: linear-gradient(0deg, transparent, black 75%); -webkit-mask-image: linear-gradient( - to bottom, - black 75%, - transparent + 0deg, + transparent, + black 75% ); } } @@ -49,7 +49,7 @@ z-index: -1; } &-container { - width: 20%; + width: 15%; flex-shrink: 0; position: relative; border-radius: $border-radius-default; diff --git a/src/routes/library/index.jsx b/src/routes/library/index.jsx index dbe8b66..a497a75 100644 --- a/src/routes/library/index.jsx +++ b/src/routes/library/index.jsx @@ -452,193 +452,144 @@ const LibraryView = () => { - - - - - - {currentLib.isLoading ? ( - - ) : ( - currentLib.data.Items[0].Name - )} - - + > + + + + + {currentLib.isLoading ? ( + ) : ( - items.data.TotalRecordCount - ) - } - /> - + currentLib.data.Items[0].Name + )} + + + ) : ( + items.data.TotalRecordCount + ) + } + /> + - {/* + {/* Age */} - - } - > - {currentLib.isSuccess && - allowedFilterViews.includes( - currentLib.data.Items[0].CollectionType, - ) && ( - <> - - - - - } - aria-controls="panel1bh-content" - id="panel1bh-header" - > - - Status - - - - - - {availableWatchStatus.map( - ( - item, - index, - ) => { - return ( - - { - item.title - } - - item.state( - e - .target - .checked, - ) - } - /> - - ); - }, - )} - - - - {!onlyStatusFilterViews.includes( - currentLib.data.Items[0] - .CollectionType, - ) && ( + + } + > + {currentLib.isSuccess && + allowedFilterViews.includes( + currentLib.data.Items[0] + .CollectionType, + ) && ( + <> + + { flexShrink: 0, }} > - Features + Status @@ -666,7 +617,7 @@ const LibraryView = () => { }} > - {availableFeatureFilters.map( + {availableWatchStatus.map( ( item, index, @@ -705,474 +656,528 @@ const LibraryView = () => { - )} - {!onlyStatusFilterViews.includes( - currentLib.data.Items[0] - .CollectionType, - ) && ( - - - } - aria-controls="panel1bh-content" - id="panel1bh-header" - > - + + } + aria-controls="panel1bh-content" + id="panel1bh-header" > - Video Type - - - - + Features + + + + + + {availableFeatureFilters.map( + ( + item, + index, + ) => { + return ( + + { + item.title + } + + item.state( + e + .target + .checked, + ) + } + /> + + ); + }, + )} + + + + )} + {!onlyStatusFilterViews.includes( + currentLib.data + .Items[0] + .CollectionType, + ) && ( + + + } + aria-controls="panel1bh-content" + id="panel1bh-header" + > + + Video + Type + + + + + + {availableVideoTypeFilters.map( + ( + item, + index, + ) => { + return ( + + { + item.title + } + + item.state( + e + .target + .checked, + ) + } + /> + + ); + }, + )} + + + + )} + + + )} + {!disabledSortViews.includes( + currentViewType, + ) && ( + <> + {sortByData != undefined && + sortBy != undefined && ( + <> + + } + checkedIcon={ + + } sx={{ - maxHeight: - "15em", - overflow: - "auto", + color: "white !important", }} + color="white" + onChange={ + handleSortChange + } + checked={ + sortAscending + } + /> + - - {availableVideoTypeFilters.map( - ( - item, - index, - ) => { - return ( - - { - item.title - } - - item.state( - e - .target - .checked, - ) - } - /> - - ); - }, - )} - - - + {sortByData.map( + ( + item, + index, + ) => { + return ( + + {`By ${item.title}`} + + ); + }, + )} + + )} - )} - {!disabledSortViews.includes(currentViewType) && ( - <> - {sortByData != undefined && - sortBy != undefined && ( - <> - - } - checkedIcon={ - - } - sx={{ - color: "white !important", - }} - color="white" - onChange={ - handleSortChange - } - checked={ - sortAscending - } - /> - - {sortByData.map( - ( - item, - index, - ) => { - return ( - - {`By ${item.title}`} - - ); - }, - )} - - - )} - - )} - {viewType.length != 0 && - currentViewType != undefined && ( - - {viewType.map((item, index) => { - return ( - - {item.title} - - ); - })} - - )} - - - - - - {items.isLoading || items.isFetching ? ( - + {viewType.map( + (item, index) => { + return ( + + { + item.title + } + + ); + }, + )} + + )} + +
+ + {items.isLoading || items.isFetching ? ( + + - - - ) : items.data.TotalRecordCount == 0 ? ( - - ) : currentViewType != BaseItemKind.Audio ? ( - - {items.data.Items.map((item, index) => { - return ( - - + + ) : items.data.TotalRecordCount == 0 ? ( + + ) : currentViewType != BaseItemKind.Audio ? ( + + {items.data.Items.map((item, index) => { + return ( + + - - ); - })} - - ) : ( - - - - {items.data.Items.map( - (item, index) => { - return ( - - - - {!!item + .Primary[ + item .ImageTags - .Primary && ( - - )} - - - - - - - - { - item.Name - } + .Primary + ] + : "" + : "" + } + currentUser={user.data} + favourite={ + item.UserData?.IsFavorite + } + > + + ); + })} + + ) : ( + +
+ + {items.data.Items.map((item, index) => { + return ( + + + + {!!item + .ImageTags + .Primary && ( + + )} + + + + + + + + {item.Name} + + + , - + {item.Artists.map( + ( + artist, + aindex, + ) => { + return ( - , + { + artist + } - } - > - {item.Artists.map( - ( - artist, - aindex, - ) => { - return ( - - { - artist - } - - ); - }, - )} - - - - - {getRuntimeMusic( - item.RunTimeTicks, - )} - - - - { - handleLiking( - item, - ); - }} - > - {item - .UserData - .IsFavorite ? ( - - ) : ( - - )} - - - - ); - }, - )} - -
-
+ ); + }, + )} + + + + + {getRuntimeMusic( + item.RunTimeTicks, + )} + + + + { + handleLiking( + item, + ); + }} + > + {item.UserData + .IsFavorite ? ( + + ) : ( + + )} + + + + ); + })} + + + + )} + + {!items.isFetching && + !disablePaginationViews.includes(currentViewType) && + items.isSuccess && + items.data.TotalRecordCount > maxDisplayItems && ( + + + {maxDisplayItems * (page - 1)} -{" "} + {items.data.TotalRecordCount <= + maxDisplayItems * page + ? items.data.TotalRecordCount + : maxDisplayItems * page}{" "} + of {items.data.TotalRecordCount} + + { + setPage(val); + }} + count={Math.ceil( + items.data.TotalRecordCount / + maxDisplayItems, + )} + sx={{ + width: "fit-content", + }} + /> + )} - {!items.isFetching && - !disablePaginationViews.includes( - currentViewType, - ) && - items.isSuccess && - items.data.TotalRecordCount > maxDisplayItems && ( - - - {maxDisplayItems * (page - 1)} -{" "} - {items.data.TotalRecordCount <= - maxDisplayItems * page - ? items.data.TotalRecordCount - : maxDisplayItems * page}{" "} - of {items.data.TotalRecordCount} - - { - setPage(val); - }} - count={Math.ceil( - items.data.TotalRecordCount / - maxDisplayItems, - )} - sx={{ - width: "fit-content", - }} - /> - - )} - - {items.isError && } - + {items.isError && } ); diff --git a/src/styles/global.scss b/src/styles/global.scss index 1336c5d..f041c22 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -41,18 +41,14 @@ body { overflow-y: overlay; } -#root { - display: flex; - flex-direction: column; - height: 100vh; - width: 100vw; -} - +#root, .root-page { + height: fit-content; + width: 100%; + position: relative; + overflow-y: hidden; overflow-x: hidden; - height: 100%; - margin-bottom: 12vh; - overflow-y: auto; + min-height: 100vh; } .centered { @@ -100,17 +96,13 @@ h1 { color: white !important; } -.scrollContainer { - position: relative; - flex-grow: 1; -} - .scrollY { overflow-x: hidden; - overflow-y: auto; + overflow-y: visible; + height: fit-content; width: inherit; box-sizing: border-box; - padding: 1.5em; + min-height: 100vh; } .empty { diff --git a/src/utils/store/backdrop.js b/src/utils/store/backdrop.js deleted file mode 100644 index 84bb3ae..0000000 --- a/src/utils/store/backdrop.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @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 })), -}));