Live event page

This commit is contained in:
2023-06-18 14:14:34 +01:00
parent adaa8a71e7
commit 769e093663
11 changed files with 168 additions and 18 deletions

View File

@ -1,11 +1,25 @@
import { NostrEvent } from "@snort/system";
import { findTag } from "SnortUtils";
import { LiveVideoPlayer } from "Element/LiveVideoPlayer";
import { NostrEvent, NostrPrefix, encodeTLV } from "@snort/system";
import { findTag, unwrap } from "SnortUtils";
import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom";
export function LiveEvent({ ev }: { ev: NostrEvent }) {
const stream = findTag(ev, "streaming");
if (stream) {
return <LiveVideoPlayer src={stream} />;
}
return null;
const title = findTag(ev, "title");
const d = unwrap(findTag(ev, "d"));
return (
<div className="text">
<div className="flex card">
<div className="f-grow">
<h3>{title}</h3>
</div>
<div>
<Link to={`/live/${encodeTLV(NostrPrefix.Address, d, undefined, ev.kind, ev.pubkey)}`}>
<button className="primary" type="button">
<FormattedMessage defaultMessage="Watch Live!" />
</button>
</Link>
</div>
</div>
</div>
);
}