2023-10-16 07:10:43 -04:00
|
|
|
import { useConnectionContext } from '@/features/ide-react/context/connection-context'
|
2023-11-13 06:03:03 -05:00
|
|
|
import { 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-11-06 08:11:06 -05:00
|
|
|
import { useModalsContext } from '@/features/ide-react/context/modals-context'
|
2023-11-03 08:15:36 -04:00
|
|
|
import { useOpenFile } from '@/features/ide-react/hooks/use-open-file'
|
2023-11-13 06:03:03 -05:00
|
|
|
import { useEditingSessionHeartbeat } from '@/features/ide-react/hooks/use-editing-session-heartbeat'
|
|
|
|
import { useRegisterUserActivity } from '@/features/ide-react/hooks/use-register-user-activity'
|
|
|
|
import { useHasLintingError } from '@/features/ide-react/hooks/use-has-linting-error'
|
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-11-13 06:03:03 -05:00
|
|
|
useEditingSessionHeartbeat()
|
|
|
|
useRegisterUserActivity()
|
|
|
|
useHasLintingError()
|
2023-10-26 04:57:00 -04:00
|
|
|
|
2023-11-03 08:15:36 -04:00
|
|
|
// This returns a function to open a binary file but for now we just use the
|
|
|
|
// fact that it also patches in ide.binaryFilesManager. Once Angular is gone,
|
|
|
|
// we can remove this hook from here and use it in the history file restore
|
|
|
|
// component instead.
|
|
|
|
useOpenFile()
|
|
|
|
|
2023-10-26 04:57:00 -04:00
|
|
|
const [leftColumnDefaultSize, setLeftColumnDefaultSize] = useState(20)
|
2023-11-13 06:03:03 -05:00
|
|
|
const { connectionState } = useConnectionContext()
|
2023-11-06 08:11:06 -05:00
|
|
|
const { showLockEditorMessageModal } = useModalsContext()
|
|
|
|
|
|
|
|
// Show modal when editor is forcefully disconnected
|
|
|
|
useEffect(() => {
|
|
|
|
if (connectionState.forceDisconnected) {
|
|
|
|
showLockEditorMessageModal(connectionState.forcedDisconnectDelay)
|
|
|
|
}
|
|
|
|
}, [
|
|
|
|
connectionState.forceDisconnected,
|
|
|
|
connectionState.forcedDisconnectDelay,
|
|
|
|
showLockEditorMessageModal,
|
|
|
|
])
|
2023-10-16 07:10:43 -04:00
|
|
|
|
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
|
|
|
)
|
|
|
|
}
|