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
*/
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
*/

View File

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

View File

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