From dd4f5bab306a66f8984cbedb0f20638ae51ef29b Mon Sep 17 00:00:00 2001 From: prayag17 Date: Thu, 4 May 2023 18:40:31 +0530 Subject: [PATCH] Implement Episode Page #58 --- src/App.jsx | 2 + src/components/cardScroller/cardScroller.jsx | 2 +- src/routes/item/index.jsx | 163 +++++++++++++++---- src/routes/item/item.module.scss | 5 +- src/styles/global.scss | 6 +- 5 files changed, 138 insertions(+), 40 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 14f5e72..77eb538 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -372,10 +372,12 @@ function App() { element={} /> } /> } /> diff --git a/src/components/cardScroller/cardScroller.jsx b/src/components/cardScroller/cardScroller.jsx index c306338..048b70f 100644 --- a/src/components/cardScroller/cardScroller.jsx +++ b/src/components/cardScroller/cardScroller.jsx @@ -50,7 +50,7 @@ export const CardScroller = ({ const [carouselRef, setCarouselRef] = useState(); return ( - + { refetchOnWindowFocus: true, }); + const upcomingEpisodes = useQuery({ + queryKey: ["item", id, "episode", "upcomingEpisodes"], + queryFn: async () => { + const result = await getItemsApi(window.api).getItems({ + userId: user.data.Id, + parentId: item.data.ParentId, + startIndex: item.data.IndexNumber, + }); + return result.data; + }, + enabled: item.isSuccess && item.data.Type == BaseItemKind.Episode, + }); + const personMovies = useQuery({ queryKey: ["item", id, "personMovies"], queryFn: async () => { @@ -569,17 +582,23 @@ const ItemDetail = () => { className="item-detail-header" mb={2} paddingTop={ - item.data.Type.includes("Music") ? 10 : 0 + item.data.Type.includes("Music") || + item.data.Type === BaseItemKind.Episode + ? 10 + : 0 } > - {item.data.Type != BaseItemKind.MusicAlbum + {item.data.Type != BaseItemKind.MusicAlbum && + item.data.Type != BaseItemKind.Episode ? item.data.BackdropImageTags.length != 0 && ( { : !!item.data.ParentBackdropItemId && ( { display: "flex", gap: 3, flexDirection: "row", - alignItems: "flex-end", + alignItems: + item.data.Type === + BaseItemKind.Episode + ? "center !important" + : "flex-end", justifyContent: "flex-start", width: "100%", }} > { resolutionX={12} resolutionY={8} style={{ - aspectRatio: 0.666, + aspectRatio: + item.data + .PrimaryImageAspectRatio, }} className="item-detail-image-blurhash" /> @@ -737,22 +760,59 @@ const ItemDetail = () => { className="item-detail-title-name" sx={{ mb: 1 }} > - - {!!item.data.ImageTags - .Logo ? ( - - ) : ( - item.data.Name - )} - + {item.data.Type === + BaseItemKind.Episode && ( + + {!!item.data + .ParentLogoItemId ? ( + + ) : ( + item.data.SeriesName + )} + + )} + {item.data.Type === + BaseItemKind.Episode ? ( + + {`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`} + + ) : ( + + {!!item.data.ImageTags + .Logo ? ( + + ) : ( + item.data.Name + )} + + )} { )} + {item.data.Type === BaseItemKind.Episode && ( + + {upcomingEpisodes.isSuccess && + upcomingEpisodes.data.Items.map( + (episode, index) => { + return ( + + ); + }, + )} + + )} + {item.data.People.length != 0 && ( { key={index} itemName={person.Name} itemId={person.Id} - // imageTags={false} imageTags={ !!person.PrimaryImageTag } diff --git a/src/routes/item/item.module.scss b/src/routes/item/item.module.scss index 701bcd0..0b846ee 100644 --- a/src/routes/item/item.module.scss +++ b/src/routes/item/item.module.scss @@ -52,10 +52,13 @@ width: 15%; flex-shrink: 0; position: relative; - aspect-ratio: 0.666; border-radius: $border-radius-default; overflow: hidden; box-shadow: 0 0 15px rgb(0 0 0 / 0.4); + &.Episode { + flex-shrink: 0; + flex-grow: 0.25; + } } &-icon-container { background: $clr-gradient-dark; diff --git a/src/styles/global.scss b/src/styles/global.scss index 83bd638..f041c22 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -46,13 +46,9 @@ body { height: fit-content; width: 100%; position: relative; - overflow-y: visible; + overflow-y: hidden; overflow-x: hidden; min-height: 100vh; - // display: flex; - // flex-direction: column; - // justify-content: center; - // align-items: center; } .centered {