overleaf/services/web/frontend/js/features/clone-project-modal/components/editor-clone-project-modal-wrapper.js
Alf Eaton 15475cdb3c Copy tags when cloning a project (#14987)
GitOrigin-RevId: 4cdca0ef2f26bf6bba02b675b0ef02ba8da881e2
2023-09-29 08:04:14 +00:00

39 lines
1.1 KiB
JavaScript

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 }) {
const {
_id: projectId,
name: projectName,
tags: projectTags,
} = useProjectContext()
if (!projectName) {
// wait for useProjectContext
return null
} else {
return (
<CloneProjectModal
handleHide={handleHide}
show={show}
handleAfterCloned={openProject}
projectId={projectId}
projectName={projectName}
projectTags={projectTags}
/>
)
}
}
)
EditorCloneProjectModalWrapper.propTypes = {
handleHide: PropTypes.func.isRequired,
show: PropTypes.bool.isRequired,
openProject: PropTypes.func.isRequired,
}
export default withErrorBoundary(EditorCloneProjectModalWrapper)