Use NostrLink everywhere

This commit is contained in:
2023-09-19 09:30:01 +01:00
parent a1cd56292a
commit 9fb6f0dfee
24 changed files with 164 additions and 220 deletions

View File

@ -1,11 +1,10 @@
import { NostrEvent, NostrPrefix, encodeTLV } from "@snort/system";
import { findTag, unwrap } from "SnortUtils";
import { NostrEvent, NostrLink } from "@snort/system";
import { findTag } from "SnortUtils";
import { FormattedMessage } from "react-intl";
import { Link } from "react-router-dom";
export function LiveEvent({ ev }: { ev: NostrEvent }) {
const title = findTag(ev, "title");
const d = unwrap(findTag(ev, "d"));
return (
<div className="text">
<div className="flex card">
@ -13,7 +12,7 @@ export function LiveEvent({ ev }: { ev: NostrEvent }) {
<h3>{title}</h3>
</div>
<div>
<Link to={`https://zap.stream/${encodeTLV(NostrPrefix.Address, d, undefined, ev.kind, ev.pubkey)}`}>
<Link to={`https://zap.stream/${NostrLink.fromEvent(ev).encode()}`}>
<button className="primary" type="button">
<FormattedMessage defaultMessage="Watch Live!" />
</button>