Keep invoice modal open if focus is lost

This commit is contained in:
ekzyis 2023-07-22 12:56:30 +02:00
parent 7dda8a1e01
commit 6b4b5023f6
2 changed files with 5 additions and 3 deletions

View File

@ -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]

View File

@ -58,7 +58,7 @@ export const useAnonymous = (fn, options = defaultOptions) => {
}, 2000)
}
} successVerb='received'
/>
/>, { keepOpen: true }
)
}
}, [invoice?.id])