19 lines
513 B
JavaScript
Raw Normal View History

2021-06-26 22:09:39 -05:00
import LnQR from './lnqr'
2021-05-06 16:15:22 -05:00
export function Invoice ({ invoice }) {
2021-05-13 08:28:38 -05:00
let variant = 'default'
2021-05-11 10:52:50 -05:00
let status = 'waiting for you'
if (invoice.confirmedAt) {
2021-05-13 08:28:38 -05:00
variant = 'confirmed'
2021-05-11 10:52:50 -05:00
status = `${invoice.msatsReceived / 1000} sats deposited`
} else if (invoice.cancelled) {
2021-05-13 08:28:38 -05:00
variant = 'failed'
2021-05-11 10:52:50 -05:00
status = 'cancelled'
} else if (invoice.expiresAt <= new Date()) {
2021-05-13 08:28:38 -05:00
variant = 'failed'
2021-05-11 10:52:50 -05:00
status = 'expired'
}
2021-05-06 16:15:22 -05:00
2021-09-07 12:52:59 -05:00
return <LnQR webLn value={invoice.bolt11} statusVariant={variant} status={status} />
2021-05-06 16:15:22 -05:00
}