chore(web): add new person page #243

This commit is contained in:
Prayag Prajapati committed 2024-01-14 22:06:43 +05:30
1 parent 89f1a26ea7
commit dbb6e272b1
6 files changed
+226 -57

No files matched your search

+1 -1
View File
@@ -436,7 +436,7 @@ function AppReady() {
{/* <SideMenu /> */}
<AppBar />
<AudioPlayer key={audioPlayerVisible} />
<ErrorBoundary FallbackComponent={ErrorNotice}>
<ErrorBoundary FallbackComponent={ErrorNotice} key={location.key}>
<Routes location={location}>
{/* <Route
// key={location.key}
-3
View File
@@ -6,9 +6,6 @@ import CardActionArea from "@mui/material/CardActionArea";
import Typography from "@mui/material/Typography";
import { Blurhash } from "react-blurhash";
import { MdiAccountTie } from "../icons/mdiAccountTie";
import { useApi } from "../../utils/store/api";
import "./card.module.scss";
@@ -48,27 +48,6 @@ export const ErrorNotice = ({ error, resetErrorBoundary }) => {
>
{error.message}
</Typography>
<Button
size="large"
variant="contained"
onClick={resetErrorBoundary ? resetErrorBoundary : () => {}}
style={{
marginTop: "1em",
}}
color="info"
>
Close
</Button>
<Typography
variant="subitle1"
fontWeight={300}
style={{
marginTop: "1em",
}}
>
Note: You need to click on CLOSE button if you change the page in order
to close this error message
</Typography>
</Box>
);
};
+85 -32
View File
@@ -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 (
<Box
@@ -273,22 +266,82 @@ const PersonTitlePage = () => {
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
display: "flex",
flexDirection: "column",
gap: "0.5em",
}}
className="scrollY padded-top"
>
<Hero
item={item.data}
userId={user.data.Id}
queryKey={["item", id]}
disableInfoStrip
disablePlayButton
disableMarkAsPlayedButton
/>
<div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container">
<img
alt={item.data.Name}
src={meshBg}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
/>
</div>
<div
className="item-hero-image-container"
style={{
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
}}
>
{Object.keys(item.data.ImageTags).includes("Primary") ? (
<>
<Blurhash
hash={
item.data.ImageBlurHashes.Primary[
item.data.ImageTags.Primary
]
}
className="item-hero-image-blurhash"
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-image"
/>
</>
) : (
<></>
)}
</div>
<div className="item-hero-detail flex flex-column">
{Object.keys(item.data.ImageTags).includes("Logo") ? (
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
})}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-logo"
/>
) : (
<Typography variant="h3">{item.data.Name}</Typography>
)}
<LikeButton
itemName={item.data.Name}
itemId={item.data.Id}
queryKey={["item", id]}
isFavorite={item.data.UserData.IsFavorite}
userId={user.data.Id}
/>
</div>
</div>
<Typography variant="subtitle1" mx={1}>
{item.data.Overview ?? ""}
</Typography>
<div className="item-detail-person-container">
<div className="item-detail-person-header">
<Tabs
+139
View File
@@ -19,3 +19,142 @@
.col-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.item {
gap: 1em;
&-hero {
height: 50vh;
gap: 2em;
position: relative;
align-items: center;
&-image {
opacity: 0;
width: 100%;
object-fit: contain;
transition: opacity $transition-time-default;
&-container {
height: fit-content;
max-height: 100%;
overflow: hidden;
border-radius: $border-radius-default;
box-shadow: $shadow-card;
flex-grow: 1;
flex-shrink: 0;
position: relative;
width: 18% !important;
}
&-blurhash {
position: absolute !important;
width: 100% !important;
height: 100% !important;
z-index: -1;
}
}
&-logo {
max-width: 42rem;
max-height: 10rem;
opacity: 0;
transition: opacity $transition-time-default;
object-position: bottom;
}
&-detail {
width: 100%;
align-items: flex-start;
gap: 1em;
justify-content: end;
}
&-buttons {
&-container {
align-items: center;
justify-content: space-between;
width: 100%;
}
}
&-backdrop {
width: 100%;
height: 100%;
object-fit: cover;
object-position: top;
opacity: 0;
transition: opacity $transition-time-default;
&-container {
filter: brightness(0.8);
position: absolute;
top: -4.4em;
left: -1.6em;
width: 100vw;
height: calc(50vh + 4.4em);
z-index: -1;
mask-image: linear-gradient(to top, transparent, black);
-webkit-mask-image: linear-gradient(
to top,
transparent,
black
);
}
}
}
&-detail {
display: grid;
grid-template-columns: 1fr 5px 35%;
justify-items: center;
align-items: start;
gap: 1em;
&-cast {
&-container {
display: flex;
flex-direction: column;
gap: 1em;
}
&-grid {
display: grid;
grid-template-columns: repeat(5, minmax(0, 1fr));
gap: 1em;
margin-bottom: 1em;
}
&-card {
display: grid;
grid-template-columns: 6em 1fr;
gap: 0.5em;
align-items: center;
color: white !important;
text-decoration: none;
padding: 0.5em;
background: rgb(255 255 255 / 0);
transition: background $transition-time-default;
border-radius: $border-radius-default;
&:hover {
background: rgb(255 255 255 / 0.1);
}
&-image,
&-icon {
width: 6em;
height: 6em;
object-fit: cover;
border-radius: 100%;
box-shadow: $shadow-card-image;
}
&-icon {
display: flex;
align-items: center;
justify-content: center;
font-size: 1em;
background: rgb(255 255 255 / 0.1);
.material-symbols-rounded {
font-size: 3em;
}
}
}
}
&-link {
color: white;
text-decoration-color: rgb(255 255 255 / 0.5);
&:hover {
text-decoration-color: white;
}
}
}
}
+1
View File
@@ -36,5 +36,6 @@ export default defineConfig({
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG,
cssCodeSplit: true
},
});