style: display backdrops in boxset

This commit is contained in:
Prayag Prajapati committed 2024-03-29 10:54:36 +05:30
1 parent ea5a0a5aad
commit ef01012d0f
3 files changed
+44 -15

No files matched your search

+32 -6
View File
@@ -38,7 +38,7 @@ import LikeButton from "../../components/buttons/likeButton";
import MarkPlayedButton from "../../components/buttons/markPlayedButton"; import MarkPlayedButton from "../../components/buttons/markPlayedButton";
import PlayButton from "../../components/buttons/playButton"; import PlayButton from "../../components/buttons/playButton";
import meshBg from "../../assets/herobg.png"; import heroBg from "../../assets/herobg.png";
import "./boxset.module.scss"; import "./boxset.module.scss";
import IconLink from "../../components/iconLink"; import IconLink from "../../components/iconLink";
@@ -128,8 +128,17 @@ const BoxSetTitlePage = () => {
useEffect(() => { useEffect(() => {
if (item.isSuccess) { if (item.isSuccess) {
if (item.data.BackdropImageTags?.length > 0) {
setBackdrop(
api?.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
}),
item.data.Id,
);
} else {
setBackdrop("", ""); setBackdrop("", "");
} }
}
}, [item.isSuccess]); }, [item.isSuccess]);
const pageRef = useRef(null); const pageRef = useRef(null);
@@ -173,10 +182,12 @@ const BoxSetTitlePage = () => {
> >
<div className="item-hero flex flex-row"> <div className="item-hero flex flex-row">
<div className="item-hero-backdrop-container"> <div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? ( {item.data.BackdropImageTags?.length ? (
<motion.img <motion.img
alt={item.data.Name} alt={item.data.Name}
src={meshBg} src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
})}
className="item-hero-backdrop" className="item-hero-backdrop"
onLoad={(e) => { onLoad={(e) => {
e.currentTarget.style.opacity = 1; e.currentTarget.style.opacity = 1;
@@ -186,7 +197,17 @@ const BoxSetTitlePage = () => {
}} }}
/> />
) : ( ) : (
<></> <motion.img
alt={item.data.Name}
src={heroBg}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
style={{
y: parallax,
}}
/>
)} )}
</div> </div>
<div <div
@@ -371,7 +392,12 @@ const BoxSetTitlePage = () => {
</div> </div>
</div> </div>
</div> </div>
<div className="item-detail"> <div
className="item-detail"
style={{
marginBottom: "2em",
}}
>
<ShowMoreText content={item.data.Overview ?? ""} collapsedLines={4} /> <ShowMoreText content={item.data.Overview ?? ""} collapsedLines={4} />
<div <div
style={{ style={{
@@ -393,7 +419,7 @@ const BoxSetTitlePage = () => {
</div> </div>
</div> </div>
{collectionItems.data.TotalRecordCount > 0 && ( {collectionItems.data.TotalRecordCount > 0 && (
<CardScroller title="Items" displayCards={7} disableDecoration> <CardScroller title="" displayCards={7} disableDecoration>
{collectionItems.data.Items.map((similar, index) => { {collectionItems.data.Items.map((similar, index) => {
return ( return (
<Card <Card
+10 -7
View File
@@ -47,7 +47,7 @@ import TextLink from "../../components/textLink";
import { getTypeIcon } from "../../components/utils/iconsCollection"; import { getTypeIcon } from "../../components/utils/iconsCollection";
import { endsAt, getRuntime } from "../../utils/date/time"; import { endsAt, getRuntime } from "../../utils/date/time";
import { useApi } from "../../utils/store/api"; import { useApi } from "../../utils/store/api";
import { useBackdropStore } from "../../utils/store/backdrop"; import { setBackdrop, useBackdropStore } from "../../utils/store/backdrop";
import ItemSkeleton from "../../components/skeleton/item"; import ItemSkeleton from "../../components/skeleton/item";
@@ -199,13 +199,16 @@ const ItemDetail = () => {
useLayoutEffect(() => { useLayoutEffect(() => {
if (item.isSuccess) { if (item.isSuccess) {
setAppBackdrop( if (item.data.BackdropImageTags?.length > 0) {
item.data.Type === BaseItemKind.MusicAlbum || setBackdrop(
item.data.Type === BaseItemKind.Episode api?.getItemImageUrl(item.data.Id, "Backdrop", {
? `${api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop` tag: item.data.BackdropImageTags[0],
: `${api.basePath}/Items/${item.data.Id}/Images/Backdrop`, }),
item.data.Id, item.data.Id,
); );
} else {
setBackdrop("", "");
}
const direTp = item.data.People.filter((itm) => itm.Type === "Director"); const direTp = item.data.People.filter((itm) => itm.Type === "Director");
setDirectors(direTp); setDirectors(direTp);
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer"); const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
@@ -687,7 +690,7 @@ const ItemDetail = () => {
<div className="item-detail"> <div className="item-detail">
<div style={{ width: "100%" }}> <div style={{ width: "100%" }}>
{item.data.Taglines?.length > 0 && ( {item.data.Taglines?.length > 0 && (
<Typography variant="h5" mb={2}> <Typography variant="h5" mb={2} fontWeight={300}>
{item.data.Taglines[0]} {item.data.Taglines[0]}
</Typography> </Typography>
)} )}
+2 -2
View File
@@ -1,14 +1,12 @@
$cardWidth: 18%; $cardWidth: 18%;
.item-default.item { .item-default.item {
gap: 1em;
.item-hero { .item-hero {
height: 60vh; height: 60vh;
gap: 2em; gap: 2em;
row-gap: 1.2em; row-gap: 1.2em;
position: relative; position: relative;
align-items: flex-end; align-items: flex-end;
margin-bottom: 1em;
display: grid; display: grid;
grid-template-columns: $cardWidth 1fr; grid-template-columns: $cardWidth 1fr;
grid-template-rows: 1fr auto; grid-template-rows: 1fr auto;
@@ -176,7 +174,9 @@ $cardWidth: 18%;
} }
.item { .item {
gap: 1.5em;
&-hero{ &-hero{
// margin-bottom: 1em;
&-image{ &-image{
box-sizing: border-box; box-sizing: border-box;
&-container{ &-container{