2023-10-16 07:10:43 -04:00
|
|
|
import { useConnectionContext } from '@/features/ide-react/context/connection-context'
|
|
|
|
import useEventListener from '@/shared/hooks/use-event-listener'
|
2023-10-26 04:57:00 -04:00
|
|
|
import { useCallback, useEffect, useState } from 'react'
|
2023-10-18 05:14:58 -04:00
|
|
|
import { Alerts } from '@/features/ide-react/components/alerts/alerts'
|
2023-10-26 04:57:00 -04:00
|
|
|
import { useLayoutContext } from '@/shared/context/layout-context'
|
|
|
|
import MainLayout from '@/features/ide-react/components/layout/main-layout'
|
|
|
|
import { EditorAndSidebar } from '@/features/ide-react/components/editor-and-sidebar'
|
|
|
|
import EditorLeftMenu from '@/features/editor-left-menu/components/editor-left-menu'
|
2023-10-27 04:43:50 -04:00
|
|
|
import EditorNavigationToolbar from '@/features/ide-react/components/editor-navigation-toolbar'
|
2023-10-27 05:06:25 -04:00
|
|
|
import ChatPane from '@/features/chat/components/chat-pane'
|
2023-10-26 04:57:00 -04:00
|
|
|
import { useLayoutEventTracking } from '@/features/ide-react/hooks/use-layout-event-tracking'
|
2023-10-27 04:43:50 -04:00
|
|
|
import useSocketListeners from '@/features/ide-react/hooks/use-socket-listeners'
|
2023-10-02 05:35:02 -04:00
|
|
|
|
|
|
|
// This is filled with placeholder content while the real content is migrated
|
|
|
|
// away from Angular
|
|
|
|
export default function IdePage() {
|
2023-10-26 04:57:00 -04:00
|
|
|
useLayoutEventTracking()
|
2023-10-27 04:43:50 -04:00
|
|
|
useSocketListeners()
|
2023-10-26 04:57:00 -04:00
|
|
|
|
|
|
|
const [leftColumnDefaultSize, setLeftColumnDefaultSize] = useState(20)
|
2023-10-16 07:10:43 -04:00
|
|
|
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])
|
|
|
|
|
2023-10-27 06:50:57 -04:00
|
|
|
const { chatIsOpen } = useLayoutContext()
|
2023-10-26 04:57:00 -04:00
|
|
|
|
2023-10-27 06:50:57 -04:00
|
|
|
const mainContent = (
|
2023-10-26 04:57:00 -04:00
|
|
|
<EditorAndSidebar
|
|
|
|
leftColumnDefaultSize={leftColumnDefaultSize}
|
|
|
|
setLeftColumnDefaultSize={setLeftColumnDefaultSize}
|
|
|
|
shouldPersistLayout
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
|
2023-10-02 05:35:02 -04:00
|
|
|
return (
|
2023-10-16 07:10:43 -04:00
|
|
|
<>
|
2023-10-18 05:14:58 -04:00
|
|
|
<Alerts />
|
2023-10-26 04:57:00 -04:00
|
|
|
<EditorLeftMenu />
|
|
|
|
<MainLayout
|
2023-10-27 04:43:50 -04:00
|
|
|
headerContent={<EditorNavigationToolbar />}
|
2023-10-27 05:06:25 -04:00
|
|
|
chatContent={<ChatPane />}
|
2023-10-26 04:57:00 -04:00
|
|
|
mainContent={mainContent}
|
|
|
|
chatIsOpen={chatIsOpen}
|
|
|
|
shouldPersistLayout
|
|
|
|
/>
|
2023-10-16 07:10:43 -04:00
|
|
|
</>
|
2023-10-02 05:35:02 -04:00
|
|
|
)
|
|
|
|
}
|