- Clip page
- Reactions on notes / clips
- Summary clips / shares
This commit is contained in:
2024-03-05 16:35:20 +00:00
parent 0151c06f13
commit 1e190a042f
25 changed files with 369 additions and 207 deletions

37
src/element/clip.tsx Normal file
View File

@ -0,0 +1,37 @@
import { NostrLink, TaggedNostrEvent } from "@snort/system";
import { Profile } from "./profile";
import { FormattedMessage } from "react-intl";
import { extractStreamInfo, findTag } from "@/utils";
import { useEventFeed } from "@snort/system-react";
import EventReactions from "./event-reactions";
import { Link } from "react-router-dom";
export default function LiveStreamClip({ ev }: { ev: TaggedNostrEvent }) {
const src = findTag(ev, "r");
const streamTag = NostrLink.fromTags(ev.tags)?.[0];
const streamEvent = useEventFeed(streamTag);
const { title } = extractStreamInfo(streamEvent);
return (
<>
<h1 className="mb-2">
<FormattedMessage
defaultMessage="Clip from {title}"
values={{
title: (
<Link className="text-primary" to={`/${streamTag?.encode()}`}>
{title}
</Link>
),
}}
/>
</h1>
<div className="rounded-xl px-4 py-3 flex flex-col gap-2 border border-layer-1">
{ev.content && <h2>{ev.content}</h2>}
<Profile pubkey={ev.pubkey} avatarSize={40} />
<video src={src} controls />
<EventReactions ev={ev} />
</div>
</>
);
}