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>
</DialogActions>
</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
style={{
display: "flex",
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 />
<SideMenu />
<AppBar />
+3 -3
View File
@@ -129,8 +129,10 @@ export const SideMenu = ({}) => {
},
}}
sx={{
zIndex: 1,
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
@@ -139,7 +141,6 @@ export const SideMenu = ({}) => {
justifyContent: "center",
}}
></DrawerHeader>
<Divider />
{libraries.isLoading ? (
<>
<Skeleton
@@ -207,7 +208,6 @@ export const SideMenu = ({}) => {
)}
</List>
<List sx={{ marginTop: "auto" }}>
<Divider />
<Tooltip
title="Home"
placement="right"
+5 -1
View File
@@ -7,9 +7,13 @@ import { theme } from "../../theme";
export const CarouselSkeleton = () => {
return (
<Paper
className="hero-carousel-slide"
className="hero-carousel-skeleton"
elevation={0}
sx={{
height: "100vh",
position: "relative",
background: theme.palette.primary.background.main,
borderRadius: 0,
}}
>
<div className="hero-carousel-background">
+9 -5
View File
@@ -43,12 +43,16 @@
right: 0;
bottom: 0;
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(
to bottom,
black,
transparent
);
to bottom,
black 40%,
transparent
),
linear-gradient(to left, black 40%, transparent);
mask-composite: source-in;
-webkit-mask-composite: source-in;
}
&-image {
position: absolute;
+386 -380
View File
@@ -215,316 +215,277 @@ const Home = () => {
position: "relative",
}}
>
<Carousel
className="hero-carousel"
autoPlay={false}
animation="fade"
height="100vh"
IndicatorIcon={
<div className="hero-carousel-indicator"></div>
}
activeIndicatorIconButtonProps={{
style: {
background: "rgb(255 255 255)",
},
}}
indicatorIconButtonProps={{
style: {
background: "rgb(255 255 255 / 0.3)",
borderRadius: "2px",
width: "100%",
flexShrink: "1",
},
}}
indicatorContainerProps={{
className: "hero-carousel-indicator-container",
style: {
position: "absolute",
display: "flex",
gap: "1em",
zIndex: 1,
},
}}
sx={{
marginBottom: "1.5em",
}}
onChange={(now) => {
console.log(latestMedia.data[now]);
setAppBackdrop(
`${window.api.basePath}/Items/${latestMedia.data[now].Id}/Images/Backdrop`,
latestMedia.data[now].Id,
);
}}
duration={400}
interval={10000}
>
{latestMedia.isLoading ? (
<CarouselSkeleton />
) : (
// <></>
latestMedia.data.length != 0 &&
latestMedia.data.map((item, index) => {
return (
<ErrorBoundary
fallback={
<CarouselSlideError
itemName={item.Name}
/>
}
>
<Paper
className="hero-carousel-slide"
sx={{
background:
"transparent",
}}
key={index}
{latestMedia.isLoading ? (
<CarouselSkeleton />
) : (
<Carousel
className="hero-carousel"
autoPlay={false}
animation="fade"
height="100vh"
IndicatorIcon={
<div className="hero-carousel-indicator"></div>
}
activeIndicatorIconButtonProps={{
style: {
background: "rgb(255 255 255)",
},
}}
indicatorIconButtonProps={{
style: {
background: "rgb(255 255 255 / 0.3)",
borderRadius: "2px",
width: "100%",
flexShrink: "1",
},
}}
indicatorContainerProps={{
className:
"hero-carousel-indicator-container",
style: {
position: "absolute",
display: "flex",
gap: "1em",
zIndex: 1,
},
}}
sx={{
marginBottom: "1.5em",
}}
onChange={(now) => {
if (latestMedia.isSuccess) {
setAppBackdrop(
`${window.api.basePath}/Items/${latestMedia.data[now].Id}/Images/Backdrop`,
latestMedia.data[now].Id,
);
}
}}
changeOnFirstRender={true}
duration={400}
interval={10000}
>
{latestMedia.data.length != 0 &&
latestMedia.data.map((item, index) => {
return (
<ErrorBoundary
fallback={
<CarouselSlideError
itemName={item.Name}
/>
}
>
<div className="hero-carousel-background-container">
{Object.keys(
item.ImageBlurHashes
.Backdrop,
).length != 0 && (
<Blurhash
hash={
item
.ImageBlurHashes
.Backdrop[
Object.keys(
item
.ImageBlurHashes
.Backdrop,
)[0]
]
}
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
width="1080"
height="720"
resolutionX={
64
}
resolutionY={
96
}
className="hero-carousel-background-blurhash"
punch={1}
/>
)}
<div
className="hero-carousel-background-image"
style={{
backgroundImage: `url(${
window.api
.basePath +
"/Items/" +
item.Id +
"/Images/Backdrop"
})`,
}}
></div>
<div className="hero-carousel-background-icon-container">
{
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={
<Paper
className="hero-carousel-slide"
sx={{
background:
"transparent",
}}
key={index}
>
<div className="hero-carousel-background-container">
{Object.keys(
item
.ImageBlurHashes
.Backdrop,
).length != 0 && (
<Blurhash
hash={
item
.ImageBlurHashes
.Backdrop[
Object.keys(
item
.ImageBlurHashes
.Backdrop,
)[0]
]
}
// hash="LEHV6nWB2yk8pyo0adR*.7kCMdnj"
width="1080"
height="720"
resolutionX={
64
}
resolutionY={
96
}
className="hero-carousel-background-blurhash"
punch={1}
/>
)}
<div
className="hero-carousel-background-image"
style={{
backgroundImage: `url(${
window
.api
.basePath +
"/Items/" +
item.Id +
"/Images/Logo?quality=80&tag=" +
"/Images/Backdrop"
})`,
}}
></div>
<div className="hero-carousel-background-icon-container">
{
MediaTypeIconCollection[
item
.ImageTags
.Logo
.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
.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
sx={{
width: "4px",
height: "4px",
background:
"white",
alignSelf:
display: "flex",
gap: "0.25em",
alignItems:
"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"
}
/>
<Box
sx={{
display: "flex",
gap: "0.25em",
alignItems:
"center",
}}
className="hero-carousel-info-rating"
>
{!!item.CommunityRating ? (
<>
<MdiStar
sx={{
color: yellow[700],
}}
/>
className="hero-carousel-info-rating"
>
{!!item.CommunityRating ? (
<>
<MdiStar
sx={{
color: yellow[700],
}}
/>
<Typography variant="subtitle1">
{Math.round(
item.CommunityRating *
10,
) /
10}
</Typography>
</>
) : (
<Typography variant="subtitle1">
{Math.round(
item.CommunityRating *
10,
) /
10}
No
Community
Rating
</Typography>
</>
) : (
)}
</Box>
{!!item.RunTimeTicks && (
<Typography variant="subtitle1">
No
Community
Rating
{getRuntime(
item.RunTimeTicks,
)}
</Typography>
)}
</Box>
{!!item.RunTimeTicks && (
<Typography variant="subtitle1">
{getRuntime(
item.RunTimeTicks,
)}
</Typography>
)}
{!!item.RunTimeTicks && (
<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
{!!item.RunTimeTicks && (
<Typography variant="subtitle1">
{endsAt(
item.RunTimeTicks,
)}
</Typography>
)}
</Stack>
<Typography
component={
motion.div
}
@@ -534,7 +495,7 @@ const Home = () => {
}}
transition={{
duration: 0.25,
delay: 0.3,
delay: 0.2,
}}
whileInView={{
y: 0,
@@ -544,99 +505,144 @@ const Home = () => {
y: 10,
opacity: 0,
}}
direction="row"
gap="1em"
mt={2}
width="50%"
alignItems="center"
justifyContent="center"
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,
}}
>
<Typography
variant="subtitle1"
whiteSpace="nowrap"
{item.Overview}
</Typography>
{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(
item.RunTimeTicks -
<Typography
variant="subtitle1"
whiteSpace="nowrap"
>
{getRuntime(
item.RunTimeTicks -
item
.UserData
.PlaybackPositionTicks,
)}{" "}
</Typography>
<LinearProgress
variant="determinate"
value={
item
.UserData
.PlaybackPositionTicks,
)}{" "}
</Typography>
<LinearProgress
variant="determinate"
value={
item
.UserData
.PlayedPercentage
.PlayedPercentage
}
color="white"
sx={{
borderRadius: 1,
height: "2.5px",
width: "100%",
}}
/>
</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"
sx={{
borderRadius: 1,
height: "2.5px",
width: "100%",
}}
/>
</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"
variant="outlined"
endIcon={
<MdiChevronRight />
}
onClick={() =>
navigate(
`/item/${item.Id}`,
)
}
>
More info
</Button>
variant="outlined"
endIcon={
<MdiChevronRight />
}
onClick={() =>
navigate(
`/item/${item.Id}`,
)
}
>
More info
</Button>
</Box>
</Box>
</Box>
</Paper>
</ErrorBoundary>
);
})
)}
</Carousel>
</Paper>
</ErrorBoundary>
);
})}
</Carousel>
)}
<Box
className="padded-container"
sx={{
+10 -40
View File
@@ -68,6 +68,7 @@ import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
import { MdiMusic } from "../../components/icons/mdiMusic";
import { usePlaybackStore } from "../../utils/store/playback";
import { Tooltip } from "@mui/material";
import { useBackdropStore } from "../../utils/store/backdrop";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -533,10 +534,19 @@ const ItemDetail = () => {
state.setSelectedSubtitleTrack,
]);
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]);
useEffect(() => {
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(
(itm) => itm.Type == "Director",
);
@@ -566,46 +576,6 @@ 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"
+2 -2
View File
@@ -48,8 +48,8 @@ body {
position: absolute;
top: 0;
left: 0;
filter: blur(50px);
z-index: -1;
filter: blur(80px);
&-container {
position: fixed;
width: 100vw;