mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-07 08:09:01 +02:00
19b38340ac
* Convert OLModal to named exports only
* Make closeButton the default for OLModalHeader
* Set `closeButton={false}` for modal that is not dismissible
* Fix duplicated imports
* Remove another unnecessary `closeButton` prop
* Fix import
---------
Co-authored-by: Antoine Clausse <antoine.clausse@overleaf.com>
GitOrigin-RevId: ddd7be6e59a966ac634683d2494d6e9d2c3732e6
54 lines
1.4 KiB
TypeScript
54 lines
1.4 KiB
TypeScript
import React, { memo, useCallback, useState } from 'react'
|
|
import CloneProjectModalContent from './clone-project-modal-content'
|
|
import { OLModal } from '@/shared/components/ol/ol-modal'
|
|
import { ClonedProject } from '../../../../../types/project/dashboard/api'
|
|
import { Tag } from '../../../../../app/src/Features/Tags/types'
|
|
|
|
function CloneProjectModal({
|
|
show,
|
|
handleHide,
|
|
handleAfterCloned,
|
|
projectId,
|
|
projectName,
|
|
projectTags,
|
|
}: {
|
|
show: boolean
|
|
handleHide: () => void
|
|
handleAfterCloned: (clonedProject: ClonedProject, tags: Tag[]) => void
|
|
projectId: string
|
|
projectName: string
|
|
projectTags: Tag[]
|
|
}) {
|
|
const [inFlight, setInFlight] = useState(false)
|
|
|
|
const onHide = useCallback(() => {
|
|
if (!inFlight) {
|
|
handleHide()
|
|
}
|
|
}, [handleHide, inFlight])
|
|
|
|
return (
|
|
<OLModal
|
|
animation
|
|
show={show}
|
|
onHide={onHide}
|
|
id="clone-project-modal"
|
|
// backdrop="static" will disable closing the modal by clicking
|
|
// outside of the modal element
|
|
backdrop={inFlight ? 'static' : undefined}
|
|
>
|
|
<CloneProjectModalContent
|
|
handleHide={onHide}
|
|
inFlight={inFlight}
|
|
setInFlight={setInFlight}
|
|
handleAfterCloned={handleAfterCloned}
|
|
projectId={projectId}
|
|
projectName={projectName}
|
|
projectTags={projectTags}
|
|
/>
|
|
</OLModal>
|
|
)
|
|
}
|
|
|
|
export default memo(CloneProjectModal)
|