mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix seasons list when there is no items
This commit is contained in:
parent
1373d0ce26
commit
43a4a0e6ee
@ -35,7 +35,8 @@ export enum Status {
|
||||
Planned = "Planned",
|
||||
}
|
||||
|
||||
export const ShowP = withImages(ResourceP.extend({
|
||||
export const ShowP = withImages(
|
||||
ResourceP.extend({
|
||||
/**
|
||||
* The title of this show.
|
||||
*/
|
||||
@ -84,7 +85,9 @@ export const ShowP = withImages(ResourceP.extend({
|
||||
* The list of seasons of this show.
|
||||
*/
|
||||
seasons: z.array(SeasonP).optional(),
|
||||
}), "shows")
|
||||
}),
|
||||
"shows",
|
||||
)
|
||||
.transform((x) => {
|
||||
if (!x.thumbnail && x.poster) {
|
||||
x.thumbnail = { ...x.poster };
|
||||
|
@ -72,13 +72,15 @@ export const SeasonHeader = ({
|
||||
{isLoading ? <Skeleton /> : name}
|
||||
</H6>
|
||||
<Menu Trigger={IconButton} icon={MenuIcon} {...tooltip(t("show.jumpToSeason"))}>
|
||||
{seasons?.map((x) => (
|
||||
<Menu.Item
|
||||
key={x.seasonNumber}
|
||||
label={`${x.seasonNumber}: ${x.name} (${x.episodesCount})`}
|
||||
href={x.href}
|
||||
/>
|
||||
))}
|
||||
{seasons
|
||||
?.filter((x) => x.episodesCount > 0)
|
||||
.map((x) => (
|
||||
<Menu.Item
|
||||
key={x.seasonNumber}
|
||||
label={`${x.seasonNumber}: ${x.name} (${x.episodesCount})`}
|
||||
href={x.href}
|
||||
/>
|
||||
))}
|
||||
</Menu>
|
||||
</View>
|
||||
<HR />
|
||||
@ -96,10 +98,7 @@ SeasonHeader.query = (slug: string): QueryIdentifier<Season, SeasonProcessed> =>
|
||||
infinite: {
|
||||
value: true,
|
||||
map: (seasons) =>
|
||||
seasons.reduce((acc, x) => {
|
||||
if (x.episodesCount == 0) return acc;
|
||||
return [...acc, { ...x, href: `/show/${slug}?season=${x.seasonNumber}` }];
|
||||
}, [] as SeasonProcessed[]),
|
||||
seasons.map((x) => ({ ...x, href: `/show/${slug}?season=${x.seasonNumber}` })),
|
||||
},
|
||||
});
|
||||
|
||||
@ -134,6 +133,7 @@ export const EpisodeList = <Props,>({
|
||||
const sea = item?.firstOfSeason
|
||||
? seasons?.find((x) => x.seasonNumber === item.seasonNumber)
|
||||
: null;
|
||||
console.log(sea, seasons);
|
||||
return (
|
||||
<>
|
||||
{item.firstOfSeason && (
|
||||
|
Loading…
x
Reference in New Issue
Block a user