import PlayArrow from "@material-symbols/svg-400/rounded/play_arrow-fill.svg";
import { useState } from "react";
import { useTranslation } from "react-i18next";
import { ScrollView, View, type ViewProps } from "react-native";
import { ItemContext } from "~/components/items/context-menus";
import { ItemWatchStatus } from "~/components/items/item-helpers";
import type { Genre, KImage, WatchStatusV } from "~/models";
import {
Chip,
IconFab,
Link,
P,
PosterBackground,
Skeleton,
SubP,
tooltip,
ts,
} from "~/primitives";
import type { Layout } from "~/query";
import { cn } from "~/utils";
export const ItemDetails = ({
slug,
kind,
name,
tagline,
subtitle,
description,
poster,
genres,
href,
playHref,
watchStatus,
availableCount,
seenCount,
className,
...props
}: {
slug: string;
kind: "movie" | "serie" | "collection";
name: string;
tagline: string | null;
subtitle: string | null;
poster: KImage | null;
genres: Genre[] | null;
description: string | null;
href: string;
playHref: string | null;
watchStatus: WatchStatusV | null;
availableCount?: number | null;
seenCount?: number | null;
} & ViewProps) => {
const [moreOpened, setMoreOpened] = useState(false);
const { t } = useTranslation();
return (
setMoreOpened(true)}
className={cn(
"h-full flex-row overflow-hidden rounded-xl bg-card",
"group outline-0 ring-accent focus-within:ring-3 hover:ring-3",
)}
>
{name}
{subtitle && {subtitle}}
{kind !== "collection" && (
setMoreOpened(v)}
/>
)}
{tagline && {tagline}
}
{description ?? t("show.noOverview")}
{/* This view needs to be out of the Link because nested are not allowed on the web */}
{genres && (
{genres.map((x, i) => (
))}
)}
{playHref !== null && (
)}
);
};
ItemDetails.Loader = ({ className, ...props }: ViewProps) => {
return (
);
};
ItemDetails.layout = {
size: 288,
numColumns: { xs: 1, md: 2, xl: 3 },
layout: "grid",
gap: { xs: ts(1), md: ts(8) },
} satisfies Layout;