Keep invoice modal open if focus is lost
This commit is contained in:
parent
7dda8a1e01
commit
6b4b5023f6
|
@ -21,6 +21,7 @@ export function useShowModal () {
|
|||
|
||||
export default function useModal () {
|
||||
const [modalContent, setModalContent] = useState(null)
|
||||
const [modalOptions, setModalOptions] = useState(null)
|
||||
|
||||
const onClose = useCallback(() => {
|
||||
setModalContent(null)
|
||||
|
@ -31,7 +32,7 @@ export default function useModal () {
|
|||
return null
|
||||
}
|
||||
return (
|
||||
<Modal onHide={onClose} show={!!modalContent}>
|
||||
<Modal onHide={modalOptions?.keepOpen ? null : onClose} show={!!modalContent}>
|
||||
<div className='modal-close' onClick={onClose}>X</div>
|
||||
<Modal.Body>
|
||||
{modalContent}
|
||||
|
@ -41,7 +42,8 @@ export default function useModal () {
|
|||
}, [modalContent, onClose])
|
||||
|
||||
const showModal = useCallback(
|
||||
(getContent) => {
|
||||
(getContent, options) => {
|
||||
setModalOptions(options)
|
||||
setModalContent(getContent(onClose))
|
||||
},
|
||||
[onClose]
|
||||
|
|
|
@ -58,7 +58,7 @@ export const useAnonymous = (fn, options = defaultOptions) => {
|
|||
}, 2000)
|
||||
}
|
||||
} successVerb='received'
|
||||
/>
|
||||
/>, { keepOpen: true }
|
||||
)
|
||||
}
|
||||
}, [invoice?.id])
|
||||
|
|
Loading…
Reference in New Issue