feat: render zap dialog for lnurlp link
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
import { NostrLink, NostrPrefix, ParsedFragment, transformText, tryParseNostrLink } from "@snort/system";
|
||||
import { FunctionComponent, useMemo } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
import { Emoji } from "./emoji";
|
||||
import { Mention } from "./mention";
|
||||
import { HyperText } from "./hypertext";
|
||||
import { Event } from "./Event";
|
||||
import { SendZapsDialog } from "./send-zap";
|
||||
|
||||
export type EventComponent = FunctionComponent<{ link: NostrLink }>;
|
||||
|
||||
@ -43,8 +45,17 @@ export function Text({ content, tags, eventComponent }: TextProps) {
|
||||
}
|
||||
case "mention":
|
||||
return <Mention pubkey={f.content} />;
|
||||
default:
|
||||
default: {
|
||||
if (f.content.startsWith("lnurlp:")) {
|
||||
// LUD-17: https://github.com/lnurl/luds/blob/luds/17.md
|
||||
const url = new URL(f.content);
|
||||
url.protocol = "https:";
|
||||
return <SendZapsDialog pubkey={undefined} lnurl={url.toString()} button={<Link to={""}>
|
||||
{f.content}
|
||||
</Link>} />
|
||||
}
|
||||
return <span className="text">{f.content}</span>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user