2022-09-15 09:59:11 +00:00
|
|
|
import React from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
import { useProjectContext } from '../../../shared/context/project-context'
|
|
|
|
import withErrorBoundary from '../../../infrastructure/error-boundary'
|
|
|
|
import CloneProjectModal from './clone-project-modal'
|
|
|
|
|
|
|
|
const EditorCloneProjectModalWrapper = React.memo(
|
|
|
|
function EditorCloneProjectModalWrapper({ show, handleHide, openProject }) {
|
2023-09-28 10:12:18 +00:00
|
|
|
const {
|
|
|
|
_id: projectId,
|
|
|
|
name: projectName,
|
|
|
|
tags: projectTags,
|
|
|
|
} = useProjectContext()
|
2022-09-15 09:59:11 +00:00
|
|
|
|
|
|
|
if (!projectName) {
|
|
|
|
// wait for useProjectContext
|
|
|
|
return null
|
|
|
|
} else {
|
|
|
|
return (
|
|
|
|
<CloneProjectModal
|
|
|
|
handleHide={handleHide}
|
|
|
|
show={show}
|
|
|
|
handleAfterCloned={openProject}
|
|
|
|
projectId={projectId}
|
|
|
|
projectName={projectName}
|
2023-09-28 10:12:18 +00:00
|
|
|
projectTags={projectTags}
|
2022-09-15 09:59:11 +00:00
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
EditorCloneProjectModalWrapper.propTypes = {
|
|
|
|
handleHide: PropTypes.func.isRequired,
|
|
|
|
show: PropTypes.bool.isRequired,
|
|
|
|
openProject: PropTypes.func.isRequired,
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withErrorBoundary(EditorCloneProjectModalWrapper)
|