From dbb6e272b17a33108eac1a5cf961affef1660d45 Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Sun, 14 Jan 2024 22:06:43 +0530 Subject: [PATCH] chore(web): add new person page #243 --- src/App.tsx | 2 +- src/components/card/actorCards.jsx | 3 - .../notices/errorNotice/errorNotice.jsx | 21 --- src/routes/person/index.jsx | 117 +++++++++++---- src/routes/person/person.module.scss | 139 ++++++++++++++++++ vite.config.js | 1 + 6 files changed, 226 insertions(+), 57 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index fa2b868..d624dff 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -436,7 +436,7 @@ function AppReady() { {/* */} - + {/* { > {error.message} - - - Note: You need to click on CLOSE button if you change the page in order - to close this error message - ); }; diff --git a/src/routes/person/index.jsx b/src/routes/person/index.jsx index 45cd81e..10689a4 100644 --- a/src/routes/person/index.jsx +++ b/src/routes/person/index.jsx @@ -1,5 +1,5 @@ import PropTypes from "prop-types"; -import React, { useState, useEffect } from "react"; +import React, { useState, useEffect, useLayoutEffect } from "react"; import Box from "@mui/material/Box"; import CircularProgress from "@mui/material/CircularProgress"; @@ -25,9 +25,14 @@ import { useQuery } from "@tanstack/react-query"; import { Card } from "../../components/card/card"; import Hero from "../../components/layouts/item/hero"; +import { Blurhash } from "react-blurhash"; + +import LikeButton from "../../components/buttons/likeButton"; import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice"; import { useApi } from "../../utils/store/api"; -import { useBackdropStore } from "../../utils/store/backdrop"; +import { setBackdrop } from "../../utils/store/backdrop"; + +import meshBg from "../../assets/herobg.png"; import "./person.module.scss"; function TabPanel(props) { @@ -206,7 +211,7 @@ const PersonTitlePage = () => { }, ]; - useEffect(() => { + useLayoutEffect(() => { if ( personMovies.isSuccess && personShows.isSuccess && @@ -226,23 +231,11 @@ const PersonTitlePage = () => { setActivePersonTab(4); } } - }); - const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]); + setBackdrop("", ""); + }, []); const [animationDirection, setAnimationDirection] = useState("forward"); - useEffect(() => { - if (item.isSuccess) { - setAppBackdrop( - item.data.Type === BaseItemKind.MusicAlbum || - item.data.Type === BaseItemKind.Episode - ? `${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop` - : `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`, - item.data.Id, - ); - } - }); - if (item.isPending) { return ( { duration: 0.25, ease: "easeInOut", }} - className="scrollY" - style={{ - padding: "5em 2em 2em 1em", - display: "flex", - flexDirection: "column", - gap: "0.5em", - }} + className="scrollY padded-top" > - +
+
+ {item.data.Name} { + e.currentTarget.style.opacity = 1; + }} + /> +
+
+ {Object.keys(item.data.ImageTags).includes("Primary") ? ( + <> + + {item.data.Name} { + e.currentTarget.style.opacity = 1; + }} + className="item-hero-image" + /> + + ) : ( + <> + )} +
+
+ {Object.keys(item.data.ImageTags).includes("Logo") ? ( + {item.data.Name} { + e.currentTarget.style.opacity = 1; + }} + className="item-hero-logo" + /> + ) : ( + {item.data.Name} + )} + + +
+
+ + {item.data.Overview ?? ""} + +