Update ItemPage ui and more...

This commit is contained in:
prayag17 committed 2023-06-06 14:04:23 +05:30
1 parent 19ff2af29b
commit e4ade5659c
19 files changed
+455 -317

No files matched your search

-1
View File
@@ -5,7 +5,6 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/icon.svg" /> <link rel="icon" type="image/svg+xml" href="/icon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="http://localhost:8097"></script>
<title>Jellyplayer</title> <title>Jellyplayer</title>
</head> </head>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 393 KiB

After

Width:  |  Height:  |  Size: 632 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

-41
View File
@@ -1,41 +0,0 @@
#root {
max-width: 1280px;
margin: 0 auto;
padding: 2rem;
text-align: center;
}
.logo {
height: 6em;
padding: 1.5em;
will-change: filter;
}
.logo:hover {
filter: drop-shadow(0 0 2em #646cffaa);
}
.logo.react:hover {
filter: drop-shadow(0 0 2em #61dafbaa);
}
@keyframes logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (prefers-reduced-motion: no-preference) {
a:nth-of-type(2) .logo {
animation: logo-spin infinite 20s linear;
}
}
.card {
padding: 2em;
}
.read-the-docs {
color: #888;
}
+49 -7
View File
@@ -40,7 +40,7 @@ import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle"; import DialogTitle from "@mui/material/DialogTitle";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress"; import Stack from "@mui/material/Stack";
// Routes // Routes
import { ServerSetup, ServerList } from "./routes/setup/server"; 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 { delUser, getUser } from "./utils/storage/user.js";
import axios from "axios"; 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({ const jellyfin = new Jellyfin({
clientInfo: { clientInfo: {
@@ -121,6 +124,9 @@ const AnimationWrapper = () => {
transition={{ transition={{
duration: 0.35, duration: 0.35,
}} }}
style={{
width: "100%",
}}
> >
<Outlet /> <Outlet />
</motion.div> </motion.div>
@@ -278,9 +284,33 @@ function App() {
appWindow.setFullscreen(false); appWindow.setFullscreen(false);
}, [location]); }, [location]);
const [hash] = useBackdropStore((state) => [state.hash]);
return ( return (
<SnackbarProvider maxSnack={5}> <SnackbarProvider maxSnack={5}>
<ThemeProvider theme={theme}> <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> <Kon resetDelay={1000} action={sixtyNine}></Kon>
<Dialog <Dialog
open={easterEgg} open={easterEgg}
@@ -323,11 +353,23 @@ function App() {
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<AnimatePresence>
<div style={{ display: "flex" }}>
<CssBaseline /> <CssBaseline />
<SideMenu />
<AppBar /> <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 <Routes
key={location.pathname} key={location.pathname}
location={location} location={location}
@@ -395,9 +437,9 @@ function App() {
/> />
</Route> </Route>
</Routes> </Routes>
</div> </Stack>
</AnimatePresence> </Box>
<ReactQueryDevtools /> <ReactQueryDevtools position="bottom-right" />
</ThemeProvider> </ThemeProvider>
</SnackbarProvider> </SnackbarProvider>
); );
+1 -1
View File
@@ -87,11 +87,11 @@ export const AppBar = () => {
return ( return (
<MuiAppBar <MuiAppBar
sx={{ sx={{
width: `calc(100vw - ${theme.spacing(7)})`,
backgroundColor: "transparent", backgroundColor: "transparent",
}} }}
className={trigger ? "appBar backdropVisible" : "appBar"} className={trigger ? "appBar backdropVisible" : "appBar"}
elevation={0} elevation={0}
position="static"
> >
<Toolbar sx={{ justifyContent: "space-between" }}> <Toolbar sx={{ justifyContent: "space-between" }}>
<Box <Box
+4 -4
View File
@@ -31,19 +31,19 @@ export const CardScroller = ({
slidesToSlide: displayCards + 1, slidesToSlide: displayCards + 1,
}, },
desktop: { desktop: {
breakpoint: { max: 3000, min: 1025 }, breakpoint: { max: 3000, min: 625 },
items: displayCards, items: displayCards,
slidesToSlide: displayCards, // optional, default to 1. slidesToSlide: displayCards, // optional, default to 1.
}, },
tablet: { tablet: {
breakpoint: { max: 1024, min: 464 }, breakpoint: { max: 624, min: 464 },
items: displayCards - 2, items: displayCards - 2,
slidesToSlide: displayCards - 2, // optional, default to 1. slidesToSlide: displayCards - 2, // optional, default to 1.
}, },
mobile: { mobile: {
breakpoint: { max: 464, min: 0 }, breakpoint: { max: 464, min: 0 },
items: displayCards - 3, items: displayCards - 5,
slidesToSlide: displayCards - 3, // optional, default to 1. slidesToSlide: displayCards - 5, // optional, default to 1.
}, },
}; };
+13
View File
@@ -0,0 +1,13 @@
/** @format */
import SvgIcon from "@mui/material/SvgIcon";
import { mdiPlaySpeed } from "@mdi/js";
export const MdiPlaySpeed = (props) => {
return (
<SvgIcon {...props}>
<path d={mdiPlaySpeed}></path>
</SvgIcon>
);
};
+4 -25
View File
@@ -113,39 +113,18 @@ export const SideMenu = ({}) => {
open={false} open={false}
PaperProps={{ PaperProps={{
sx: { sx: {
backgroundColor: "inherit", backgroundColor: "transparent",
border: "none", border: "none",
width: `calc(${theme.spacing(7)} + 10px)`, width: `calc(${theme.spacing(7)} + 10px)`,
height: "100vh", height: "100%",
// display: visible ? "block" : "none", position: "inherit",
}, },
}} }}
sx={{ sx={{
width: `calc(${theme.spacing(7)} + 10px)`, 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 ? ( {libraries.isLoading ? (
<> <>
<Skeleton <Skeleton
-3
View File
@@ -38,9 +38,6 @@ const About = () => {
className="scrollY" className="scrollY"
sx={{ sx={{
flexGrow: 1, flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative", position: "relative",
}} }}
> >
-3
View File
@@ -204,9 +204,6 @@ const Home = () => {
className="scrollY" className="scrollY"
sx={{ sx={{
flexGrow: 1, flexGrow: 1,
pt: 11,
px: 3,
pb: 3,
position: "relative", 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 { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
import { MdiMusic } from "../../components/icons/mdiMusic"; import { MdiMusic } from "../../components/icons/mdiMusic";
import { usePlaybackStore } from "../../utils/store/playback"; import { usePlaybackStore } from "../../utils/store/playback";
import { useBackdropStore } from "../../utils/store/backdrop";
function TabPanel(props) { function TabPanel(props) {
const { children, value, index, ...other } = props; const { children, value, index, ...other } = props;
@@ -518,8 +519,12 @@ const ItemDetail = () => {
state.setDuration, state.setDuration,
state.setItemId, state.setItemId,
state.setItemName, state.setItemName,
state.setItemName,
,
]); ]);
const [setHash] = useBackdropStore((state) => [state.setHash]);
const [directors, setDirectors] = useState([]); const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]); const [writers, setWriters] = useState([]);
useEffect(() => { useEffect(() => {
@@ -532,9 +537,31 @@ const ItemDetail = () => {
(itm) => itm.Type == "Writer", (itm) => itm.Type == "Writer",
); );
setWriters(writeTp); 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]); }, [item.isSuccess]);
const [crew, setCrew] = useState([]);
useEffect(() => {
setCrew(directors.concat(...writers));
}, [writers, directors]);
if (item.isLoading || similarItems.isLoading) { if (item.isLoading || similarItems.isLoading) {
return ( return (
<Box <Box
@@ -553,54 +580,12 @@ const ItemDetail = () => {
if (item.isSuccess && similarItems.isSuccess) { if (item.isSuccess && similarItems.isSuccess) {
return ( 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 <Box
recomponent="main" recomponent="main"
className="scrollY" className="scrollY"
sx={{ sx={{
display: "flex", display: "flex",
pt: 11, display: "flex",
px: 3,
pb: 3,
position: "relative", position: "relative",
flexFlow: "column", flexFlow: "column",
}} }}
@@ -608,15 +593,9 @@ const ItemDetail = () => {
<Box <Box
className="item-detail-header" className="item-detail-header"
mb={2} mb={2}
paddingTop={ paddingTop={5}
item.data.Type.includes("Music") ||
item.data.Type === BaseItemKind.Episode ||
!!item.data.PrimaryImageAspectRatio
? 10
: 0
}
> >
<Box className="item-detail-header-backdrop"> {/* <Box className="item-detail-header-backdrop">
{item.data.Type != BaseItemKind.MusicAlbum && {item.data.Type != BaseItemKind.MusicAlbum &&
item.data.Type != BaseItemKind.Episode item.data.Type != BaseItemKind.Episode
? item.data.BackdropImageTags.length != ? item.data.BackdropImageTags.length !=
@@ -691,7 +670,7 @@ const ItemDetail = () => {
> >
{TypeIconCollectionCard[item.data.Type]} {TypeIconCollectionCard[item.data.Type]}
</Box> </Box>
</Box> </Box> */}
<Box <Box
className="item-detail-info-container" className="item-detail-info-container"
@@ -703,7 +682,7 @@ const ItemDetail = () => {
item.data.Type === item.data.Type ===
BaseItemKind.Episode BaseItemKind.Episode
? "center !important" ? "center !important"
: "flex-end", : "flex-start",
justifyContent: "flex-start", justifyContent: "flex-start",
width: "100%", width: "100%",
}} }}
@@ -788,6 +767,12 @@ const ItemDetail = () => {
} }
</div> </div>
</Box> </Box>
<Stack
direction="column"
alignItems="flex-start"
gap={2}
mt={2}
>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@@ -801,7 +786,9 @@ const ItemDetail = () => {
{item.data.Type === {item.data.Type ===
BaseItemKind.Episode && ( BaseItemKind.Episode && (
<Link <Link
component={RouterLink} component={
RouterLink
}
to={`/item/${item.data.SeriesId}`} to={`/item/${item.data.SeriesId}`}
variant="h3" variant="h3"
textOverflow="ellipsis" 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}`} 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> </Link>
)} )}
@@ -829,7 +817,9 @@ const ItemDetail = () => {
textOverflow="ellipsis" textOverflow="ellipsis"
whiteSpace="nowrap" whiteSpace="nowrap"
width="100%" width="100%"
sx={{ opacity: 0.7 }} sx={{
opacity: 0.7,
}}
> >
{`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`} {`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`}
</Typography> </Typography>
@@ -840,7 +830,8 @@ const ItemDetail = () => {
whiteSpace="nowrap" whiteSpace="nowrap"
width="100%" width="100%"
> >
{!!item.data.ImageTags {!!item.data
.ImageTags
.Logo ? ( .Logo ? (
<img <img
className="item-detail-title-logo" className="item-detail-title-logo"
@@ -853,7 +844,9 @@ const ItemDetail = () => {
)} )}
<Typography <Typography
variant="h6" variant="h6"
sx={{ opacity: 0.7 }} sx={{
opacity: 0.7,
}}
> >
{item.data.OriginalTitle} {item.data.OriginalTitle}
</Typography> </Typography>
@@ -912,10 +905,14 @@ const ItemDetail = () => {
width: "100%", width: "100%",
}} }}
> >
{item.data.Type != "MusicArtist" && {item.data.Type !=
item.data.ProductionYear && ( "MusicArtist" &&
item.data
.ProductionYear && (
<Typography <Typography
sx={{ flexGrow: 0 }} sx={{
flexGrow: 0,
}}
variant="subtitle1" variant="subtitle1"
> >
{ {
@@ -931,7 +928,8 @@ const ItemDetail = () => {
label={ label={
!!item.data !!item.data
.OfficialRating .OfficialRating
? item.data ? item
.data
.OfficialRating .OfficialRating
: "Not Rated" : "Not Rated"
} }
@@ -962,12 +960,14 @@ const ItemDetail = () => {
.data .data
.CommunityRating * .CommunityRating *
10, 10,
) / 10} ) /
10}
</Typography> </Typography>
</> </>
) : ( ) : (
<Typography variant="subtitle1"> <Typography variant="subtitle1">
No Community No
Community
Rating Rating
</Typography> </Typography>
)} )}
@@ -991,13 +991,55 @@ const ItemDetail = () => {
)} )}
</Stack> </Stack>
</Box> </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 <Stack
direction="row" direction="row"
gap={1} gap={1}
alignItems="center" alignItems="center"
justifyContent="center" justifyContent="center"
ml="auto"
mr={2}
> >
{item.data.Type != "Person" && {item.data.Type != "Person" &&
!item.data.Type.includes( !item.data.Type.includes(
@@ -1046,6 +1088,20 @@ const ItemDetail = () => {
.data .data
.RunTimeTicks, .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( navigate(
`/player`, `/player`,
@@ -1055,7 +1111,8 @@ const ItemDetail = () => {
{!!item.data {!!item.data
.UserData .UserData
.PlayedPercentage && .PlayedPercentage &&
item.data.UserData item.data
.UserData
.PlayedPercentage > .PlayedPercentage >
0 0
? "Resume" ? "Resume"
@@ -1105,34 +1162,25 @@ const ItemDetail = () => {
</> </>
)} )}
<IconButton onClick={handleLiking}> <IconButton onClick={handleLiking}>
{item.data.UserData.IsFavorite ? ( {item.data.UserData
.IsFavorite ? (
<MdiHeart <MdiHeart
sx={{ color: pink[700] }} sx={{
color: pink[700],
}}
/> />
) : ( ) : (
<MdiHeartOutline /> <MdiHeartOutline />
)} )}
</IconButton> </IconButton>
</Stack> </Stack>
</Box> </Stack>
<Box
className="item-detail-tagline"
sx={{ width: "100%" }}
>
<Typography
variant="h5"
fontStyle="italic"
sx={{ opacity: 0.8 }}
>
{item.data.Taglines[0]}
</Typography>
</Box> </Box>
</Box> </Box>
<TableContainer> <TableContainer>
<Table> <Table>
<TableBody> <TableBody>
{item.data.Genres != 0 && ( {/* {item.data.Genres != 0 && (
<TableRow <TableRow
sx={{ sx={{
"& td, & th": { "& td, & th": {
@@ -1180,7 +1228,7 @@ const ItemDetail = () => {
</Stack> </Stack>
</TableCell> </TableCell>
</TableRow> </TableRow>
)} )} */}
{item.data.ExternalUrls.length != 0 && ( {item.data.ExternalUrls.length != 0 && (
<TableRow <TableRow
@@ -1716,20 +1764,6 @@ const ItemDetail = () => {
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </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 && ( {item.data.Type == BaseItemKind.MusicAlbum && (
<TableContainer <TableContainer
@@ -2684,7 +2718,9 @@ const ItemDetail = () => {
label={ label={
episodes.isLoading ? ( episodes.isLoading ? (
<CircularProgress <CircularProgress
sx={{ p: 1.5 }} sx={{
p: 1.5,
}}
/> />
) : ( ) : (
episodes.data episodes.data
@@ -2753,7 +2789,7 @@ const ItemDetail = () => {
duration: 0.35, duration: 0.35,
delay: delay:
mindex * mindex *
0.1, 0.03,
}} }}
> >
<EpisodeCard <EpisodeCard
@@ -3161,7 +3197,7 @@ const ItemDetail = () => {
variant: "h5", variant: "h5",
fontSize: "1.8em", fontSize: "1.8em",
}} }}
displayCards={8} displayCards={12}
title="Cast" title="Cast"
disableDecoration disableDecoration
boxProps={{ boxProps={{
+6 -6
View File
@@ -17,7 +17,7 @@
display: flex; display: flex;
gap: 1em; gap: 1em;
justify-content: flex-start; justify-content: flex-start;
align-items: flex-end; align-items: flex-start;
position: relative; position: relative;
flex-wrap: wrap; flex-wrap: wrap;
&-backdrop { &-backdrop {
@@ -30,11 +30,11 @@
left: -24px; left: -24px;
z-index: -2; z-index: -2;
filter: brightness(0.6); 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( -webkit-mask-image: linear-gradient(
0deg, to bottom,
transparent, black 75%,
black 75% transparent
); );
} }
} }
@@ -49,7 +49,7 @@
z-index: -1; z-index: -1;
} }
&-container { &-container {
width: 15%; width: 20%;
flex-shrink: 0; flex-shrink: 0;
position: relative; position: relative;
border-radius: $border-radius-default; border-radius: $border-radius-default;
+65 -70
View File
@@ -452,21 +452,11 @@ const LibraryView = () => {
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
}} flexDirection: "column",
>
<Box
component="main"
className="scrollY"
sx={{
flexGrow: 1,
pt: 19,
px: 3,
pb: 3,
position: "relative",
}} }}
> >
<AppBar <AppBar
position="fixed" position="static"
elevation={trigger ? 1 : 0} elevation={trigger ? 1 : 0}
sx={{ sx={{
width: `calc(100vw - ${theme.spacing(7)} - 10px)`, width: `calc(100vw - ${theme.spacing(7)} - 10px)`,
@@ -482,9 +472,7 @@ const LibraryView = () => {
> >
<Divider <Divider
sx={{ sx={{
transform: trigger transform: trigger ? "scaleX(1)" : "scaleX(0)",
? "scaleX(1)"
: "scaleX(0)",
transition: "transform 150ms", transition: "transform 150ms",
transformOrigin: "left", transformOrigin: "left",
transitionDelay: "50ms", transitionDelay: "50ms",
@@ -532,8 +520,7 @@ const LibraryView = () => {
> >
{currentLib.isSuccess && {currentLib.isSuccess &&
allowedFilterViews.includes( allowedFilterViews.includes(
currentLib.data.Items[0] currentLib.data.Items[0].CollectionType,
.CollectionType,
) && ( ) && (
<> <>
<Button <Button
@@ -545,16 +532,12 @@ const LibraryView = () => {
} }
aria-haspopup="true" aria-haspopup="true"
aria-expanded={ aria-expanded={
open open ? "true" : undefined
? "true"
: undefined
} }
startIcon={ startIcon={
<MdiFilterOutline /> <MdiFilterOutline />
} }
endIcon={ endIcon={<MdiChevronDown />}
<MdiChevronDown />
}
onClick={openFiltersMenu} onClick={openFiltersMenu}
color="white" color="white"
// sx={{ p: 1 }} // sx={{ p: 1 }}
@@ -568,9 +551,7 @@ const LibraryView = () => {
filterButtonAnchorEl filterButtonAnchorEl
} }
open={filterMenuOpen} open={filterMenuOpen}
onClose={ onClose={closeFiltersMenu}
closeFiltersMenu
}
MenuListProps={{ MenuListProps={{
"aria-labelledby": "aria-labelledby":
"basic-button", "basic-button",
@@ -578,13 +559,11 @@ const LibraryView = () => {
}} }}
anchorOrigin={{ anchorOrigin={{
vertical: "bottom", vertical: "bottom",
horizontal: horizontal: "center",
"center",
}} }}
transformOrigin={{ transformOrigin={{
vertical: "top", vertical: "top",
horizontal: horizontal: "center",
"center",
}} }}
sx={{ sx={{
maxHeight: "55%", maxHeight: "55%",
@@ -657,8 +636,7 @@ const LibraryView = () => {
</AccordionDetails> </AccordionDetails>
</Accordion> </Accordion>
{!onlyStatusFilterViews.includes( {!onlyStatusFilterViews.includes(
currentLib.data currentLib.data.Items[0]
.Items[0]
.CollectionType, .CollectionType,
) && ( ) && (
<Accordion> <Accordion>
@@ -729,8 +707,7 @@ const LibraryView = () => {
</Accordion> </Accordion>
)} )}
{!onlyStatusFilterViews.includes( {!onlyStatusFilterViews.includes(
currentLib.data currentLib.data.Items[0]
.Items[0]
.CollectionType, .CollectionType,
) && ( ) && (
<Accordion> <Accordion>
@@ -747,8 +724,7 @@ const LibraryView = () => {
}} }}
noWrap noWrap
> >
Video Video Type
Type
</Typography> </Typography>
</AccordionSummary> </AccordionSummary>
<Divider /> <Divider />
@@ -804,9 +780,7 @@ const LibraryView = () => {
</Menu> </Menu>
</> </>
)} )}
{!disabledSortViews.includes( {!disabledSortViews.includes(currentViewType) && (
currentViewType,
) && (
<> <>
{sortByData != undefined && {sortByData != undefined &&
sortBy != undefined && ( sortBy != undefined && (
@@ -872,33 +846,31 @@ const LibraryView = () => {
value={currentViewType} value={currentViewType}
size="small" size="small"
variant="filled" variant="filled"
onChange={ onChange={handleCurrentViewType}
handleCurrentViewType
}
> >
{viewType.map( {viewType.map((item, index) => {
(item, index) => {
return ( return (
<MenuItem <MenuItem
key={ key={item.value}
item.value value={item.value}
}
value={
item.value
}
> >
{ {item.title}
item.title
}
</MenuItem> </MenuItem>
); );
}, })}
)}
</TextField> </TextField>
)} )}
</Stack> </Stack>
</Toolbar> </Toolbar>
</AppBar> </AppBar>
<Box
sx={{
flexGrow: 1,
position: "relative",
overflowY: "auto",
}}
>
<Box component="main" className="scrollY">
{items.isLoading || items.isFetching ? ( {items.isLoading || items.isFetching ? (
<Box <Box
sx={{ sx={{
@@ -926,7 +898,10 @@ const LibraryView = () => {
) : items.data.TotalRecordCount == 0 ? ( ) : items.data.TotalRecordCount == 0 ? (
<EmptyNotice /> <EmptyNotice />
) : currentViewType != BaseItemKind.Audio ? ( ) : 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) => { {items.data.Items.map((item, index) => {
return ( return (
<Grid2 <Grid2
@@ -953,7 +928,8 @@ const LibraryView = () => {
itemName={item.Name} itemName={item.Name}
itemId={item.Id} itemId={item.Id}
imageTags={ imageTags={
!!item.ImageTags.Primary !!item.ImageTags
.Primary
} }
subText={ subText={
item.Type.includes( item.Type.includes(
@@ -976,7 +952,8 @@ const LibraryView = () => {
"MusicAlbum" || "MusicAlbum" ||
item.Type == item.Type ==
"MusicGenre" || "MusicGenre" ||
item.Type == "Playlist" item.Type ==
"Playlist"
? "square" ? "square"
: "portait" : "portait"
} }
@@ -994,7 +971,8 @@ const LibraryView = () => {
item.ImageBlurHashes == item.ImageBlurHashes ==
{} {}
? "" ? ""
: !!item.ImageTags : !!item
.ImageTags
.Primary .Primary
? !!item ? !!item
.ImageBlurHashes .ImageBlurHashes
@@ -1011,7 +989,8 @@ const LibraryView = () => {
} }
currentUser={user.data} currentUser={user.data}
favourite={ favourite={
item.UserData?.IsFavorite item.UserData
?.IsFavorite
} }
></Card> ></Card>
</Grid2> </Grid2>
@@ -1022,19 +1001,26 @@ const LibraryView = () => {
<TableContainer> <TableContainer>
<Table> <Table>
<TableBody> <TableBody>
{items.data.Items.map((item, index) => { {items.data.Items.map(
(item, index) => {
return ( return (
<TableRow <TableRow
component={motion.div} component={
motion.div
}
key={item.Id} key={item.Id}
sx={{ sx={{
"& td,& th": { "& td,& th":
{
borderBottom: borderBottom:
"1px solid rgb(255 255 255 / 0.1)", "1px solid rgb(255 255 255 / 0.1)",
}, },
"&:last-child td, &:last-child th": "&:last-child td, &:last-child th":
{ border: 0 }, {
"&:hover": { border: 0,
},
"&:hover":
{
background: background:
"rgb(255 255 255 / 0.05)", "rgb(255 255 255 / 0.05)",
}, },
@@ -1050,7 +1036,9 @@ const LibraryView = () => {
transition={{ transition={{
duration: 0.25, duration: 0.25,
ease: "easeInOut", ease: "easeInOut",
delay: 0.02 * index, delay:
0.02 *
index,
}} }}
> >
<TableCell width="4.5em"> <TableCell width="4.5em">
@@ -1070,7 +1058,9 @@ const LibraryView = () => {
</TableCell> </TableCell>
<TableCell> <TableCell>
<Typography variant="h6"> <Typography variant="h6">
{item.Name} {
item.Name
}
</Typography> </Typography>
<Stack <Stack
direction="row" direction="row"
@@ -1124,7 +1114,8 @@ const LibraryView = () => {
); );
}} }}
> >
{item.UserData {item
.UserData
.IsFavorite ? ( .IsFavorite ? (
<MdiHeart /> <MdiHeart />
) : ( ) : (
@@ -1134,14 +1125,17 @@ const LibraryView = () => {
</TableCell> </TableCell>
</TableRow> </TableRow>
); );
})} },
)}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>
)} )}
{!items.isFetching && {!items.isFetching &&
!disablePaginationViews.includes(currentViewType) && !disablePaginationViews.includes(
currentViewType,
) &&
items.isSuccess && items.isSuccess &&
items.data.TotalRecordCount > maxDisplayItems && ( items.data.TotalRecordCount > maxDisplayItems && (
<Stack <Stack
@@ -1180,6 +1174,7 @@ const LibraryView = () => {
{items.isError && <ErrorNotice />} {items.isError && <ErrorNotice />}
</Box> </Box>
</Box> </Box>
</Box>
); );
}; };
+125 -46
View File
@@ -9,7 +9,11 @@ import IconButton from "@mui/material/IconButton";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Slider from "@mui/material/Slider"; import Slider from "@mui/material/Slider";
import CircularProgress from "@mui/material/CircularProgress"; import CircularProgress from "@mui/material/CircularProgress";
import Grow from "@mui/material/Grow"; import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import List from "@mui/material/List";
import ListItem from "@mui/material/ListItem";
import ListItemText from "@mui/material/ListItemText";
import Backdrop from "@mui/material/Backdrop"; import Backdrop from "@mui/material/Backdrop";
import ReactPlayer from "react-player"; import ReactPlayer from "react-player";
@@ -33,6 +37,7 @@ import { MdiFullscreenExit } from "../../components/icons/mdiFullscreenExit";
import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight"; import { MdiPictureInPictureBottomRight } from "../../components/icons/mdiPictureInPictureBottomRight";
import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh"; import { MdiVolumeHigh } from "../../components/icons/mdiVolumeHigh";
import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff"; import { MdiVolumeOff } from "../../components/icons/mdiVolumeOff";
import { MdiPlaySpeed } from "../../components/icons/mdiPlaySpeed";
import { endsAt } from "../../utils/date/time"; import { endsAt } from "../../utils/date/time";
@@ -40,18 +45,34 @@ import useKeyPress from "../../utils/hooks/useKeyPress";
export const VideoPlayer = () => { export const VideoPlayer = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const [url, startPosition, itemDuration, itemId, itemName] =
usePlaybackStore((state) => [ const [speedMenuEl, setSpeedMenuEl] = useState(null);
const [speed, setSpeed] = useState(3);
const speedMenuState = Boolean(speedMenuEl);
const availableSpeeds = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2];
const [
url,
startPosition,
itemDuration,
itemId,
itemName,
subtitleTracks,
] = usePlaybackStore((state) => [
state.url, state.url,
state.startPosition, state.startPosition,
state.duration, state.duration,
state.itemId, state.itemId,
state.itemName, state.itemName,
state.subtitleTracks,
]); ]);
var mySubtitle_arr = [];
const [showControls, setShowControls] = useState(false); const [showControls, setShowControls] = useState(false);
const playerRef = useRef(); const playerRef = useRef();
const [isSeeking, setIsSeeking] = useState(false);
const [isBuffering, setIsBuffering] = useState(true); const [isBuffering, setIsBuffering] = useState(true);
const [isPlaying, setIsPlaying] = useState(true); const [isPlaying, setIsPlaying] = useState(true);
const [isMuted, setIsMuted] = useState(false); const [isMuted, setIsMuted] = useState(false);
@@ -75,8 +96,10 @@ export const VideoPlayer = () => {
}, [isReady]); }, [isReady]);
const onProgress = async (e) => { const onProgress = async (e) => {
if (!isSeeking) {
setProgress(e.played); setProgress(e.played);
setCurrentTime(secToTicks(e.playedSeconds)); setCurrentTime(secToTicks(e.playedSeconds));
}
await getPlaystateApi(window.api).reportPlaybackProgress({ await getPlaystateApi(window.api).reportPlaybackProgress({
playbackProgressInfo: { playbackProgressInfo: {
ItemId: itemId, ItemId: itemId,
@@ -84,6 +107,7 @@ export const VideoPlayer = () => {
PositionTicks: secToTicks(e.playedSeconds), PositionTicks: secToTicks(e.playedSeconds),
PlaybackStartTimeTicks: startPosition, PlaybackStartTimeTicks: startPosition,
VolumeLevel: volume * 100, VolumeLevel: volume * 100,
IsPaused: !isPlaying,
}, },
}); });
}; };
@@ -136,6 +160,10 @@ export const VideoPlayer = () => {
} }
}, [showControls]); }, [showControls]);
useEffect(() => {
console.log(subtitleTracks);
}, [mySubtitle_arr]);
const handleKeyPress = useCallback((event) => { const handleKeyPress = useCallback((event) => {
switch (event.key) { switch (event.key) {
case "ArrowRight": case "ArrowRight":
@@ -229,6 +257,7 @@ export const VideoPlayer = () => {
step={0.01} step={0.01}
max={itemDuration} max={itemDuration}
onChange={(e, newVal) => { onChange={(e, newVal) => {
setIsSeeking(true);
setCurrentTime(newVal); setCurrentTime(newVal);
}} }}
onChangeCommitted={(e, newVal) => { onChangeCommitted={(e, newVal) => {
@@ -236,6 +265,7 @@ export const VideoPlayer = () => {
ticksToSec(newVal), ticksToSec(newVal),
); );
setCurrentTime(newVal); setCurrentTime(newVal);
setIsSeeking(false);
}} }}
valueLabelDisplay="auto" valueLabelDisplay="auto"
valueLabelFormat={(value) => valueLabelFormat={(value) =>
@@ -315,33 +345,81 @@ export const VideoPlayer = () => {
alignItems="center" alignItems="center"
justifyContent="center" justifyContent="center"
> >
<Stack <Box>
direction="row" <Menu
width="15em" anchorEl={speedMenuEl}
alignItems="center" open={speedMenuState}
justifyContent="center" onClose={() =>
gap={1} setSpeedMenuEl(null)
}
MenuListProps={{
"aria-labelledby":
"lock-button",
role: "listbox",
}}
anchorOrigin={{
vertical: "bottom",
horizontal: "center",
}}
transformOrigin={{
vertical: "bottom",
horizontal: "center",
}}
sx={{ sx={{
transition: "250ms background", mb: 20,
borderRadius: 20, }}
"&:hover": { >
background: "rgb(0 0 0/0.5)", {availableSpeeds.map(
backdropFilter: "blur(5px)", (sspeed, index) => {
return (
<MenuItem
key={sspeed}
selected={
index ===
speed
}
onClick={() => {
setSpeed(
index,
);
setSpeedMenuEl(
null,
);
}}
sx={{
width: 160,
}}
>
{sspeed}x
</MenuItem>
);
}, },
}} )}
onMouseOver={() => setShowVolume(true)} </Menu>
onMouseOut={() => setShowVolume(false)} <IconButton
padding="0.25em 1em" onClick={(e) =>
setSpeedMenuEl(
e.currentTarget,
)
}
> >
<Grow <MdiPlaySpeed />
style={{ </IconButton>
transformOrigin: </Box>
" right center", <IconButton
sx={{
ml: 0.1,
}} }}
in={showVolume} onClick={() => setIsMuted(!isMuted)}
> >
{isMuted ? (
<MdiVolumeOff />
) : (
<MdiVolumeHigh />
)}
</IconButton>
<Slider <Slider
value={volume * 100} value={isMuted ? 0 : volume * 100}
step={1} step={1}
max={100} max={100}
onChange={(e, newVal) => onChange={(e, newVal) =>
@@ -352,17 +430,17 @@ export const VideoPlayer = () => {
Math.floor(value) Math.floor(value)
} }
sx={{ sx={{
"& .MuiSlider-valueLabel": mr: 1,
{ ml: 1,
width: "10em",
"& .MuiSlider-valueLabel": {
lineHeight: 1.2, lineHeight: 1.2,
fontSize: 24, fontSize: 24,
background: background:
"rgb(0 0 0 / 0.5)", "rgb(0 0 0 / 0.5)",
backdropFilter: backdropFilter: "blur(5px)",
"blur(5px)",
padding: 1, padding: 1,
borderRadius: borderRadius: "10px",
"10px",
border: "1px solid rgb(255 255 255 / 0.15)", border: "1px solid rgb(255 255 255 / 0.15)",
boxShadow: boxShadow:
"0 0 10px rgb(0 0 0 / 0.4) ", "0 0 10px rgb(0 0 0 / 0.4) ",
@@ -383,22 +461,7 @@ export const VideoPlayer = () => {
}, },
}} }}
/> />
</Grow>
<IconButton
sx={{
ml: 0.1,
}}
onClick={() =>
setIsMuted(!isMuted)
}
>
{isMuted ? (
<MdiVolumeOff />
) : (
<MdiVolumeHigh />
)}
</IconButton>
</Stack>
<IconButton <IconButton
onClick={() => { onClick={() => {
setIsPIP(!isPIP); setIsPIP(!isPIP);
@@ -439,6 +502,22 @@ export const VideoPlayer = () => {
volume={volume} volume={volume}
onBuffer={() => setIsBuffering(true)} onBuffer={() => setIsBuffering(true)}
onBufferEnd={() => setIsBuffering(false)} onBufferEnd={() => setIsBuffering(false)}
config={{
file: {
attributes: {
crossOrigin: "true",
},
tracks: [
{
kind: "subtitles",
src: `http://localhost:8096/Videos/${itemId}/${itemId}/Subtitles/0/0/Stream.vtt?api_key=${window.api.accessToken}`,
srcLang: "en",
default: true,
},
],
},
}}
playbackRate={availableSpeeds[speed]}
/> />
</Box> </Box>
); );
+13
View File
@@ -9,3 +9,16 @@
opacity: 1; opacity: 1;
} }
} }
video {
&::-webkit-media-text-track-display {
overflow: visible !important;
}
&::cue {
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
background: transparent;
}
&::cue(i) {
text-shadow: 0 2px 10px rgb(0 0 0 / 0.8);
}
}
+17 -9
View File
@@ -41,14 +41,18 @@ body {
overflow-y: overlay; overflow-y: overlay;
} }
#root, #root {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
}
.root-page { .root-page {
height: fit-content;
width: 100%;
position: relative;
overflow-y: hidden;
overflow-x: hidden; overflow-x: hidden;
min-height: 100vh; height: 100%;
margin-bottom: 12vh;
overflow-y: auto;
} }
.centered { .centered {
@@ -96,13 +100,17 @@ h1 {
color: white !important; color: white !important;
} }
.scrollContainer {
position: relative;
flex-grow: 1;
}
.scrollY { .scrollY {
overflow-x: hidden; overflow-x: hidden;
overflow-y: visible; overflow-y: auto;
height: fit-content;
width: inherit; width: inherit;
box-sizing: border-box; box-sizing: border-box;
min-height: 100vh; padding: 1.5em;
} }
.empty { .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 })),
}));
+13
View File
@@ -8,9 +8,22 @@ export const usePlaybackStore = create((set) => ({
duration: 0, duration: 0,
itemId: "", itemId: "",
itemName: "", itemName: "",
subtitleTracks: [],
setUrl: (aurl) => set((state) => ({ ...state, url: aurl })), setUrl: (aurl) => set((state) => ({ ...state, url: aurl })),
setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })), setPosition: (apos) => set((state) => ({ ...state, startPosition: apos })),
setDuration: (adur) => set((state) => ({ ...state, duration: adur })), setDuration: (adur) => set((state) => ({ ...state, duration: adur })),
setItemId: (aid) => set((state) => ({ ...state, itemId: aid })), setItemId: (aid) => set((state) => ({ ...state, itemId: aid })),
setItemName: (anm) => set((state) => ({ ...state, itemName: anm })), setItemName: (anm) => set((state) => ({ ...state, itemName: anm })),
setSubtitleTracks: (asub) =>
set((state) => ({
...state,
subtitleTracks: [
{
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,
},
],
})),
})); }));