actions-copy-project.tsx 989 B

123456789101112131415161718192021222324252627282930
  1. import { useCallback, useState } from 'react'
  2. import { useTranslation } from 'react-i18next'
  3. import EditorCloneProjectModalWrapper from '../../clone-project-modal/components/editor-clone-project-modal-wrapper'
  4. import LeftMenuButton from './left-menu-button'
  5. import * as eventTracking from '../../../infrastructure/event-tracking'
  6. import useOpenProject from '@/shared/hooks/use-open-project'
  7. export default function ActionsCopyProject() {
  8. const [showModal, setShowModal] = useState(false)
  9. const { t } = useTranslation()
  10. const openProject = useOpenProject()
  11. const handleShowModal = useCallback(() => {
  12. eventTracking.sendMB('left-menu-copy')
  13. setShowModal(true)
  14. }, [])
  15. return (
  16. <>
  17. <LeftMenuButton onClick={handleShowModal} icon="file_copy">
  18. {t('copy_project')}
  19. </LeftMenuButton>
  20. <EditorCloneProjectModalWrapper
  21. show={showModal}
  22. handleHide={() => setShowModal(false)}
  23. openProject={openProject}
  24. />
  25. </>
  26. )
  27. }