Add more details to ItemMovie #26
This commit is contained in:
2 files changed
+205
-3
No files matched your search
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,12 @@ import Chip from "@mui/material/Chip";
|
|||||||
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
import useScrollTrigger from "@mui/material/useScrollTrigger";
|
||||||
import Divider from "@mui/material/Divider";
|
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 { useDispatch, useSelector } from "react-redux";
|
||||||
import { useParams } from "react-router-dom";
|
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 { useQuery } from "@tanstack/react-query";
|
||||||
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
import { MdiStarHalfFull } from "../../../components/icons/mdiStarHalfFull";
|
||||||
import { getRuntimeFull } from "../../../utils/date/time";
|
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 ItemMovie = () => {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
const appBarVisiblity = useSelector((state) => state.appBar.visible);
|
||||||
const [scrollTarget, setScrollTarget] = useState(undefined);
|
const [scrollTarget, setScrollTarget] = useState(undefined);
|
||||||
|
const [primageImageLoaded, setPrimaryImageLoaded] = useState(false);
|
||||||
|
const [backdropImageLoaded, setBackdropImageLoaded] = useState(false);
|
||||||
|
|
||||||
const trigger = useScrollTrigger({
|
const trigger = useScrollTrigger({
|
||||||
disableHysteresis: true,
|
disableHysteresis: true,
|
||||||
@@ -35,7 +48,9 @@ const ItemMovie = () => {
|
|||||||
if (!appBarVisiblity) {
|
if (!appBarVisiblity) {
|
||||||
dispatch(showAppBar());
|
dispatch(showAppBar());
|
||||||
}
|
}
|
||||||
|
console.log(trigger);
|
||||||
dispatch(setBackdrop(trigger));
|
dispatch(setBackdrop(trigger));
|
||||||
|
dispatch(showBackButton());
|
||||||
}, [trigger]);
|
}, [trigger]);
|
||||||
|
|
||||||
const user = useQuery({
|
const user = useQuery({
|
||||||
@@ -78,19 +93,123 @@ const ItemMovie = () => {
|
|||||||
recomponent="main"
|
recomponent="main"
|
||||||
className="scrollY"
|
className="scrollY"
|
||||||
sx={{
|
sx={{
|
||||||
flexGrow: 1,
|
display: "flex",
|
||||||
pt: 11,
|
pt: 11,
|
||||||
px: 3,
|
px: 3,
|
||||||
pb: 3,
|
pb: 3,
|
||||||
position: "relative",
|
position: "relative",
|
||||||
|
flexFlow: "column",
|
||||||
|
gap: 5,
|
||||||
}}
|
}}
|
||||||
f={(node) => {
|
ref={(node) => {
|
||||||
if (node) {
|
if (node) {
|
||||||
setScrollTarget(node);
|
setScrollTarget(node);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
<Box className="item-detail-backdrop">
|
||||||
|
{item.data.BackdropImageTags.length != 0 && (
|
||||||
|
<Blurhash
|
||||||
|
hash={
|
||||||
|
item.data.ImageBlurHashes.Backdrop[
|
||||||
|
item.data.BackdropImageTags[0]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
resolutionX={64}
|
||||||
|
resolutionY={96}
|
||||||
|
style={{
|
||||||
|
aspectRatio: 0.666,
|
||||||
|
}}
|
||||||
|
className="card-image-blurhash"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Box>
|
||||||
<Box className="item-detail-header">
|
<Box className="item-detail-header">
|
||||||
|
<Box className="item-detail-header-backdrop">
|
||||||
|
{item.data.BackdropImageTags.length != 0 && (
|
||||||
|
<img
|
||||||
|
src={
|
||||||
|
window.api.basePath +
|
||||||
|
"/Items/" +
|
||||||
|
item.data.Id +
|
||||||
|
"/Images/Backdrop"
|
||||||
|
}
|
||||||
|
style={{
|
||||||
|
opacity: backdropImageLoaded
|
||||||
|
? 1
|
||||||
|
: 0,
|
||||||
|
}}
|
||||||
|
className="item-detail-image"
|
||||||
|
onLoad={() =>
|
||||||
|
setBackdropImageLoaded(true)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{item.data.BackdropImageTags.length != 0 && (
|
||||||
|
<Blurhash
|
||||||
|
hash={
|
||||||
|
item.data.ImageBlurHashes.Backdrop[
|
||||||
|
item.data.BackdropImageTags[0]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
resolutionX={64}
|
||||||
|
resolutionY={96}
|
||||||
|
style={{
|
||||||
|
aspectRatio: "0.666",
|
||||||
|
}}
|
||||||
|
className="item-detail-image-blurhash"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="item-detail-image-icon-container">
|
||||||
|
{TypeIconCollectionCard[item.data.Type]}
|
||||||
|
</div>
|
||||||
|
</Box>
|
||||||
|
<Box className="item-detail-image-container">
|
||||||
|
{!!item.data.ImageTags.Primary && (
|
||||||
|
<img
|
||||||
|
src={
|
||||||
|
window.api.basePath +
|
||||||
|
"/Items/" +
|
||||||
|
item.data.Id +
|
||||||
|
"/Images/Primary"
|
||||||
|
}
|
||||||
|
style={{
|
||||||
|
opacity: primageImageLoaded
|
||||||
|
? 1
|
||||||
|
: 0,
|
||||||
|
}}
|
||||||
|
className="item-detail-image"
|
||||||
|
onLoad={() =>
|
||||||
|
setPrimaryImageLoaded(true)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{!!item.data.ImageBlurHashes.Primary && (
|
||||||
|
<Blurhash
|
||||||
|
hash={
|
||||||
|
item.data.ImageBlurHashes.Primary[
|
||||||
|
item.data.ImageTags.Primary
|
||||||
|
]
|
||||||
|
}
|
||||||
|
width="100%"
|
||||||
|
height="100%"
|
||||||
|
resolutionX={64}
|
||||||
|
resolutionY={96}
|
||||||
|
style={{
|
||||||
|
aspectRatio: 0.666,
|
||||||
|
}}
|
||||||
|
className="item-detail-image-blurhash"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<div className="item-detail-image-icon-container">
|
||||||
|
{TypeIconCollectionCard[item.data.Type]}
|
||||||
|
</div>
|
||||||
|
</Box>
|
||||||
|
<Box className="item-detail-info-container">
|
||||||
<Box className="item-detail-title-name">
|
<Box className="item-detail-title-name">
|
||||||
<Typography variant="h4">
|
<Typography variant="h4">
|
||||||
{item.data.Name}
|
{item.data.Name}
|
||||||
@@ -153,6 +272,27 @@ const ItemMovie = () => {
|
|||||||
</Stack>
|
</Stack>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Typography variant="body1">
|
||||||
|
{item.data.Overview}
|
||||||
|
</Typography>
|
||||||
|
<CardScroller displayCards={8} title="Actors">
|
||||||
|
{item.data.People.map((person, index) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={index}
|
||||||
|
itemName={person.Name}
|
||||||
|
itemId={person.Id}
|
||||||
|
// imageTags={false}
|
||||||
|
imageTags={!!person.PrimaryImageTag}
|
||||||
|
iconType="Person"
|
||||||
|
subText={person.Role}
|
||||||
|
cardOrientation="sqaure"
|
||||||
|
currentUser={user.data}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</CardScroller>
|
||||||
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (item.isError) {
|
if (item.isError) {
|
||||||
|
|||||||
Reference in new issue
Block a user