2022-04-08 07:00:31 -04:00
|
|
|
import { useState, useCallback } from 'react'
|
|
|
|
import LeaveModalContent from './modal-content'
|
2024-05-15 10:31:00 -04:00
|
|
|
import OLModal from '@/features/ui/components/ol/ol-modal'
|
2022-04-08 07:00:31 -04:00
|
|
|
|
|
|
|
type LeaveModalProps = {
|
|
|
|
isOpen: boolean
|
|
|
|
handleClose: () => void
|
|
|
|
}
|
|
|
|
|
|
|
|
function LeaveModal({ isOpen, handleClose }: LeaveModalProps) {
|
|
|
|
const [inFlight, setInFlight] = useState(false)
|
|
|
|
|
|
|
|
const handleHide = useCallback(() => {
|
|
|
|
if (!inFlight) {
|
|
|
|
handleClose()
|
|
|
|
}
|
|
|
|
}, [handleClose, inFlight])
|
|
|
|
|
|
|
|
return (
|
2024-05-14 11:53:25 -04:00
|
|
|
<OLModal
|
2022-04-08 07:00:31 -04:00
|
|
|
animation
|
|
|
|
show={isOpen}
|
|
|
|
onHide={handleHide}
|
|
|
|
id="leave-modal"
|
2024-05-14 11:53:25 -04:00
|
|
|
bs3Props={{ backdrop: 'static' }}
|
2022-04-08 07:00:31 -04:00
|
|
|
>
|
|
|
|
<LeaveModalContent
|
|
|
|
handleHide={handleHide}
|
|
|
|
inFlight={inFlight}
|
|
|
|
setInFlight={setInFlight}
|
|
|
|
/>
|
2024-05-14 11:53:25 -04:00
|
|
|
</OLModal>
|
2022-04-08 07:00:31 -04:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default LeaveModal
|