import "./stream-page.css"; import { parseNostrLink, EventPublisher } from "@snort/system"; import { useNavigate, useParams } from "react-router-dom"; import useEventFeed from "hooks/event-feed"; import { LiveVideoPlayer } from "element/live-video-player"; import { findTag } from "utils"; import { Profile, getName } from "element/profile"; import { LiveChat } from "element/live-chat"; import AsyncButton from "element/async-button"; import { useLogin } from "hooks/login"; import { StreamState, System } from "index"; import { SendZapsDialog } from "element/send-zap"; import type { NostrLink } from "@snort/system"; import { useUserProfile } from "@snort/system-react"; import { NewStreamDialog } from "element/new-stream"; import { Tags } from "element/tags"; import { StatePill } from "element/state-pill"; function ProfileInfo({ link }: { link: NostrLink }) { const thisEvent = useEventFeed(link, true); const login = useLogin(); const navigate = useNavigate(); const host = thisEvent.data?.tags.find((a) => a[0] === "p" && a[3] === "host")?.[1] ?? thisEvent.data?.pubkey; const profile = useUserProfile(System, host); const zapTarget = profile?.lud16 ?? profile?.lud06; const status = thisEvent?.data ? findTag(thisEvent.data, "status") : ""; const isMine = link.author === login?.pubkey; async function deleteStream() { const pub = await EventPublisher.nip7(); if (pub && thisEvent.data) { const ev = await pub.delete(thisEvent.data.id); console.debug(ev); System.BroadcastEvent(ev); navigate("/"); } } return ( <>

{findTag(thisEvent.data, "title")}

{findTag(thisEvent.data, "summary")}

{thisEvent?.data && } {isMine && (
{thisEvent.data && ( )} Delete
)}
{zapTarget && thisEvent.data && ( )}
); } function VideoPlayer({ link }: { link: NostrLink }) { const thisEvent = useEventFeed(link); const stream = findTag(thisEvent.data, "streaming"); const image = findTag(thisEvent.data, "image"); return (
); } export function StreamPage() { const params = useParams(); const link = parseNostrLink(params.id!); return ( <> ); }