feat: render zap dialog for lnurlp link

This commit is contained in:
Kieran 2023-11-14 12:31:17 +00:00
parent a34ad5ff71
commit cdf2f12e80
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
3 changed files with 49 additions and 43 deletions

View File

@ -14,10 +14,10 @@
"@radix-ui/react-toggle": "^1.0.3",
"@react-hook/resize-observer": "^1.2.6",
"@scure/base": "^1.1.1",
"@snort/shared": "^1.0.8",
"@snort/system": "^1.0.22",
"@snort/system-react": "^1.0.19",
"@snort/system-web": "^1.0.1",
"@snort/shared": "^1.0.9",
"@snort/system": "^1.1.1",
"@snort/system-react": "^1.1.1",
"@snort/system-web": "^1.0.2",
"@szhsin/react-menu": "^4.0.2",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",

View File

@ -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>;
}
}
}

View File

@ -2479,68 +2479,56 @@ __metadata:
languageName: node
linkType: hard
"@snort/shared@npm:^1.0.7":
version: 1.0.7
resolution: "@snort/shared@npm:1.0.7"
"@snort/shared@npm:^1.0.9":
version: 1.0.9
resolution: "@snort/shared@npm:1.0.9"
dependencies:
"@noble/curves": ^1.2.0
"@noble/hashes": ^1.3.2
"@scure/base": ^1.1.2
debug: ^4.3.4
light-bolt11-decoder: ^3.0.0
checksum: 83b61a945906896a40877dccc5d8c2bcb5a3a5cb49960db1595409fbfd8704f7d297b1350792b82447b328a26db3cb4967f0c662affe0365418376e45010a016
checksum: cb1c918f614486d46ab0c41f3a14644c8dcc34d7bd02bd1ca7473003119b08eacfba9a3b46f72f197261fb9af85d3717d638e21a09b914ab9bec262fe32219c4
languageName: node
linkType: hard
"@snort/shared@npm:^1.0.8":
version: 1.0.8
resolution: "@snort/shared@npm:1.0.8"
"@snort/system-react@npm:^1.1.1":
version: 1.1.1
resolution: "@snort/system-react@npm:1.1.1"
dependencies:
"@noble/curves": ^1.2.0
"@noble/hashes": ^1.3.2
"@scure/base": ^1.1.2
debug: ^4.3.4
light-bolt11-decoder: ^3.0.0
checksum: d91e4ffbd901931b05fdb953c2478b781fee1917551b51213e8e4c75a263c6fe2b230d908b036ca6d515d46bbe251adbd09792f150d89a8669f680f89d2f0344
languageName: node
linkType: hard
"@snort/system-react@npm:^1.0.19":
version: 1.0.19
resolution: "@snort/system-react@npm:1.0.19"
dependencies:
"@snort/shared": ^1.0.8
"@snort/system": ^1.0.22
"@snort/shared": ^1.0.9
"@snort/system": ^1.1.1
react: ^18.2.0
checksum: 317024f1726e70c6ba2d62c40cf60a8ae6e96f6b52961a6491fdf18e10db1f9a97e8c60f196146b083de22b351d938e7f665266f9e2ffdc1198aed52ebbd8fc8
checksum: fab77abfc738a5e415c2369aa509200b484faa09ff9dbf328872d0c527e315811a1adfcd991956837a3699e23a61d379b2eb536c9cf8dd45d013f8122c4824d5
languageName: node
linkType: hard
"@snort/system-web@npm:^1.0.1":
version: 1.0.1
resolution: "@snort/system-web@npm:1.0.1"
"@snort/system-web@npm:^1.0.2":
version: 1.0.2
resolution: "@snort/system-web@npm:1.0.2"
dependencies:
"@snort/shared": ^1.0.7
"@snort/system": ^1.0.22
"@snort/shared": ^1.0.9
"@snort/system": ^1.1.1
dexie: ^3.2.4
checksum: 5b213a8fd44b0e73193574cf8229798eeb50528f4291741d41b75a8154433cf4500327e29259734a1872cd6fc3cac22411a94eb2b7178d1ce3dbe1a5585bf9c7
checksum: 1beed3de3256bb94a952034bdb0739272dfba0a48c985f8f4f9d7730b409182b4abea0e00ba9b519d30729e18b9db0d0752d99281238d1789f47c3c076154339
languageName: node
linkType: hard
"@snort/system@npm:^1.0.22":
version: 1.0.22
resolution: "@snort/system@npm:1.0.22"
"@snort/system@npm:^1.1.1":
version: 1.1.1
resolution: "@snort/system@npm:1.1.1"
dependencies:
"@noble/curves": ^1.2.0
"@noble/hashes": ^1.3.2
"@scure/base": ^1.1.2
"@snort/shared": ^1.0.7
"@snort/shared": ^1.0.9
"@stablelib/xchacha20": ^1.0.1
debug: ^4.3.4
eventemitter3: ^5.0.1
isomorphic-ws: ^5.0.0
uuid: ^9.0.0
ws: ^8.14.0
checksum: 4d999aa94b7e07b04e9f18d75cd2b33ca364862a13abc0f2ff80d27f1988867f482c1fcefb5b5b276c049434041aca41e09e842e008c95b9bb6eaeffaaa1f9c8
checksum: 8c6d2b4061084245fbfa83e698949aba2e47dc23ca38af3d1ac0b2166dae4a397ea432a36f24891f2ff3d88aab7734818f13d013ae9615eb6bbdad0dddd82101
languageName: node
linkType: hard
@ -5295,6 +5283,13 @@ __metadata:
languageName: node
linkType: hard
"eventemitter3@npm:^5.0.1":
version: 5.0.1
resolution: "eventemitter3@npm:5.0.1"
checksum: 543d6c858ab699303c3c32e0f0f47fc64d360bf73c3daf0ac0b5079710e340d6fe9f15487f94e66c629f5f82cd1a8678d692f3dbb6f6fcd1190e1b97fcad36f8
languageName: node
linkType: hard
"events@npm:^3.2.0, events@npm:^3.3.0":
version: 3.3.0
resolution: "events@npm:3.3.0"
@ -9486,10 +9481,10 @@ __metadata:
"@radix-ui/react-toggle": ^1.0.3
"@react-hook/resize-observer": ^1.2.6
"@scure/base": ^1.1.1
"@snort/shared": ^1.0.8
"@snort/system": ^1.0.22
"@snort/system-react": ^1.0.19
"@snort/system-web": ^1.0.1
"@snort/shared": ^1.0.9
"@snort/system": ^1.1.1
"@snort/system-react": ^1.1.1
"@snort/system-web": ^1.0.2
"@szhsin/react-menu": ^4.0.2
"@testing-library/dom": ^9.3.1
"@testing-library/jest-dom": ^5.14.1