import { useContext } from "react";
import type { RichContent } from "../model.ts";
import { PlayerContext } from "../contexts/PlayerContext.ts";
import Thumbnail from "./Thumbnail.tsx";
interface RichContentCardProps {
richContent: RichContent;
compact?: boolean;
/** Overrides richContent.thumbnailUrl with a custom dump thumbnail, if set. */
thumbnailOverrideUrl?: string;
/** Link back to the owning dump, surfaced as the global player's title. */
dumpHref?: string;
}
export default function RichContentCard(
{ richContent, compact = false, thumbnailOverrideUrl, dumpHref }:
RichContentCardProps,
) {
const { play, current, playing } = useContext(PlayerContext);
const thumbnailSrc = thumbnailOverrideUrl ?? richContent.thumbnailUrl;
const placeholder = {
url: richContent.url,
accentColor: richContent.accentColor,
faviconUrl: richContent.faviconUrl,
siteName: richContent.siteName,
};
if (compact) {
const thumbnail = (