mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
9b6f83dfd4
Share modal for React IDE page GitOrigin-RevId: f72f824abdcb5a135c354e3ccc35912b2097673f
38 lines
1.3 KiB
TypeScript
38 lines
1.3 KiB
TypeScript
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'
|
|
import ShareProjectModal from '@/features/share-project-modal/components/share-project-modal'
|
|
|
|
function EditorNavigationToolbar() {
|
|
const [showShareModal, setShowShareModal] = useState(false)
|
|
const { onlineUsersArray } = useOnlineUsersContext()
|
|
const { openDoc } = useEditorManagerContext()
|
|
|
|
const handleOpenShareModal = () => {
|
|
eventTracking.sendMBOnce('ide-open-share-modal-once')
|
|
setShowShareModal(true)
|
|
}
|
|
|
|
const handleHideShareModal = useCallback(() => {
|
|
setShowShareModal(false)
|
|
}, [])
|
|
|
|
return (
|
|
<>
|
|
<EditorNavigationToolbarRoot
|
|
// @ts-ignore
|
|
onlineUsersArray={onlineUsersArray}
|
|
openDoc={openDoc}
|
|
openShareProjectModal={handleOpenShareModal}
|
|
/>
|
|
<ShareProjectModal
|
|
show={showShareModal}
|
|
handleHide={handleHideShareModal}
|
|
/>
|
|
</>
|
|
)
|
|
}
|
|
|
|
export default EditorNavigationToolbar
|