import { NostrEvent, NostrLink } from "@snort/system"; import { FormattedMessage } from "react-intl"; import { Link } from "react-router-dom"; import { getName } from "../profile"; import { StreamState } from "@/const"; import useImgProxy from "@/hooks/img-proxy"; import { formatSats } from "@/number"; import { extractStreamInfo, getHost, profileLink } from "@/utils"; import { useUserProfile } from "@snort/system-react"; import classNames from "classnames"; import { useState } from "react"; import { Avatar } from "../avatar"; import Logo from "../logo"; import { useContentWarning } from "../nsfw"; import PillOpaque from "../pill-opaque"; import { RelativeTime } from "../relative-time"; import { StatePill } from "../state-pill"; export function StreamTile({ ev, showAuthor = true, showStatus = true, showAvatar = true, style, className, }: { ev: NostrEvent; showAuthor?: boolean; showStatus?: boolean; showAvatar?: boolean; style: "list" | "grid"; className?: string; }) { const { title, image, status, participants, contentWarning, recording, ends } = extractStreamInfo(ev); const host = getHost(ev); const hostProfile = useUserProfile(host); const isGrownUp = useContentWarning(); const { proxy } = useImgProxy(); const link = NostrLink.fromEvent(ev); const [hasImg, setHasImage] = useState((image?.length ?? 0) > 0 || (recording?.length ?? 0) > 0); return (