From f711440de32f38734a840c25bfc4e2bf0ec7713a Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Sat, 9 Sep 2023 15:19:19 +0530 Subject: [PATCH] Update Title Page #160 --- src/components/buttons/likeButton.jsx | 1 - src/components/buttons/markPlayedButton.jsx | 1 - src/components/card/card.jsx | 23 +-- src/components/layouts/item/hero.jsx | 205 ++++++++++++++----- src/components/layouts/item/hero.module.scss | 50 +++++ src/components/utils/iconsCollection.jsx | 1 + src/routes/item/index.jsx | 87 ++++++++ src/theme.js | 7 + 8 files changed, 296 insertions(+), 79 deletions(-) create mode 100644 src/components/layouts/item/hero.module.scss diff --git a/src/components/buttons/likeButton.jsx b/src/components/buttons/likeButton.jsx index c7d0af9..616d0bc 100644 --- a/src/components/buttons/likeButton.jsx +++ b/src/components/buttons/likeButton.jsx @@ -66,7 +66,6 @@ const LikeButton = ({ itemId, isFavorite, queryKey, userId, itemName }) => { opacity: mutation.isLoading ? 1 : 0, transition: "opacity 200ms", }} - disableShrink /> { diff --git a/src/components/buttons/markPlayedButton.jsx b/src/components/buttons/markPlayedButton.jsx index 4999344..100dc18 100644 --- a/src/components/buttons/markPlayedButton.jsx +++ b/src/components/buttons/markPlayedButton.jsx @@ -64,7 +64,6 @@ const MarkPlayedButton = ({ itemId, isPlayed, queryKey, userId, itemName }) => { opacity: mutation.isLoading ? 1 : 0, transition: "opacity 200ms", }} - disableShrink /> { diff --git a/src/components/card/card.jsx b/src/components/card/card.jsx index 1ed3b8f..5fa6840 100644 --- a/src/components/card/card.jsx +++ b/src/components/card/card.jsx @@ -1,5 +1,4 @@ /** @format */ -import React, { useRef, useState } from "react"; import PropTypes from "prop-types"; import { useNavigate } from "react-router-dom"; @@ -7,31 +6,16 @@ import { useNavigate } from "react-router-dom"; import Box from "@mui/material/Box"; import Stack from "@mui/material/Stack"; import MuiCard from "@mui/material/Card"; -import CardMedia from "@mui/material/CardMedia"; import CardActionArea from "@mui/material/CardActionArea"; import Typography from "@mui/material/Typography"; import LinearProgress from "@mui/material/LinearProgress"; -import Chip from "@mui/material/Chip"; -import ButtonGroup from "@mui/material/ButtonGroup"; -import IconButton from "@mui/material/IconButton"; import { Blurhash } from "react-blurhash"; -import { green, pink } from "@mui/material/colors"; -import { - MediaCollectionTypeIconCollectionCard, - TypeIconCollectionCard, -} from "../utils/iconsCollection"; - -import { borderRadiusDefault } from "../../palette.module.scss"; +import { TypeIconCollectionCard } from "../utils/iconsCollection"; import "./card.module.scss"; import { MdiCheck } from "../icons/mdiCheck"; -import { getPlaystateApi } from "@jellyfin/sdk/lib/utils/api/playstate-api"; -import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api"; -import { MdiHeartOutline } from "../icons/mdiHeartOutline"; -import { MdiHeart } from "../icons/mdiHeart"; -import useIntersecting from "../../utils/hooks/useIntersecting"; import LikeButton from "../buttons/likeButton"; import MarkPlayedButton from "../buttons/markPlayedButton"; import PlayButton from "../buttons/playButton"; @@ -58,8 +42,6 @@ export const Card = ({ disablePadding, overrideIcon, }) => { - const ref = useRef(); - const isVisible = useIntersecting(ref); const navigate = useNavigate(); const defaultOnClick = () => navigate(`/item/${item.Id}`); return ( @@ -69,7 +51,6 @@ export const Card = ({ onClick={!!onClick ? onClick : defaultOnClick} > { +import "./hero.module.scss"; +import { Blurhash } from "react-blurhash"; +import { MediaTypeIconCollection } from "../../utils/iconsCollection"; + +const Hero = ({ + item, + queryKey, + userId, + writers = [], + directors = [], + artists = [], +}) => { return ( -
+
+
+ {!!item.ImageBlurHashes.Backdrop && ( + <> + {Object.keys(item.ImageBlurHashes.Backdrop) + .length != 0 && ( + + )} + (e.target.style.opacity = 1)} + loading="eager" + /> + + )} +
+ {MediaTypeIconCollection[item.Type]} +
+
{ } hideText disablePadding + disableOverlay + onClick={() => {}} />
{ marginTop: "4em", }} > - + {item.Name}
@@ -150,7 +206,7 @@ const Hero = ({ item, queryKey, userId, writers, directors, artists }) => {
{
+ + {item.Taglines[0]} + {item.Overview} @@ -197,61 +256,95 @@ const Hero = ({ item, queryKey, userId, writers, directors, artists }) => { style={{ marginTop: "2em", alignSelf: "flex-end", + width: "100%", }} > -
- 0 && ( +
- Written by - - - {writers - .map((writer) => writer.Name) - .join(", ")} - -
-
- + Written by + + + {writers + .map((writer) => writer.Name) + .join(", ")} + +
+ )} + {directors.length > 0 && ( +
- Directed by - - - {directors - .map((director) => director.Name) - .join(", ")} - -
+ + Directed by + + + {directors + .map((director) => director.Name) + .join(", ")} + +
+ )} + {artists.length > 0 && ( +
+ + Artists + + + {artists + .map((director) => director.Name) + .join(", ")} + +
+ )}
diff --git a/src/components/layouts/item/hero.module.scss b/src/components/layouts/item/hero.module.scss new file mode 100644 index 0000000..85b1caf --- /dev/null +++ b/src/components/layouts/item/hero.module.scss @@ -0,0 +1,50 @@ +/** @format */ +$maskPercentage: 40%; +.hero { + position: relative; + &-backdrop { + position: absolute; + width: 100%; + height: 100vh; + top: 0; + left: 0; + z-index: -1; + filter: brightness(0.5); + mask-image: linear-gradient( + to bottom, + black $maskPercentage, + transparent + ), + linear-gradient(to left, black $maskPercentage, transparent); + -webkit-mask-image: linear-gradient( + to bottom, + black $maskPercentage, + transparent + ), + linear-gradient(to left, black $maskPercentage, transparent); + mask-composite: source-in; + -webkit-mask-composite: source-in; + & > * { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + width: 100%; + height: 100%; + } + &-image { + object-fit: cover; + z-index: 1; + } + &-blurhash { + z-index: 0; + } + &-icon { + &-container { + background: $clr-gradient-dark; + z-index: -1; + } + } + } +} diff --git a/src/components/utils/iconsCollection.jsx b/src/components/utils/iconsCollection.jsx index 97af6b0..47b4d7c 100644 --- a/src/components/utils/iconsCollection.jsx +++ b/src/components/utils/iconsCollection.jsx @@ -68,6 +68,7 @@ export const MediaTypeIconCollection = { }; export const TypeIconCollectionCard = { + Actor: , AggregateFolder: , Audio: , AudioBook: , diff --git a/src/routes/item/index.jsx b/src/routes/item/index.jsx index 3df8224..014fc75 100644 --- a/src/routes/item/index.jsx +++ b/src/routes/item/index.jsx @@ -580,6 +580,9 @@ const ItemDetail = () => { className="scrollY" style={{ padding: "5em 2em 2em 1em", + display: "flex", + flexDirection: "column", + gap: "0.5em", }} > { writers={writers} directors={directors} /> + + {item.data.People.map((person, index) => { + return ( + + ); + })} + + + {similarItems.data.Items.map((similar, index) => { + return ( + + ); + })} + ); } diff --git a/src/theme.js b/src/theme.js index 8a9900c..c4265a1 100644 --- a/src/theme.js +++ b/src/theme.js @@ -42,5 +42,12 @@ export const theme = createTheme({ }, }, }, + MuiChip: { + styleOverrides: { + root: { + backdropFilter: "blur(5px)", + }, + }, + }, }, });