feat: mentions

This commit is contained in:
Alejandro Gomez
2023-06-28 10:21:03 +02:00
committed by Kieran
parent 0c8fbcfef1
commit 4aafb19f7e
9 changed files with 243 additions and 22 deletions

View File

@ -0,0 +1,16 @@
import { NostrPrefix, tryParseNostrLink } from "@snort/system";
import { Mention } from "./mention";
export function NostrLink({ link }: { link: string }) {
const nav = tryParseNostrLink(link);
if (
nav?.type === NostrPrefix.PublicKey ||
nav?.type === NostrPrefix.Profile
) {
return <Mention pubkey={nav.id} relays={nav.relays} />;
} else {
<a href={link} target="_blank" rel="noreferrer" className="ext">
{link}
</a>;
}
}