2023-10-27 04:43:50 -04:00
|
|
|
import { useState, useCallback } from 'react'
|
|
|
|
import { useOnlineUsersContext } from '@/features/ide-react/context/online-users-context'
|
|
|
|
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
|
|
|
import * as eventTracking from '@/infrastructure/event-tracking'
|
|
|
|
import EditorNavigationToolbarRoot from '@/features/editor-navigation-toolbar/components/editor-navigation-toolbar-root'
|
2024-06-25 02:08:24 -04:00
|
|
|
import NewShareProjectModal from '@/features/share-project-modal/components/restricted-link-sharing/share-project-modal'
|
2023-10-27 04:43:50 -04:00
|
|
|
import ShareProjectModal from '@/features/share-project-modal/components/share-project-modal'
|
2024-06-27 07:53:29 -04:00
|
|
|
import EditorOverLimitModal from '@/features/share-project-modal/components/restricted-link-sharing/editor-over-limit-modal'
|
2024-08-27 05:53:34 -04:00
|
|
|
import ViewOnlyAccessModal from '@/features/share-project-modal/components/restricted-link-sharing/view-only-access-modal'
|
2024-06-25 02:08:24 -04:00
|
|
|
import getMeta from '@/utils/meta'
|
2023-10-27 04:43:50 -04:00
|
|
|
|
|
|
|
function EditorNavigationToolbar() {
|
|
|
|
const [showShareModal, setShowShareModal] = useState(false)
|
|
|
|
const { onlineUsersArray } = useOnlineUsersContext()
|
|
|
|
const { openDoc } = useEditorManagerContext()
|
|
|
|
|
2024-06-28 02:18:21 -04:00
|
|
|
const handleOpenShareModal = useCallback(() => {
|
2023-10-27 04:43:50 -04:00
|
|
|
eventTracking.sendMBOnce('ide-open-share-modal-once')
|
|
|
|
setShowShareModal(true)
|
2024-06-28 02:18:21 -04:00
|
|
|
}, [])
|
2023-10-27 04:43:50 -04:00
|
|
|
|
|
|
|
const handleHideShareModal = useCallback(() => {
|
|
|
|
setShowShareModal(false)
|
|
|
|
}, [])
|
|
|
|
|
2024-06-25 02:08:24 -04:00
|
|
|
const showNewShareModal = getMeta('ol-linkSharingWarning')
|
|
|
|
|
2023-10-27 04:43:50 -04:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<EditorNavigationToolbarRoot
|
|
|
|
onlineUsersArray={onlineUsersArray}
|
|
|
|
openDoc={openDoc}
|
|
|
|
openShareProjectModal={handleOpenShareModal}
|
|
|
|
/>
|
2024-06-25 02:08:24 -04:00
|
|
|
{showNewShareModal ? (
|
2024-06-27 07:53:29 -04:00
|
|
|
<>
|
|
|
|
<EditorOverLimitModal />
|
2024-08-27 05:53:34 -04:00
|
|
|
<ViewOnlyAccessModal />
|
2024-06-27 07:53:29 -04:00
|
|
|
<NewShareProjectModal
|
|
|
|
show={showShareModal}
|
2024-06-28 02:18:21 -04:00
|
|
|
handleOpen={handleOpenShareModal}
|
2024-06-27 07:53:29 -04:00
|
|
|
handleHide={handleHideShareModal}
|
|
|
|
/>
|
|
|
|
</>
|
2024-06-25 02:08:24 -04:00
|
|
|
) : (
|
|
|
|
<ShareProjectModal
|
|
|
|
show={showShareModal}
|
|
|
|
handleHide={handleHideShareModal}
|
|
|
|
/>
|
|
|
|
)}
|
2023-10-27 04:43:50 -04:00
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default EditorNavigationToolbar
|