From b8dc3828e8565e59c0403fcd0859b411d3a0dd27 Mon Sep 17 00:00:00 2001 From: prayag17 Date: Sat, 8 Apr 2023 19:14:57 +0530 Subject: [PATCH] Add more details to ItemMovie #26 --- src/routes/item/Movie/Movie.module.scss | 62 ++++++ src/routes/item/Movie/root.jsx | 264 ++++++++++++++++++------ 2 files changed, 264 insertions(+), 62 deletions(-) create mode 100644 src/routes/item/Movie/Movie.module.scss diff --git a/src/routes/item/Movie/Movie.module.scss b/src/routes/item/Movie/Movie.module.scss new file mode 100644 index 0000000..bedb937 --- /dev/null +++ b/src/routes/item/Movie/Movie.module.scss @@ -0,0 +1,62 @@ +/** @format */ + +.item-detail { + &-backdrop { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: -2; + opacity: 0.1; + } + &-header { + display: flex; + gap: 2em; + justify-content: flex-start; + align-items: flex-end; + position: relative; + &-backdrop { + position: absolute; + width: 100%; + height: 150%; + top: -88px; + width: 100vw; + left: -24px; + z-index: -1; + filter: brightness(0.3); + mask-image: linear-gradient(0deg, transparent, black); + -webkit-mask-image: linear-gradient(0deg, transparent, black); + } + } + &-image { + width: 100%; + height: 100%; + object-fit: cover; + position: absolute; + transition: opacity $transition-time-default; + &-blurhash { + z-index: -1; + } + &-container { + width: 15%; + position: relative; + aspect-ratio: 0.666; + border-radius: $border-radius-default; + overflow: hidden; + box-shadow: 0 0 15px rgb(0 0 0 / 0.4); + } + &-icon-container { + background: $clr-gradient-dark; + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + display: flex; + align-items: center; + justify-content: center; + z-index: -2; + } + } +} diff --git a/src/routes/item/Movie/root.jsx b/src/routes/item/Movie/root.jsx index 49d6469..f3f408e 100644 --- a/src/routes/item/Movie/root.jsx +++ b/src/routes/item/Movie/root.jsx @@ -9,7 +9,12 @@ import Chip from "@mui/material/Chip"; import useScrollTrigger from "@mui/material/useScrollTrigger"; import Divider from "@mui/material/Divider"; -import { setBackdrop, showAppBar } from "../../../utils/slice/appBar"; +import { Blurhash } from "react-blurhash"; +import { + setBackdrop, + showAppBar, + showBackButton, +} from "../../../utils/slice/appBar"; import { useDispatch, useSelector } from "react-redux"; import { useParams } from "react-router-dom"; @@ -18,12 +23,20 @@ import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api" import { useQuery } from "@tanstack/react-query"; import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull"; import { getRuntimeFull } from "../../../utils/date/time"; +import { TypeIconCollectionCard } from "../../../components/utils/iconsCollection"; + +import { Card } from "../../../components/card/card"; +import { CardScroller } from "../../../components/cardScroller/cardScroller"; + +import "./Movie.module.scss"; const ItemMovie = () => { const { id } = useParams(); const dispatch = useDispatch(); const appBarVisiblity = useSelector((state) => state.appBar.visible); const [scrollTarget, setScrollTarget] = useState(undefined); + const [primageImageLoaded, setPrimaryImageLoaded] = useState(false); + const [backdropImageLoaded, setBackdropImageLoaded] = useState(false); const trigger = useScrollTrigger({ disableHysteresis: true, @@ -35,7 +48,9 @@ const ItemMovie = () => { if (!appBarVisiblity) { dispatch(showAppBar()); } + console.log(trigger); dispatch(setBackdrop(trigger)); + dispatch(showBackButton()); }, [trigger]); const user = useQuery({ @@ -78,80 +93,205 @@ const ItemMovie = () => { recomponent="main" className="scrollY" sx={{ - flexGrow: 1, + display: "flex", pt: 11, px: 3, pb: 3, position: "relative", + flexFlow: "column", + gap: 5, }} - f={(node) => { + ref={(node) => { if (node) { setScrollTarget(node); } }} > - - - - {item.data.Name} - - - - } - ex={{ alignItems: "center" }} - > - - {item.data.ProductionYear} - - + {item.data.BackdropImageTags.length != 0 && ( + - - {!!item.data.CommunityRating ? ( - <> - - - {Math.round( - item.data - .CommunityRating * - 10, - ) / 10} - - - ) : ( - - No Community Rating - - )} - - - {getRuntimeFull(item.data.RunTimeTicks)} - - + className="card-image-blurhash" + /> + )} + + + {item.data.BackdropImageTags.length != 0 && ( + + setBackdropImageLoaded(true) + } + /> + )} + {item.data.BackdropImageTags.length != 0 && ( + + )} +
+ {TypeIconCollectionCard[item.data.Type]} +
+
+ + {!!item.data.ImageTags.Primary && ( + + setPrimaryImageLoaded(true) + } + /> + )} + {!!item.data.ImageBlurHashes.Primary && ( + + )} +
+ {TypeIconCollectionCard[item.data.Type]} +
+
+ + + + {item.data.Name} + + + + } + ex={{ alignItems: "center" }} + > + + {item.data.ProductionYear} + + + + {!!item.data.CommunityRating ? ( + <> + + + {Math.round( + item.data + .CommunityRating * + 10, + ) / 10} + + + ) : ( + + No Community Rating + + )} + + + {getRuntimeFull(item.data.RunTimeTicks)} + + + +
+ + {item.data.Overview} + + + {item.data.People.map((person, index) => { + return ( + + ); + })} + ); }