import QRCode from 'qrcode.react' import { CopyInput, InputSkeleton } from './form' import InvoiceStatus from './invoice-status' import { useEffect } from 'react' import { useWebLN } from './webln' import { useToast } from './toast' export default function Qr ({ asIs, value, webLn, statusVariant, description, status }) { const qrValue = asIs ? value : 'lightning:' + value.toUpperCase() const provider = useWebLN() const toaster = useToast() useEffect(() => { async function effect () { if (webLn) { try { await provider.sendPayment(value) } catch (e) { console.log(e?.message) toaster.danger(`${provider.name}: ${e?.message}`) } } } effect() }, []) return ( <> {description &&
{description}
}
) } export function QrSkeleton ({ status, description }) { return ( <>
{description &&
.
}
) }