overleaf/services/web/frontend/js/features/ide-react/components/layout/ide-page.tsx
Tim Down 719da5fbd8 Merge pull request #15056 from overleaf/td-ide-connection-load
IDE page: connection manager and loading screen

GitOrigin-RevId: 2cbc8c09aeb36a14eae66da78b267c7a830fb71a
2023-10-17 08:03:13 +00:00

30 lines
1,007 B
TypeScript

import LayoutWithPlaceholders from '@/features/ide-react/components/layout/layout-with-placeholders'
import { useConnectionContext } from '@/features/ide-react/context/connection-context'
import useEventListener from '@/shared/hooks/use-event-listener'
import { useCallback, useEffect } from 'react'
// This is filled with placeholder content while the real content is migrated
// away from Angular
export default function IdePage() {
const { registerUserActivity } = useConnectionContext()
// Inform the connection manager when the user is active
const listener = useCallback(
() => registerUserActivity(),
[registerUserActivity]
)
useEventListener('cursor:editor:update', listener)
useEffect(() => {
document.body.addEventListener('click', listener)
return () => document.body.removeEventListener('click', listener)
}, [listener])
return (
<>
{/* TODO: Alerts and left menu will go here */}
<LayoutWithPlaceholders shouldPersistLayout />
</>
)
}