diff --git a/front/packages/ui/src/details/season.tsx b/front/packages/ui/src/details/season.tsx index 7f1a1876..e3ffdf38 100644 --- a/front/packages/ui/src/details/season.tsx +++ b/front/packages/ui/src/details/season.tsx @@ -150,7 +150,7 @@ export const EpisodeList = ({ divider Header={Header} headerProps={headerProps} - getItemType={(item) => (item.firstOfSeason ? "withHeader" : "normal")} + getItemType={(item) => (!item || item.firstOfSeason ? "withHeader" : "normal")} contentContainerStyle={pageStyle} placeholderCount={5} Render={({ item }) => { diff --git a/front/packages/ui/src/downloads/page.tsx b/front/packages/ui/src/downloads/page.tsx index 3439c4e5..546757ea 100644 --- a/front/packages/ui/src/downloads/page.tsx +++ b/front/packages/ui/src/downloads/page.tsx @@ -195,6 +195,7 @@ const downloadIcon = (status: State["status"]) => { return Downloading; case "FAILED": return ErrorIcon; + case "PENDING": case "PAUSED": case "STOPPED": return NotStarted; diff --git a/front/packages/ui/src/fetch-infinite.tsx b/front/packages/ui/src/fetch-infinite.tsx index d3295798..e3d2b569 100644 --- a/front/packages/ui/src/fetch-infinite.tsx +++ b/front/packages/ui/src/fetch-infinite.tsx @@ -30,7 +30,7 @@ import { } from "react"; import { FlatList, View, type ViewStyle } from "react-native"; import { ErrorView } from "./errors"; -import { EmptyView, type Layout, OfflineView, type WithLoading, addHeader } from "./fetch"; +import { EmptyView, type Layout, OfflineView, addHeader } from "./fetch"; const emulateGap = ( layout: "grid" | "vertical" | "horizontal", @@ -90,7 +90,7 @@ export const InfiniteFetchList = ( divider?: boolean | ComponentType; Header?: ComponentType | ReactElement; headerProps?: Props; - getItemType?: (item: WithLoading, index: number) => Kind; + getItemType?: (item: Data | null, index: number) => Kind; getItemSize?: (kind: Kind) => number; fetchMore?: boolean; nested?: boolean; @@ -139,7 +139,7 @@ export const InfiniteFetchList = ( )} data={data} horizontal={layout.layout === "horizontal"} - keyExtractor={(item: any) => item.id} + keyExtractor={(item: any, index) => (item ? item.id : index)} numColumns={layout.layout === "horizontal" ? 1 : numColumns} estimatedItemSize={size} onEndReached={fetchMore ? fetchNextPage : undefined} diff --git a/front/packages/ui/src/fetch-infinite.web.tsx b/front/packages/ui/src/fetch-infinite.web.tsx index 53186008..e2af8123 100644 --- a/front/packages/ui/src/fetch-infinite.web.tsx +++ b/front/packages/ui/src/fetch-infinite.web.tsx @@ -33,7 +33,7 @@ import { } from "react"; import { type Stylable, nativeStyleToCss, useYoshiki, ysMap } from "yoshiki"; import { ErrorView } from "./errors"; -import { EmptyView, type Layout, type WithLoading, addHeader } from "./fetch"; +import { EmptyView, type Layout, addHeader } from "./fetch"; const InfiniteScroll = ({ children, @@ -167,7 +167,7 @@ export const InfiniteFetchList = | ReactElement; headerProps: HeaderProps; - getItemType?: (item: WithLoading, index: number) => Kind; + getItemType?: (item: Data | null, index: number) => Kind; getItemSize?: (kind: Kind) => number; fetchMore?: boolean; contentContainerStyle?: ContentStyle; diff --git a/front/packages/ui/src/home/news.tsx b/front/packages/ui/src/home/news.tsx index 3c4ec8aa..9ece3860 100644 --- a/front/packages/ui/src/home/news.tsx +++ b/front/packages/ui/src/home/news.tsx @@ -36,7 +36,7 @@ export const NewsList = () => { (x.kind === "movie" || (x.isLoading && i % 2) ? "movie" : "episode")} + getItemType={(x, i) => (x?.kind === "movie" || (!x && i % 2) ? "movie" : "episode")} getItemSize={(kind) => (kind === "episode" ? 2 : 1)} empty={t("home.none")} Render={({ item }) => { diff --git a/front/packages/ui/src/home/watchlist.tsx b/front/packages/ui/src/home/watchlist.tsx index 460f906f..f49f3d36 100644 --- a/front/packages/ui/src/home/watchlist.tsx +++ b/front/packages/ui/src/home/watchlist.tsx @@ -62,9 +62,7 @@ export const WatchlistList = () => { query={WatchlistList.query()} layout={{ ...ItemGrid.layout, layout: "horizontal" }} getItemType={(x, i) => - (x.kind === "show" && x.watchStatus?.nextEpisode) || (x.isLoading && i % 2) - ? "episode" - : "item" + (x?.kind === "show" && x.watchStatus?.nextEpisode) || (!x && i % 2) ? "episode" : "item" } getItemSize={(kind) => (kind === "episode" ? 2 : 1)} empty={t("home.none")}