stacker.news/components/bolt11-info.js
rleed d86d8b3bac
Provide option to clear withdrawal invoices (#591)
* add settings option

* add auto-drop worker

* add manual delete option

* add warning and note

* cleanup

* incorporate most review feedback

* add warning to settings option

* remove debugging tweaks and simplify

* refine auto delete bolt11s

* refine UI

---------

Co-authored-by: rleed <rleed1@pm.me>
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
2023-11-09 11:50:43 -06:00

54 lines
1.3 KiB
JavaScript

import { decode } from 'bolt11'
import AccordianItem from './accordian-item'
import { CopyInput } from './form'
export default ({ bolt11, preimage, children }) => {
let description, paymentHash
if (bolt11) {
({ tagsObject: { description, payment_hash: paymentHash } } = decode(bolt11))
}
if (!description && !paymentHash && !preimage) {
return null
}
return (
<div className='w-100'>
<AccordianItem
header='BOLT11 information'
body={
<>
{description &&
<CopyInput
label='description'
size='sm'
groupClassName='w-100'
readOnly
noForm
placeholder={description}
/>}
{paymentHash &&
<CopyInput
label='payment hash'
size='sm'
groupClassName='w-100'
readOnly
noForm
placeholder={paymentHash}
/>}
{preimage &&
<CopyInput
label='preimage'
size='sm'
groupClassName='w-100'
readOnly
noForm
placeholder={preimage}
/>}
{children}
</>
}
/>
</div>
)
}