fix: note embeds

This commit is contained in:
Kieran 2023-12-08 12:33:44 +00:00
parent 6cf144127a
commit 74c087525c
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
2 changed files with 10 additions and 5 deletions

View File

@ -1,7 +1,6 @@
import "./note.css";
import { lazy } from "react";
import { type NostrEvent, NostrPrefix } from "@snort/system";
import { hexToBech32 } from "@snort/shared";
import { Suspense, lazy } from "react";
import { type NostrEvent, NostrLink } from "@snort/system";
const Markdown = lazy(() => import("./markdown"));
import { ExternalIconLink } from "./external-link";
@ -15,11 +14,13 @@ export function Note({ ev }: { ev: NostrEvent }) {
<ExternalIconLink
size={24}
className="note-link-icon"
href={`https://snort.social/e/${hexToBech32(NostrPrefix.Event, ev.id)}`}
href={`https://snort.social/e/${NostrLink.fromEvent(ev).encode()}`}
/>
</div>
<div className="note-content">
<Markdown tags={ev.tags} content={ev.content} />
<Suspense>
<Markdown tags={ev.tags} content={ev.content} />
</Suspense>
</div>
</div>
);

View File

@ -49,6 +49,10 @@ export function Text({ content, tags, eventComponent }: TextProps) {
}
case "mention":
return <Mention pubkey={f.content} />;
case "hashtag":
return <Link to={`/t/${f.content}`}>
#{f.content}
</Link>
default: {
if (f.content.startsWith("lnurlp:")) {
// LUD-17: https://github.com/lnurl/luds/blob/luds/17.md