mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

Remove Proptypes from CloneProjectModal GitOrigin-RevId: 400f4c9de72eb1910a0ca067882a6358663303d3
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import React, { memo, useCallback, useState } from 'react'
|
|
import CloneProjectModalContent from './clone-project-modal-content'
|
|
import OLModal from '@/features/ui/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)
|