Implement Episode Page #58
This commit is contained in:
5 files changed
+122
-24
No files matched your search
@@ -372,10 +372,12 @@ function App() {
|
|||||||
element={<UserLoginManual />}
|
element={<UserLoginManual />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
|
exact
|
||||||
path="/library/:id"
|
path="/library/:id"
|
||||||
element={<LibraryView />}
|
element={<LibraryView />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
|
exact
|
||||||
path="/item/:id"
|
path="/item/:id"
|
||||||
element={<ItemDetail />}
|
element={<ItemDetail />}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export const CardScroller = ({
|
|||||||
const [carouselRef, setCarouselRef] = useState();
|
const [carouselRef, setCarouselRef] = useState();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box {...boxProps} className="card-scroller-container" sx={{ mb: 4 }}>
|
<Box {...boxProps} className="card-scroller-container" mb={1}>
|
||||||
<Box
|
<Box
|
||||||
sx={{ mb: 1 }}
|
sx={{ mb: 1 }}
|
||||||
className={
|
className={
|
||||||
|
|||||||
+114
-17
@@ -206,6 +206,19 @@ const ItemDetail = () => {
|
|||||||
refetchOnWindowFocus: true,
|
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({
|
const personMovies = useQuery({
|
||||||
queryKey: ["item", id, "personMovies"],
|
queryKey: ["item", id, "personMovies"],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
@@ -569,17 +582,23 @@ const ItemDetail = () => {
|
|||||||
className="item-detail-header"
|
className="item-detail-header"
|
||||||
mb={2}
|
mb={2}
|
||||||
paddingTop={
|
paddingTop={
|
||||||
item.data.Type.includes("Music") ? 10 : 0
|
item.data.Type.includes("Music") ||
|
||||||
|
item.data.Type === BaseItemKind.Episode
|
||||||
|
? 10
|
||||||
|
: 0
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Box className="item-detail-header-backdrop">
|
<Box className="item-detail-header-backdrop">
|
||||||
{item.data.Type != BaseItemKind.MusicAlbum
|
{item.data.Type != BaseItemKind.MusicAlbum &&
|
||||||
|
item.data.Type != BaseItemKind.Episode
|
||||||
? item.data.BackdropImageTags.length !=
|
? item.data.BackdropImageTags.length !=
|
||||||
0 && (
|
0 && (
|
||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
item.data.Type ==
|
item.data.Type ===
|
||||||
BaseItemKind.MusicAlbum
|
BaseItemKind.MusicAlbum ||
|
||||||
|
item.data.Type ===
|
||||||
|
BaseItemKind.Episode
|
||||||
? `${window.api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
? `${window.api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
||||||
: `${window.api.basePath}/Items/${item.data.Id}/Images/Backdrop`
|
: `${window.api.basePath}/Items/${item.data.Id}/Images/Backdrop`
|
||||||
}
|
}
|
||||||
@@ -599,8 +618,10 @@ const ItemDetail = () => {
|
|||||||
: !!item.data.ParentBackdropItemId && (
|
: !!item.data.ParentBackdropItemId && (
|
||||||
<img
|
<img
|
||||||
src={
|
src={
|
||||||
item.data.Type ==
|
item.data.Type ===
|
||||||
BaseItemKind.MusicAlbum
|
BaseItemKind.MusicAlbum ||
|
||||||
|
item.data.Type ===
|
||||||
|
BaseItemKind.Episode
|
||||||
? `${window.api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
? `${window.api.basePath}/Items/${item.data.ParentBackdropItemId}/Images/Backdrop`
|
||||||
: `${window.api.basePath}/Items/${item.data.Id}/Images/Backdrop`
|
: `${window.api.basePath}/Items/${item.data.Id}/Images/Backdrop`
|
||||||
}
|
}
|
||||||
@@ -650,20 +671,20 @@ const ItemDetail = () => {
|
|||||||
display: "flex",
|
display: "flex",
|
||||||
gap: 3,
|
gap: 3,
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
alignItems: "flex-end",
|
alignItems:
|
||||||
|
item.data.Type ===
|
||||||
|
BaseItemKind.Episode
|
||||||
|
? "center !important"
|
||||||
|
: "flex-end",
|
||||||
justifyContent: "flex-start",
|
justifyContent: "flex-start",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Box
|
<Box
|
||||||
className="item-detail-image-container"
|
className={`item-detail-image-container ${item.data.Type}`}
|
||||||
sx={
|
sx={{
|
||||||
item.data.Type.includes("Music")
|
aspectRatio: `${item.data.PrimaryImageAspectRatio}`,
|
||||||
? {
|
}}
|
||||||
aspectRatio: "1",
|
|
||||||
}
|
|
||||||
: {}
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
<Chip
|
<Chip
|
||||||
className="card-indicator"
|
className="card-indicator"
|
||||||
@@ -714,7 +735,9 @@ const ItemDetail = () => {
|
|||||||
resolutionX={12}
|
resolutionX={12}
|
||||||
resolutionY={8}
|
resolutionY={8}
|
||||||
style={{
|
style={{
|
||||||
aspectRatio: 0.666,
|
aspectRatio:
|
||||||
|
item.data
|
||||||
|
.PrimaryImageAspectRatio,
|
||||||
}}
|
}}
|
||||||
className="item-detail-image-blurhash"
|
className="item-detail-image-blurhash"
|
||||||
/>
|
/>
|
||||||
@@ -737,6 +760,42 @@ const ItemDetail = () => {
|
|||||||
className="item-detail-title-name"
|
className="item-detail-title-name"
|
||||||
sx={{ mb: 1 }}
|
sx={{ mb: 1 }}
|
||||||
>
|
>
|
||||||
|
{item.data.Type ===
|
||||||
|
BaseItemKind.Episode && (
|
||||||
|
<Link
|
||||||
|
component={RouterLink}
|
||||||
|
to={`/item/${item.data.SeriesId}`}
|
||||||
|
variant="h3"
|
||||||
|
textOverflow="ellipsis"
|
||||||
|
whiteSpace="nowrap"
|
||||||
|
width="100%"
|
||||||
|
color="inherit"
|
||||||
|
underline="hover"
|
||||||
|
mb={1}
|
||||||
|
>
|
||||||
|
{!!item.data
|
||||||
|
.ParentLogoItemId ? (
|
||||||
|
<img
|
||||||
|
className="item-detail-title-logo"
|
||||||
|
src={`${window.api.basePath}/Items/${item.data.SeriesId}/Images/Logo?cropWhitespace=True&quality=80&tag=${item.data.ParentLogoImageTag}`}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
item.data.SeriesName
|
||||||
|
)}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
{item.data.Type ===
|
||||||
|
BaseItemKind.Episode ? (
|
||||||
|
<Typography
|
||||||
|
variant="h4"
|
||||||
|
textOverflow="ellipsis"
|
||||||
|
whiteSpace="nowrap"
|
||||||
|
width="100%"
|
||||||
|
sx={{ opacity: 0.7 }}
|
||||||
|
>
|
||||||
|
{`S${item.data.ParentIndexNumber}:E${item.data.IndexNumber} - ${item.data.Name}`}
|
||||||
|
</Typography>
|
||||||
|
) : (
|
||||||
<Typography
|
<Typography
|
||||||
variant="h3"
|
variant="h3"
|
||||||
textOverflow="ellipsis"
|
textOverflow="ellipsis"
|
||||||
@@ -753,6 +812,7 @@ const ItemDetail = () => {
|
|||||||
item.data.Name
|
item.data.Name
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
)}
|
||||||
<Typography
|
<Typography
|
||||||
variant="h6"
|
variant="h6"
|
||||||
sx={{ opacity: 0.7 }}
|
sx={{ opacity: 0.7 }}
|
||||||
@@ -2796,6 +2856,44 @@ const ItemDetail = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{item.data.Type === BaseItemKind.Episode && (
|
||||||
|
<CardScroller
|
||||||
|
headingProps={{
|
||||||
|
variant: "h5",
|
||||||
|
fontSize: "1.8em",
|
||||||
|
}}
|
||||||
|
displayCards={4}
|
||||||
|
title="Upcoming Episodes"
|
||||||
|
disableDecoration
|
||||||
|
boxProps={{
|
||||||
|
mt: 2,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{upcomingEpisodes.isSuccess &&
|
||||||
|
upcomingEpisodes.data.Items.map(
|
||||||
|
(episode, index) => {
|
||||||
|
return (
|
||||||
|
<Card
|
||||||
|
key={episode.Id}
|
||||||
|
itemName={`E${episode.ParentIndexNumber}:S${episode.IndexNumber} - ${episode.Name}`}
|
||||||
|
itemId={episode.Id}
|
||||||
|
imageTags={
|
||||||
|
!!episode
|
||||||
|
.ImageTags
|
||||||
|
?.Primary
|
||||||
|
}
|
||||||
|
iconType="Episode"
|
||||||
|
cardOrientation="landscape"
|
||||||
|
currentUser={
|
||||||
|
user.data
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</CardScroller>
|
||||||
|
)}
|
||||||
|
|
||||||
{item.data.People.length != 0 && (
|
{item.data.People.length != 0 && (
|
||||||
<CardScroller
|
<CardScroller
|
||||||
headingProps={{
|
headingProps={{
|
||||||
@@ -2815,7 +2913,6 @@ const ItemDetail = () => {
|
|||||||
key={index}
|
key={index}
|
||||||
itemName={person.Name}
|
itemName={person.Name}
|
||||||
itemId={person.Id}
|
itemId={person.Id}
|
||||||
// imageTags={false}
|
|
||||||
imageTags={
|
imageTags={
|
||||||
!!person.PrimaryImageTag
|
!!person.PrimaryImageTag
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,10 +52,13 @@
|
|||||||
width: 15%;
|
width: 15%;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
aspect-ratio: 0.666;
|
|
||||||
border-radius: $border-radius-default;
|
border-radius: $border-radius-default;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
box-shadow: 0 0 15px rgb(0 0 0 / 0.4);
|
||||||
|
&.Episode {
|
||||||
|
flex-shrink: 0;
|
||||||
|
flex-grow: 0.25;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&-icon-container {
|
&-icon-container {
|
||||||
background: $clr-gradient-dark;
|
background: $clr-gradient-dark;
|
||||||
|
|||||||
@@ -46,13 +46,9 @@ body {
|
|||||||
height: fit-content;
|
height: fit-content;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow-y: visible;
|
overflow-y: hidden;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
// display: flex;
|
|
||||||
// flex-direction: column;
|
|
||||||
// justify-content: center;
|
|
||||||
// align-items: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.centered {
|
.centered {
|
||||||
|
|||||||
Reference in new issue
Block a user