feat: zapstr previews
This commit is contained in:
@ -5,6 +5,7 @@ import Mention from "Element/Mention";
|
||||
import NostrFileHeader from "Element/NostrFileHeader";
|
||||
import { parseNostrLink } from "Util";
|
||||
import NoteQuote from "Element/NoteQuote";
|
||||
import ZapstrEmbed from "Element/ZapstrEmbed";
|
||||
|
||||
export default function NostrLink({ link, depth }: { link: string; depth?: number }) {
|
||||
const nav = parseNostrLink(link);
|
||||
@ -15,6 +16,10 @@ export default function NostrLink({ link, depth }: { link: string; depth?: numbe
|
||||
if (nav.kind === EventKind.FileHeader) {
|
||||
return <NostrFileHeader link={nav} />;
|
||||
}
|
||||
if (nav.kind === 31337) {
|
||||
return <ZapstrEmbed link={nav} />;
|
||||
}
|
||||
|
||||
if ((depth ?? 0) > 0) {
|
||||
const evLink = nav.encode();
|
||||
return (
|
||||
|
11
packages/app/src/Element/ZapstrEmbed.tsx
Normal file
11
packages/app/src/Element/ZapstrEmbed.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
import useEventFeed from "Feed/EventFeed";
|
||||
import Spinner from "Icons/Spinner";
|
||||
import { NostrLink } from "Util";
|
||||
import Text from "./Text";
|
||||
|
||||
export default function ZapstrEmbed({ link }: { link: NostrLink }) {
|
||||
const ev = useEventFeed(link);
|
||||
|
||||
if (!ev.data) return <Spinner />;
|
||||
return <Text content={ev.data.content ?? ""} tags={[]} creator={ev.data.pubkey} />;
|
||||
}
|
Reference in New Issue
Block a user