Use harcoded s1e1 for items since relations dont work on them

This commit is contained in:
Zoe Roux 2023-11-02 01:04:19 +01:00
parent f8e887c1f2
commit 4bb7b4b6c4
3 changed files with 8 additions and 5 deletions

View File

@ -36,7 +36,11 @@ export const LibraryItemP = z.union([
/* /*
* Either a Show * Either a Show
*/ */
ShowP.and(z.object({ kind: z.literal(ItemKind.Show) })), ShowP.and(
z.object({
kind: z.literal(ItemKind.Show),
}),
).transform((x) => ({ ...x, playHref: `/watch/${x.slug}-s1e1` })),
/* /*
* Or a Movie * Or a Movie
*/ */

View File

@ -98,7 +98,4 @@ export const Header = ({
Header.query = (): QueryIdentifier<LibraryItem> => ({ Header.query = (): QueryIdentifier<LibraryItem> => ({
parser: LibraryItemP, parser: LibraryItemP,
path: ["items", "random"], path: ["items", "random"],
params: {
fields: "firstEpisode",
},
}); });

View File

@ -36,6 +36,7 @@ import {
P, P,
SubP, SubP,
focusReset, focusReset,
tooltip,
ts, ts,
} from "@kyoo/primitives"; } from "@kyoo/primitives";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -69,6 +70,7 @@ export const ItemDetails = ({
playHref: string | null; playHref: string | null;
}>) => { }>) => {
const { push } = useRouter(); const { push } = useRouter();
const { t } = useTranslation();
const { css } = useYoshiki("recommanded-card"); const { css } = useYoshiki("recommanded-card");
return ( return (
@ -142,6 +144,7 @@ export const ItemDetails = ({
size={20} size={20}
as={Pressable} as={Pressable}
onPress={() => push(playHref ?? "")} onPress={() => push(playHref ?? "")}
{...tooltip(t("show.play"))}
{...css({ fover: { self: { transform: "scale(1.2)" as any, mX: ts(0.5) } } })} {...css({ fover: { self: { transform: "scale(1.2)" as any, mX: ts(0.5) } } })}
/> />
)} )}
@ -199,6 +202,5 @@ Recommanded.query = (): QueryIdentifier<LibraryItem> => ({
params: { params: {
sortBy: "random", sortBy: "random",
limit: 6, limit: 6,
fields: "firstEpisode",
}, },
}); });