diff --git a/front/packages/models/src/accounts.tsx b/front/packages/models/src/accounts.tsx index 6fd1961d..c44ccac9 100644 --- a/front/packages/models/src/accounts.tsx +++ b/front/packages/models/src/accounts.tsx @@ -38,13 +38,15 @@ export const TokenP = z.object({ }); export type Token = z.infer; -export const AccountP = UserP.merge(z.object({ - // set it optional for accounts logged in before the kind was present - kind: z.literal("user").optional(), - token: TokenP, - apiUrl: z.string(), - selected: z.boolean(), -})); +export const AccountP = UserP.merge( + z.object({ + // set it optional for accounts logged in before the kind was present + kind: z.literal("user").optional(), + token: TokenP, + apiUrl: z.string(), + selected: z.boolean(), + }), +); export type Account = z.infer; const AccountContext = createContext<(Account & { select: () => void; remove: () => void })[]>([]); diff --git a/front/packages/models/src/query.tsx b/front/packages/models/src/query.tsx index ca5bd8d9..1d7e8f66 100644 --- a/front/packages/models/src/query.tsx +++ b/front/packages/models/src/query.tsx @@ -40,7 +40,7 @@ export let kyooApiUrl = kyooUrl; export const queryFn = async ( context: - | (QueryFunctionContext & { timeout?: number, apiUrl?: string }) + | (QueryFunctionContext & { timeout?: number; apiUrl?: string }) | { path: (string | false | undefined | null)[]; body?: object; diff --git a/front/packages/models/src/resources/collection.ts b/front/packages/models/src/resources/collection.ts index 41954fc7..e761b8dc 100644 --- a/front/packages/models/src/resources/collection.ts +++ b/front/packages/models/src/resources/collection.ts @@ -31,7 +31,7 @@ export const CollectionP = withImages( * The summary of this show. */ overview: z.string().nullable(), - }) + }), ).transform((x) => ({ ...x, href: `/collection/${x.slug}`, diff --git a/front/packages/ui/src/browse/index.tsx b/front/packages/ui/src/browse/index.tsx index fab7aa09..29e9a665 100644 --- a/front/packages/ui/src/browse/index.tsx +++ b/front/packages/ui/src/browse/index.tsx @@ -52,12 +52,9 @@ export const itemMap = ( thumbnail: item.thumbnail, watchStatus: item.kind !== "collection" ? item.watchStatus?.status ?? null : null, type: item.kind, - watchPercent: - item.kind !== "collection" ? item.watchStatus?.watchedPercent ?? null : null, + watchPercent: item.kind !== "collection" ? item.watchStatus?.watchedPercent ?? null : null, unseenEpisodesCount: - item.kind === "show" - ? item.watchStatus?.unseenEpisodesCount ?? item.episodesCount! - : null, + item.kind === "show" ? item.watchStatus?.unseenEpisodesCount ?? item.episodesCount! : null, }; }; diff --git a/front/packages/ui/src/home/news.tsx b/front/packages/ui/src/home/news.tsx index 45202f62..2e85d916 100644 --- a/front/packages/ui/src/home/news.tsx +++ b/front/packages/ui/src/home/news.tsx @@ -36,9 +36,7 @@ export const NewsList = () => { - x.kind === "movie" || (x.isLoading && i % 2) ? "movie" : "episode" - } + getItemType={(x, i) => (x.kind === "movie" || (x.isLoading && i % 2) ? "movie" : "episode")} getItemSize={(kind) => (kind === "episode" ? 2 : 1)} empty={t("home.none")} > @@ -59,11 +57,7 @@ export const NewsList = () => { isLoading={x.isLoading as any} slug={x.slug} showSlug={x.kind === "episode" ? x.showId : null} - name={ - x.kind === "episode" - ? `${x.show!.name} ${episodeDisplayNumber(x)}` - : undefined - } + name={x.kind === "episode" ? `${x.show!.name} ${episodeDisplayNumber(x)}` : undefined} overview={x.name} thumbnail={x.thumbnail} href={x.href} diff --git a/front/packages/ui/src/home/watchlist.tsx b/front/packages/ui/src/home/watchlist.tsx index 544f6192..13d79529 100644 --- a/front/packages/ui/src/home/watchlist.tsx +++ b/front/packages/ui/src/home/watchlist.tsx @@ -18,13 +18,7 @@ * along with Kyoo. If not, see . */ -import { - QueryIdentifier, - Watchlist, - WatchlistP, - getDisplayDate, - useAccount, -} from "@kyoo/models"; +import { QueryIdentifier, Watchlist, WatchlistP, getDisplayDate, useAccount } from "@kyoo/models"; import { useYoshiki } from "yoshiki/native"; import { ItemGrid } from "../browse/grid"; import { InfiniteFetch } from "../fetch-infinite"; @@ -56,8 +50,7 @@ export const WatchlistList = () => { > {(x, i) => { const episode = x.kind === "show" ? x.watchStatus?.nextEpisode : null; - return (x.kind === "show" && x.watchStatus?.nextEpisode) || - (x.isLoading && i % 2) ? ( + return (x.kind === "show" && x.watchStatus?.nextEpisode) || (x.isLoading && i % 2) ? ( { poster={x.poster} watchStatus={x.watchStatus?.status || null} watchPercent={x.watchStatus?.watchedPercent || null} - unseenEpisodesCount={ - x.kind === "show" ? x.watchStatus?.unseenEpisodesCount : null - } + unseenEpisodesCount={x.kind === "show" ? x.watchStatus?.unseenEpisodesCount : null} type={x.kind} /> );