Browse Source

add QR codes to the payment modal

imwald
Silberengel 3 weeks ago
parent
commit
bdeec921de
  1. 2
      package.json
  2. 16
      src/components/PaytoDialog/index.tsx
  3. 4681
      src/i18n/locales/cs.ts
  4. 4857
      src/i18n/locales/de.ts
  5. 4960
      src/i18n/locales/en.ts
  6. 4701
      src/i18n/locales/es.ts
  7. 4702
      src/i18n/locales/fr.ts
  8. 4681
      src/i18n/locales/nl.ts
  9. 4700
      src/i18n/locales/pl.ts
  10. 4702
      src/i18n/locales/ru.ts
  11. 4681
      src/i18n/locales/tr.ts
  12. 4683
      src/i18n/locales/zh.ts
  13. 9
      src/lib/payto-targets.test.ts

2
package.json

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
{
"name": "imwald",
"version": "23.15.1",
"version": "23.16.0",
"description": "Imwald — a user-friendly Nostr client focused on relay feed browsing, publications, and relay discovery",
"private": true,
"type": "module",

16
src/components/PaytoDialog/index.tsx

@ -36,6 +36,7 @@ import { cn } from '@/lib/utils' @@ -36,6 +36,7 @@ import { cn } from '@/lib/utils'
import { useNostr } from '@/providers/NostrProvider'
import { mergePostPaymentContext, type PostPaymentContext } from '@/lib/post-payment-context'
import { NostrEvent } from 'nostr-tools'
import QrCode from '@/components/QrCode'
import LightningInvoiceSection from './LightningInvoiceSection'
export default function PaytoDialog({
@ -170,6 +171,9 @@ export default function PaytoDialog({ @@ -170,6 +171,9 @@ export default function PaytoDialog({
[isLightning, type, authority]
)
/** Wallet deep link (`bitcoin:…`) or funding page URL — not the payto:// URI. */
const qrPayload = walletOpenUri ?? authority
const showPrimaryOpen = isLikelyMobileWalletUserAgent() && !!walletOpenUri
const handleOpenWallet = () => {
@ -229,6 +233,18 @@ export default function PaytoDialog({ @@ -229,6 +233,18 @@ export default function PaytoDialog({
</p>
<p className="break-all font-mono text-base leading-relaxed select-text sm:text-lg">{authority}</p>
</div>
<div
className="flex min-w-0 flex-col items-center gap-2"
role="img"
aria-label={t('Scan to pay with your wallet')}
>
<div className="w-full max-w-[min(100%,240px)]">
<QrCode value={qrPayload} size={240} />
</div>
<p className="text-center text-sm text-muted-foreground sm:text-base">
{t('Scan to pay with your wallet')}
</p>
</div>
<div className="flex min-w-0 flex-col gap-2">
{showPrimaryOpen && walletOpenUri ? (
<Button

4681
src/i18n/locales/cs.ts

File diff suppressed because it is too large Load Diff

4857
src/i18n/locales/de.ts

File diff suppressed because it is too large Load Diff

4960
src/i18n/locales/en.ts

File diff suppressed because it is too large Load Diff

4701
src/i18n/locales/es.ts

File diff suppressed because it is too large Load Diff

4702
src/i18n/locales/fr.ts

File diff suppressed because it is too large Load Diff

4681
src/i18n/locales/nl.ts

File diff suppressed because it is too large Load Diff

4700
src/i18n/locales/pl.ts

File diff suppressed because it is too large Load Diff

4702
src/i18n/locales/ru.ts

File diff suppressed because it is too large Load Diff

4681
src/i18n/locales/tr.ts

File diff suppressed because it is too large Load Diff

4683
src/i18n/locales/zh.ts

File diff suppressed because it is too large Load Diff

9
src/lib/payto-targets.test.ts

@ -26,6 +26,15 @@ describe('resolveNativeWalletUri', () => { @@ -26,6 +26,15 @@ describe('resolveNativeWalletUri', () => {
walletApps: ['cakewallet']
})
).toBe('bitcoin:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh')
expect(
resolvePaytoProfileUrl('bitcoin', 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh')
).toBe('bitcoin:bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh')
})
it('builds full HTTPS URL for Geyser and similar tip platforms', () => {
expect(resolvePaytoProfileUrl('geyser', 'my-project')).toBe(
'https://geyser.fund/project/my-project'
)
})
it('maps BIP-353 to lightning: URI', () => {

Loading…
Cancel
Save