overleaf/services/web/frontend/js/features/ide-react/components/editor-navigation-toolbar.tsx
Alf Eaton 0cde5be165 Merge pull request #14709 from overleaf/ae-context-typescript
Convert React context providers to TypeScript [don't squash!]

GitOrigin-RevId: d92a91798286978410956ab791d73c17c5086d86
2024-01-29 09:03:04 +00:00

37 lines
1.2 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
onlineUsersArray={onlineUsersArray}
openDoc={openDoc}
openShareProjectModal={handleOpenShareModal}
/>
<ShareProjectModal
show={showShareModal}
handleHide={handleHideShareModal}
/>
</>
)
}
export default EditorNavigationToolbar