/* * Kyoo - A portable and vast media library solution. * Copyright (c) Kyoo. * * See AUTHORS.md and LICENSE file in the project root for full license information. * * Kyoo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * Kyoo is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Kyoo. If not, see . */ import type { KyooImage, WatchStatusV } from "@kyoo/models"; import { Heading, ImageBackground, Link, P, Poster, PosterBackground, Skeleton, imageBorderRadius, important, ts, } from "@kyoo/primitives"; import { useState } from "react"; import { Platform, View } from "react-native"; import { percent, px, rem, useYoshiki } from "yoshiki/native"; import { ItemContext } from "../components/context-menus"; import type { Layout } from "../fetch"; import { ItemWatchStatus } from "./grid"; import type { Stylable } from "yoshiki"; export const ItemList = ({ href, slug, type, name, subtitle, thumbnail, poster, watchStatus, unseenEpisodesCount, ...props }: { href: string; slug: string; type: "movie" | "show" | "collection"; name: string; subtitle: string | null; poster: KyooImage | null; thumbnail: KyooImage | null; watchStatus: WatchStatusV | null; unseenEpisodesCount: number | null; }) => { const { css } = useYoshiki("line"); const [moreOpened, setMoreOpened] = useState(false); return ( setMoreOpened(true)} containerStyle={{ borderRadius: px(imageBorderRadius), }} imageStyle={{ borderRadius: px(imageBorderRadius), }} {...css( { alignItems: "center", justifyContent: "space-evenly", flexDirection: "row", height: ItemList.layout.size, borderRadius: px(imageBorderRadius), overflow: "hidden", marginX: ItemList.layout.gap, child: { more: { opacity: 0, }, }, fover: { title: { textDecorationLine: "underline", }, more: { opacity: 100, }, }, }, props, )} > {name} {type !== "collection" && ( setMoreOpened(v)} {...css([ { // I dont know why marginLeft gets overwritten by the margin: px(2) so we important marginLeft: important(ts(2)), bg: (theme) => theme.darkOverlay, }, "more", Platform.OS === "web" && moreOpened && { opacity: important(100) }, ])} /> )} {subtitle && (

{subtitle}

)}
); }; ItemList.Loader = (props: object) => { const { css } = useYoshiki(); return ( theme.dark.background, marginX: ItemList.layout.gap, }, props, )} > ); }; ItemList.layout = { numColumns: 1, size: 300, layout: "vertical", gap: ts(2) } satisfies Layout;