mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
[web] Move UI scope to React states (#26403)
* Move `ui.view` to setState
* Move `openFile` to setState
* Move `ui.leftMenuShown` to setState
* Move `ui.miniReviewPanelVisible` to setState
* Move `ui.pdfLayout` to setState
* Move `ui.chatOpen` to setState
* Move `ui.reviewPanelOpen` to setState
* Cleanup: remove layout-context-adapter and imports
* Replace `ui` scope by mocked `LayoutProvider` in tests
* Update test
* Remove unnecessary `scopeStore.set('ui.chatOpen' ...`
GitOrigin-RevId: 81578bfdc958239eac492905f714a6074c81d0f5
This commit is contained in:
@@ -36,8 +36,6 @@ import { DocId } from '../../../../../types/project-settings'
|
||||
import { Update } from '@/features/history/services/types/update'
|
||||
import { useDebugDiffTracker } from '../hooks/use-debug-diff-tracker'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
import useScopeValueSetterOnly from '@/shared/hooks/use-scope-value-setter-only'
|
||||
import { BinaryFile } from '@/features/file-view/types/binary-file'
|
||||
import { convertFileRefToBinaryFile } from '@/features/ide-react/util/file-view'
|
||||
|
||||
export interface GotoOffsetOptions {
|
||||
@@ -97,7 +95,7 @@ export const EditorManagerProvider: FC<React.PropsWithChildren> = ({
|
||||
const { reportError, eventEmitter, projectId } = useIdeReactContext()
|
||||
const { setOutOfSync } = useEditorContext()
|
||||
const { socket, closeConnection, connectionState } = useConnectionContext()
|
||||
const { view, setView } = useLayoutContext()
|
||||
const { view, setView, setOpenFile } = useLayoutContext()
|
||||
const { showGenericMessageModal, genericModalVisible, showOutOfSyncModal } =
|
||||
useModalsContext()
|
||||
const { id: userId } = useUserContext()
|
||||
@@ -521,8 +519,6 @@ export const EditorManagerProvider: FC<React.PropsWithChildren> = ({
|
||||
[fileTreeData, openDoc]
|
||||
)
|
||||
|
||||
const [, setOpenFile] = useScopeValueSetterOnly<BinaryFile | null>('openFile')
|
||||
|
||||
const openFileWithId = useCallback(
|
||||
(fileRefId: string) => {
|
||||
const fileRef = findFileRefEntityById(fileTreeData, fileRefId)
|
||||
|
||||
Reference in New Issue
Block a user