Improve hero carousel [1/-] #136

This commit is contained in:
Prayag Prajapati committed 2023-08-13 21:22:09 +05:30
1 parent 7a7e5b3751
commit e2ebbd4471
5 files changed
+134 -65

No files matched your search

+6 -1
View File
@@ -356,7 +356,12 @@ function App() {
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<AnimatePresence> <AnimatePresence>
<div style={{ display: "flex" }}> <div
style={{
display: "flex",
width: "calc(100vw - 14px)",
}}
>
<CssBaseline /> <CssBaseline />
<SideMenu /> <SideMenu />
<AppBar /> <AppBar />
+5 -1
View File
@@ -9,7 +9,7 @@ export const CarouselSkeleton = () => {
<Paper <Paper
className="hero-carousel-slide" className="hero-carousel-slide"
sx={{ sx={{
background: theme.palette.primary.background.dark, background: theme.palette.primary.background.main,
}} }}
> >
<div className="hero-carousel-background"> <div className="hero-carousel-background">
@@ -17,6 +17,10 @@ export const CarouselSkeleton = () => {
variant="rectangular" variant="rectangular"
height="100%" height="100%"
animation="wave" animation="wave"
sx={{
width: "100vw",
height: "100vh",
}}
></Skeleton> ></Skeleton>
</div> </div>
<Box className="hero-carousel-detail"> <Box className="hero-carousel-detail">
+25 -26
View File
@@ -1,5 +1,4 @@
/** @format */ /** @format */
.home { .home {
&-background { &-background {
&-container { &-container {
@@ -23,8 +22,8 @@
isolation: isolate; isolation: isolate;
&-slide { &-slide {
position: relative; position: relative;
height: 70vh; height: 100%;
border-radius: 10px !important; border-radius: 0px !important;
overflow: hidden; overflow: hidden;
margin: 0 auto; margin: 0 auto;
} }
@@ -34,6 +33,7 @@
height: 100%; height: 100%;
position: absolute; position: absolute;
z-index: 1; z-index: 1;
filter: brightness(0.7);
} }
&-container { &-container {
position: absolute; position: absolute;
@@ -42,16 +42,7 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
mask-image: linear-gradient( opacity: 0.8;
to right,
rgba(0, 0, 0, 0.1),
black 90%
);
-webkit-mask-image: linear-gradient(
to right,
rgba(0, 0, 0, 0.1),
black 90%
);
} }
&-image { &-image {
position: absolute; position: absolute;
@@ -63,19 +54,20 @@
bottom: 0; bottom: 0;
background-position: center; background-position: center;
opacity: 1; opacity: 1;
mask-image: linear-gradient( &::after {
to right, content: "";
transparent 2%, position: absolute;
rgba(0, 0, 0, 0.5) 20%, top: 0;
black 70% left: 0;
); right: 0;
-webkit-mask-image: linear-gradient( bottom: 0;
to right, background: linear-gradient(
transparent 2%, to top,
rgba(0, 0, 0, 0.5) 20%, rgb(0 0 0 / 0.45),
black 70% transparent
); );
} }
}
&-icon { &-icon {
position: absolute; position: absolute;
font-size: 15em !important; font-size: 15em !important;
@@ -111,14 +103,21 @@
position: relative; position: relative;
z-index: 0; z-index: 0;
display: flex; display: flex;
height: 70vh; height: 100%;
width: 70%; width: 70%;
padding: 2em; padding: 2em;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: flex-end;
align-items: flex-start; align-items: flex-start;
padding-bottom: 5em;
} }
&-indicator { &-indicator {
&-container {
width: calc(100% - 2em) !important;
margin-top: -1em !important;
margin-left: 1em !important;
margin-right: 1em !important;
}
width: 100%; width: 100%;
height: 5px; height: 5px;
border-radius: 0; border-radius: 0;
+96 -35
View File
@@ -18,7 +18,7 @@ import Button from "@mui/material/Button";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Chip from "@mui/material/Chip"; import Chip from "@mui/material/Chip";
import Divider from "@mui/material/Divider"; import LinearProgress from "@mui/material/LinearProgress";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import { yellow } from "@mui/material/colors"; import { yellow } from "@mui/material/colors";
@@ -204,11 +204,9 @@ const Home = () => {
<> <>
<Box <Box
component="main" component="main"
className="scrollY" className="scrollY home"
sx={{ sx={{
flexGrow: 1, flexGrow: 1,
pt: 11,
px: 3,
pb: 3, pb: 3,
position: "relative", position: "relative",
}} }}
@@ -269,9 +267,9 @@ const Home = () => {
</Carousel> */} </Carousel> */}
<Carousel <Carousel
className="hero-carousel" className="hero-carousel"
autoPlay={true} autoPlay={false}
animation="fade" animation="fade"
height="70vh" height="100vh"
IndicatorIcon={ IndicatorIcon={
<div className="hero-carousel-indicator"></div> <div className="hero-carousel-indicator"></div>
} }
@@ -289,9 +287,12 @@ const Home = () => {
}, },
}} }}
indicatorContainerProps={{ indicatorContainerProps={{
className: "hero-carousel-indicator-container",
style: { style: {
position: "absolute",
display: "flex", display: "flex",
gap: "1em", gap: "1em",
zIndex: 1,
}, },
}} }}
sx={{ sx={{
@@ -421,7 +422,7 @@ const Home = () => {
</div> </div>
<Box className="hero-carousel-detail"> <Box className="hero-carousel-detail">
<Typography <Typography
variant="h3" variant="h2"
className="hero-carousel-text" className="hero-carousel-text"
sx={{ sx={{
mb: 2.5, mb: 2.5,
@@ -459,13 +460,27 @@ const Home = () => {
direction="row" direction="row"
gap={1} gap={1}
divider={ divider={
<Divider <Box
variant="middle" sx={{
component="div" width: "4px",
orientation="vertical" height: "4px",
flexItem background:
/> "white",
alignSelf:
"center",
aspectRatio: 1,
borderRadius:
"10px",
}}
></Box>
} }
// <Divider
// variant="middle"
// component="div"
// orientation="vertical"
// flexItem
// />
className="hero-carousel-info" className="hero-carousel-info"
> >
<Typography <Typography
@@ -553,6 +568,25 @@ const Home = () => {
> >
{item.Overview} {item.Overview}
</Typography> </Typography>
{item.UserData
.PlaybackPositionTicks >
0 && (
<LinearProgress
variant="determinate"
value={
item
.UserData
.PlayedPercentage
}
color="white"
sx={{
mt: 2,
borderRadius: 1,
width: "50%",
}}
/>
)}
{/* TODO Link PLay and More info buttons in carousel */} {/* TODO Link PLay and More info buttons in carousel */}
<Box <Box
sx={{ sx={{
@@ -593,12 +627,19 @@ const Home = () => {
}) })
)} )}
</Carousel> </Carousel>
<Box
className="padded-container"
sx={{
px: 3,
}}
>
{libraries.isLoading ? ( {libraries.isLoading ? (
<CardsSkeleton /> <CardsSkeleton />
) : ( ) : (
<CardScroller displayCards={4} title="Libraries"> <CardScroller displayCards={4} title="Libraries">
{libraries.status == "success" && {libraries.status == "success" &&
libraries.data.Items.map((item, index) => { libraries.data.Items.map(
(item, index) => {
return ( return (
<Card <Card
key={index} key={index}
@@ -606,11 +647,15 @@ const Home = () => {
itemId={item.Id} itemId={item.Id}
// imageTags={false} // imageTags={false}
imageTags={ imageTags={
!!item.ImageTags.Primary !!item
.ImageTags
.Primary
} }
cardType="lib" cardType="lib"
cardOrientation="landscape" cardOrientation="landscape"
iconType={item.CollectionType} iconType={
item.CollectionType
}
onClickEvent={() => { onClickEvent={() => {
navigate( navigate(
`/library/${item.Id}`, `/library/${item.Id}`,
@@ -620,7 +665,8 @@ const Home = () => {
item.ImageBlurHashes == item.ImageBlurHashes ==
{} {}
? "" ? ""
: !!item.ImageTags : !!item
.ImageTags
.Primary .Primary
? !!item ? !!item
.ImageBlurHashes .ImageBlurHashes
@@ -635,10 +681,13 @@ const Home = () => {
: "" : ""
: "" : ""
} }
currentUser={user.data} currentUser={
user.data
}
></Card> ></Card>
); );
})} },
)}
</CardScroller> </CardScroller>
)} )}
{upNextItems.isLoading ? ( {upNextItems.isLoading ? (
@@ -648,7 +697,8 @@ const Home = () => {
<></> <></>
) : ( ) : (
<CardScroller displayCards={4} title="Up Next"> <CardScroller displayCards={4} title="Up Next">
{upNextItems.data.Items.map((item, index) => { {upNextItems.data.Items.map(
(item, index) => {
return ( return (
<Card <Card
key={index} key={index}
@@ -664,7 +714,8 @@ const Home = () => {
} }
// imageTags={false} // imageTags={false}
imageTags={ imageTags={
!!item.ImageTags.Primary !!item.ImageTags
.Primary
} }
cardType="thumb" cardType="thumb"
iconType={item.Type} iconType={item.Type}
@@ -680,11 +731,14 @@ const Home = () => {
} }
cardOrientation="landscape" cardOrientation="landscape"
blurhash={ blurhash={
item.ImageBlurHashes == {} item.ImageBlurHashes ==
{}
? "" ? ""
: !!item.ImageTags : !!item
.ImageTags
.Primary .Primary
? !!item.ImageBlurHashes ? !!item
.ImageBlurHashes
.Primary .Primary
? item ? item
.ImageBlurHashes .ImageBlurHashes
@@ -698,11 +752,13 @@ const Home = () => {
} }
currentUser={user.data} currentUser={user.data}
favourite={ favourite={
item.UserData.IsFavorite item.UserData
.IsFavorite
} }
></Card> ></Card>
); );
})} },
)}
</CardScroller> </CardScroller>
)} )}
{resumeItemsVideo.isLoading ? ( {resumeItemsVideo.isLoading ? (
@@ -762,7 +818,8 @@ const Home = () => {
item.ImageBlurHashes == item.ImageBlurHashes ==
{} {}
? "" ? ""
: !!item.ImageTags : !!item
.ImageTags
.Backdrop .Backdrop
? !!item ? !!item
.ImageBlurHashes .ImageBlurHashes
@@ -779,7 +836,8 @@ const Home = () => {
} }
currentUser={user.data} currentUser={user.data}
favourite={ favourite={
item.UserData.IsFavorite item.UserData
.IsFavorite
} }
></Card> ></Card>
); );
@@ -813,10 +871,13 @@ const Home = () => {
} }
// imageTags={false} // imageTags={false}
imageTags={ imageTags={
!!item.ImageTags.Primary !!item.ImageTags
.Primary
} }
iconType={item.Type} iconType={item.Type}
subText={item.ProductionYear} subText={
item.ProductionYear
}
playedPercent={ playedPercent={
item.UserData item.UserData
.PlayedPercentage .PlayedPercentage
@@ -826,7 +887,8 @@ const Home = () => {
item.ImageBlurHashes == item.ImageBlurHashes ==
{} {}
? "" ? ""
: !!item.ImageTags : !!item
.ImageTags
.Primary .Primary
? !!item ? !!item
.ImageBlurHashes .ImageBlurHashes
@@ -843,7 +905,8 @@ const Home = () => {
} }
currentUser={user.data} currentUser={user.data}
favourite={ favourite={
item.UserData.IsFavorite item.UserData
.IsFavorite
} }
></Card> ></Card>
); );
@@ -859,9 +922,7 @@ const Home = () => {
/> />
); );
})} })}
<Button variant="contained" onClick={handleLogout}> </Box>
Logout
</Button>
</Box> </Box>
</> </>
); );
+2 -2
View File
@@ -16,7 +16,7 @@ div::-webkit-scrollbar {
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background-color: transparent; background-color: transparent;
&:hover { &:hover {
background-color: rgb(255 255 255 / 0.15); background-color: rgb(255 255 255 / 0.1);
} }
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
@@ -25,7 +25,7 @@ div::-webkit-scrollbar {
border-radius: 9999px; border-radius: 9999px;
background-color: rgb(255 255 255 / 0.25); background-color: rgb(255 255 255 / 0.25);
&:hover { &:hover {
background-color: rgb(255 255 255 / 0.35); background-color: rgb(255 255 255 / 0.45);
} }
} }