Add full app backdrop

This commit is contained in:
Prayag Prajapati committed 2023-08-14 20:54:08 +05:30
1 parent 73085f736f
commit 94e7ea95c1
7 files changed
+437 -452

No files matched your search

+22 -21
View File
@@ -359,33 +359,34 @@ function App() {
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<AnimatePresence> <AnimatePresence wait>
<Box className="app-backdrop-container">
<motion.img
key={backdropId}
src={backdropUrl}
alt=""
className="app-backdrop"
initial={{
opacity: 0,
}}
animate={{
opacity: 0.5,
}}
exit={{
opacity: 0,
}}
transition={{
duration: 1,
}}
loading="eager"
/>
</Box>
<div <div
style={{ style={{
display: "flex", display: "flex",
width: "calc(100vw - 14px)", width: "calc(100vw - 14px)",
}} }}
> >
<Box className="app-backdrop-container">
<motion.img
key={backdropId}
src={backdropUrl}
alt=""
className="app-backdrop"
initial={{
opacity: 0,
}}
animate={{
opacity: 0.5,
}}
exit={{
opacity: 0,
}}
transition={{
duration: 1,
}}
/>
</Box>
<CssBaseline /> <CssBaseline />
<SideMenu /> <SideMenu />
<AppBar /> <AppBar />
+3 -3
View File
@@ -129,8 +129,10 @@ export const SideMenu = ({}) => {
}, },
}} }}
sx={{ sx={{
zIndex: 1,
width: `calc(${theme.spacing(7)} + 10px)`, width: `calc(${theme.spacing(7)} + 10px)`,
background: theme.palette.background.paper, background:
"linear-gradient(to right, rgb(0 0 0 / 0.35) , transparent) !important ",
}} }}
> >
<DrawerHeader <DrawerHeader
@@ -139,7 +141,6 @@ export const SideMenu = ({}) => {
justifyContent: "center", justifyContent: "center",
}} }}
></DrawerHeader> ></DrawerHeader>
<Divider />
{libraries.isLoading ? ( {libraries.isLoading ? (
<> <>
<Skeleton <Skeleton
@@ -207,7 +208,6 @@ export const SideMenu = ({}) => {
)} )}
</List> </List>
<List sx={{ marginTop: "auto" }}> <List sx={{ marginTop: "auto" }}>
<Divider />
<Tooltip <Tooltip
title="Home" title="Home"
placement="right" placement="right"
+5 -1
View File
@@ -7,9 +7,13 @@ import { theme } from "../../theme";
export const CarouselSkeleton = () => { export const CarouselSkeleton = () => {
return ( return (
<Paper <Paper
className="hero-carousel-slide" className="hero-carousel-skeleton"
elevation={0}
sx={{ sx={{
height: "100vh",
position: "relative",
background: theme.palette.primary.background.main, background: theme.palette.primary.background.main,
borderRadius: 0,
}} }}
> >
<div className="hero-carousel-background"> <div className="hero-carousel-background">
+9 -5
View File
@@ -43,12 +43,16 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
opacity: 0.8; opacity: 0.8;
mask-image: linear-gradient(to bottom, black, transparent); mask-image: linear-gradient(to bottom, black 40%, transparent),
linear-gradient(to left, black 40%, transparent);
-webkit-mask-image: linear-gradient( -webkit-mask-image: linear-gradient(
to bottom, to bottom,
black, black 40%,
transparent transparent
); ),
linear-gradient(to left, black 40%, transparent);
mask-composite: source-in;
-webkit-mask-composite: source-in;
} }
&-image { &-image {
position: absolute; position: absolute;
+386 -380
View File
@@ -215,316 +215,277 @@ const Home = () => {
position: "relative", position: "relative",
}} }}
> >
<Carousel {latestMedia.isLoading ? (
className="hero-carousel" <CarouselSkeleton />
autoPlay={false} ) : (
animation="fade" <Carousel
height="100vh" className="hero-carousel"
IndicatorIcon={ autoPlay={false}
<div className="hero-carousel-indicator"></div> animation="fade"
} height="100vh"
activeIndicatorIconButtonProps={{ IndicatorIcon={
style: { <div className="hero-carousel-indicator"></div>
background: "rgb(255 255 255)", }
}, activeIndicatorIconButtonProps={{
}} style: {
indicatorIconButtonProps={{ background: "rgb(255 255 255)",
style: { },
background: "rgb(255 255 255 / 0.3)", }}
borderRadius: "2px", indicatorIconButtonProps={{
width: "100%", style: {
flexShrink: "1", background: "rgb(255 255 255 / 0.3)",
}, borderRadius: "2px",
}} width: "100%",
indicatorContainerProps={{ flexShrink: "1",
className: "hero-carousel-indicator-container", },
style: { }}
position: "absolute", indicatorContainerProps={{
display: "flex", className:
gap: "1em", "hero-carousel-indicator-container",
zIndex: 1, style: {
}, position: "absolute",
}} display: "flex",
sx={{ gap: "1em",
marginBottom: "1.5em", zIndex: 1,
}} },
onChange={(now) => { }}
console.log(latestMedia.data[now]); sx={{
setAppBackdrop( marginBottom: "1.5em",
`${window.api.basePath}/Items/${latestMedia.data[now].Id}/Images/Backdrop`, }}
latestMedia.data[now].Id, onChange={(now) => {
); if (latestMedia.isSuccess) {
}} setAppBackdrop(
duration={400} `${window.api.basePath}/Items/${latestMedia.data[now].Id}/Images/Backdrop`,
interval={10000} latestMedia.data[now].Id,
> );
{latestMedia.isLoading ? ( }
<CarouselSkeleton /> }}
) : ( changeOnFirstRender={true}
// <></> duration={400}
latestMedia.data.length != 0 && interval={10000}
latestMedia.data.map((item, index) => { >
return ( {latestMedia.data.length != 0 &&
<ErrorBoundary latestMedia.data.map((item, index) => {
fallback={ return (
<CarouselSlideError <ErrorBoundary
itemName={item.Name} fallback={
/> <CarouselSlideError
} itemName={item.Name}
> />
<Paper }
className="hero-carousel-slide"
sx={{
background:
"transparent",
}}
key={index}
> >
<div className="hero-carousel-background-container"> <Paper
{Object.keys( className="hero-carousel-slide"
item.ImageBlurHashes sx={{
.Backdrop, background:
).length != 0 && ( "transparent",
<Blurhash }}
hash={ key={index}
item >
.ImageBlurHashes <div className="hero-carousel-background-container">
.Backdrop[ {Object.keys(
Object.keys( item
item .ImageBlurHashes
.ImageBlurHashes .Backdrop,
.Backdrop, ).length != 0 && (
)[0] <Blurhash
] hash={
} item
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj" .ImageBlurHashes
width="1080" .Backdrop[
height="720" Object.keys(
resolutionX={ item
64 .ImageBlurHashes
} .Backdrop,
resolutionY={ )[0]
96 ]
} }
className="hero-carousel-background-blurhash" // hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
punch={1} width="1080"
/> height="720"
)} resolutionX={
<div 64
className="hero-carousel-background-image" }
style={{ resolutionY={
backgroundImage: `url(${ 96
window.api }
.basePath + className="hero-carousel-background-blurhash"
"/Items/" + punch={1}
item.Id + />
"/Images/Backdrop" )}
})`, <div
}} className="hero-carousel-background-image"
></div> style={{
<div className="hero-carousel-background-icon-container"> backgroundImage: `url(${
{
MediaTypeIconCollection[
item.Type
]
}
</div>
</div>
<Box className="hero-carousel-detail">
<Typography
component={
motion.h2
}
key={item.Id}
variant="h2"
className="hero-carousel-text"
sx={{
mb: 2.5,
}}
initial={{
y: 10,
opacity: 0,
}}
exit={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.35,
}}
whileInView={{
y: 0,
opacity: 1,
}}
>
{!item.ImageTags
.Logo ? (
item.Name
) : (
<img
className="hero-carousel-text-logo"
src={
window window
.api .api
.basePath + .basePath +
"/Items/" + "/Items/" +
item.Id + item.Id +
"/Images/Logo?quality=80&tag=" + "/Images/Backdrop"
})`,
}}
></div>
<div className="hero-carousel-background-icon-container">
{
MediaTypeIconCollection[
item item
.ImageTags .Type
.Logo ]
}
</div>
</div>
<Box className="hero-carousel-detail">
<Typography
component={
motion.h2
}
key={item.Id}
variant="h2"
className="hero-carousel-text"
sx={{
mb: 2.5,
}}
initial={{
y: 10,
opacity: 0,
}}
exit={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.35,
}}
whileInView={{
y: 0,
opacity: 1,
}}
>
{!item
.ImageTags
.Logo ? (
item.Name
) : (
<img
className="hero-carousel-text-logo"
src={
window
.api
.basePath +
"/Items/" +
item.Id +
"/Images/Logo?quality=80&tag=" +
item
.ImageTags
.Logo
}
></img>
)}
</Typography>
<Stack
component={
motion.div
}
direction="row"
gap={1}
initial={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.25,
delay: 0.1,
}}
exit={{
y: 10,
opacity: 0,
}}
whileInView={{
y: 0,
opacity: 1,
}}
divider={
<Box
sx={{
width: "4px",
height: "4px",
background:
"white",
alignSelf:
"center",
aspectRatio: 1,
borderRadius:
"10px",
}}
></Box>
}
className="hero-carousel-info"
>
<Typography
variant="subtitle1"
// color="GrayText"
>
{!!item.ProductionYear
? item.ProductionYear
: "Unknown"}
</Typography>
<Chip
variant="outlined"
label={
!!item.OfficialRating
? item.OfficialRating
: "Not Rated"
} }
></img> />
)}
</Typography>
<Stack
component={
motion.div
}
direction="row"
gap={1}
initial={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.25,
delay: 0.1,
}}
exit={{
y: 10,
opacity: 0,
}}
whileInView={{
y: 0,
opacity: 1,
}}
divider={
<Box <Box
sx={{ sx={{
width: "4px", display: "flex",
height: "4px", gap: "0.25em",
background: alignItems:
"white",
alignSelf:
"center", "center",
aspectRatio: 1,
borderRadius:
"10px",
}} }}
></Box> className="hero-carousel-info-rating"
} >
className="hero-carousel-info" {!!item.CommunityRating ? (
> <>
<Typography <MdiStar
variant="subtitle1" sx={{
// color="GrayText" color: yellow[700],
> }}
{!!item.ProductionYear />
? item.ProductionYear <Typography variant="subtitle1">
: "Unknown"} {Math.round(
</Typography> item.CommunityRating *
<Chip 10,
variant="outlined" ) /
label={ 10}
!!item.OfficialRating </Typography>
? item.OfficialRating </>
: "Not Rated" ) : (
}
/>
<Box
sx={{
display: "flex",
gap: "0.25em",
alignItems:
"center",
}}
className="hero-carousel-info-rating"
>
{!!item.CommunityRating ? (
<>
<MdiStar
sx={{
color: yellow[700],
}}
/>
<Typography variant="subtitle1"> <Typography variant="subtitle1">
{Math.round( No
item.CommunityRating * Community
10, Rating
) /
10}
</Typography> </Typography>
</> )}
) : ( </Box>
{!!item.RunTimeTicks && (
<Typography variant="subtitle1"> <Typography variant="subtitle1">
No {getRuntime(
Community item.RunTimeTicks,
Rating )}
</Typography> </Typography>
)} )}
</Box> {!!item.RunTimeTicks && (
{!!item.RunTimeTicks && ( <Typography variant="subtitle1">
<Typography variant="subtitle1"> {endsAt(
{getRuntime( item.RunTimeTicks,
item.RunTimeTicks, )}
)} </Typography>
</Typography> )}
)} </Stack>
{!!item.RunTimeTicks && ( <Typography
<Typography variant="subtitle1">
{endsAt(
item.RunTimeTicks,
)}
</Typography>
)}
</Stack>
<Typography
component={
motion.div
}
initial={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.25,
delay: 0.2,
}}
whileInView={{
y: 0,
opacity: 1,
}}
exit={{
y: 10,
opacity: 0,
}}
variant="subtitle1"
className="hero-carousel-text"
sx={{
display: "-webkit-box",
maxWidth:
"70%",
maxHeight:
"30%",
textOverflow:
"ellipsis",
overflow:
"hidden",
WebkitLineClamp:
"4",
WebkitBoxOrient:
"vertical",
opacity: 0.7,
}}
>
{item.Overview}
</Typography>
{item.UserData
.PlaybackPositionTicks >
0 && (
<Stack
component={ component={
motion.div motion.div
} }
@@ -534,7 +495,7 @@ const Home = () => {
}} }}
transition={{ transition={{
duration: 0.25, duration: 0.25,
delay: 0.3, delay: 0.2,
}} }}
whileInView={{ whileInView={{
y: 0, y: 0,
@@ -544,99 +505,144 @@ const Home = () => {
y: 10, y: 10,
opacity: 0, opacity: 0,
}} }}
direction="row" variant="subtitle1"
gap="1em" className="hero-carousel-text"
mt={2} sx={{
width="50%" display: "-webkit-box",
alignItems="center" maxWidth:
justifyContent="center" "70%",
maxHeight:
"30%",
textOverflow:
"ellipsis",
overflow:
"hidden",
WebkitLineClamp:
"4",
WebkitBoxOrient:
"vertical",
opacity: 0.7,
}}
> >
<Typography {item.Overview}
variant="subtitle1" </Typography>
whiteSpace="nowrap"
{item.UserData
.PlaybackPositionTicks >
0 && (
<Stack
component={
motion.div
}
initial={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.25,
delay: 0.3,
}}
whileInView={{
y: 0,
opacity: 1,
}}
exit={{
y: 10,
opacity: 0,
}}
direction="row"
gap="1em"
mt={2}
width="50%"
alignItems="center"
justifyContent="center"
> >
{getRuntime( <Typography
item.RunTimeTicks - variant="subtitle1"
whiteSpace="nowrap"
>
{getRuntime(
item.RunTimeTicks -
item
.UserData
.PlaybackPositionTicks,
)}{" "}
</Typography>
<LinearProgress
variant="determinate"
value={
item item
.UserData .UserData
.PlaybackPositionTicks, .PlayedPercentage
)}{" "} }
</Typography> color="white"
<LinearProgress sx={{
variant="determinate" borderRadius: 1,
value={ height: "2.5px",
item width: "100%",
.UserData }}
.PlayedPercentage />
</Stack>
)}
{/* TODO Link PLay and More info buttons in carousel */}
<Box
component={
motion.div
}
initial={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.25,
delay: 0.4,
}}
whileInView={{
y: 0,
opacity: 1,
}}
exit={{
y: 10,
opacity: 0,
}}
sx={{
display: "flex",
gap: 3,
mt: 3,
}}
className="hero-carousel-button-container"
>
<Button
variant="contained"
endIcon={
<MdiPlayOutline />
} }
disabled
>
Play
</Button>
<Button
color="white" color="white"
sx={{ variant="outlined"
borderRadius: 1, endIcon={
height: "2.5px", <MdiChevronRight />
width: "100%", }
}} onClick={() =>
/> navigate(
</Stack> `/item/${item.Id}`,
)} )
{/* TODO Link PLay and More info buttons in carousel */} }
<Box >
component={ More info
motion.div </Button>
} </Box>
initial={{
y: 10,
opacity: 0,
}}
transition={{
duration: 0.25,
delay: 0.4,
}}
whileInView={{
y: 0,
opacity: 1,
}}
exit={{
y: 10,
opacity: 0,
}}
sx={{
display: "flex",
gap: 3,
mt: 3,
}}
className="hero-carousel-button-container"
>
<Button
variant="contained"
endIcon={
<MdiPlayOutline />
}
disabled
>
Play
</Button>
<Button
color="white"
variant="outlined"
endIcon={
<MdiChevronRight />
}
onClick={() =>
navigate(
`/item/${item.Id}`,
)
}
>
More info
</Button>
</Box> </Box>
</Box> </Paper>
</Paper> </ErrorBoundary>
</ErrorBoundary> );
); })}
}) </Carousel>
)} )}
</Carousel>
<Box <Box
className="padded-container" className="padded-container"
sx={{ sx={{
+10 -40
View File
@@ -68,6 +68,7 @@ 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 { Tooltip } from "@mui/material"; import { Tooltip } from "@mui/material";
import { useBackdropStore } from "../../utils/store/backdrop";
function TabPanel(props) { function TabPanel(props) {
const { children, value, index, ...other } = props; const { children, value, index, ...other } = props;
@@ -533,10 +534,19 @@ const ItemDetail = () => {
state.setSelectedSubtitleTrack, state.setSelectedSubtitleTrack,
]); ]);
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
const [directors, setDirectors] = useState([]); const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]); const [writers, setWriters] = useState([]);
useEffect(() => { useEffect(() => {
if (item.isSuccess) { if (item.isSuccess) {
setAppBackdrop(
item.data.Type === BaseItemKind.MusicAlbum ||
item.data.Type === BaseItemKind.Episode
? `${window.api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
: `${window.api.basePath}/Items/${item.data.Id}/Images/Backdrop`,
item.data.Id,
);
let direTp = item.data.People.filter( let direTp = item.data.People.filter(
(itm) => itm.Type == "Director", (itm) => itm.Type == "Director",
); );
@@ -566,46 +576,6 @@ 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"
+2 -2
View File
@@ -48,8 +48,8 @@ body {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
filter: blur(50px); z-index: -1;
filter: blur(80px);
&-container { &-container {
position: fixed; position: fixed;
width: 100vw; width: 100vw;