diff --git a/app/web/src/components/EditorMenu/EditorMenu.tsx b/app/web/src/components/EditorMenu/EditorMenu.tsx index c3f8556..57d8f6e 100644 --- a/app/web/src/components/EditorMenu/EditorMenu.tsx +++ b/app/web/src/components/EditorMenu/EditorMenu.tsx @@ -31,9 +31,7 @@ const EditorMenu = () => { - + thunkDispatch({type: 'resetLayout'})} /> - )} - - - {({ active }) => ( - - )} - - - + + + {({ active }) => ( + + )} + + + {({ active }) => ( + + )} + + + ) +} + +function ViewDropdown({ handleLayoutReset }) { + return ( + + + {({ active }) => ( + + )} + + + ) +} + +function Dropdown({ name, children }: {name: string, children: React.ReactNode}) { + return ( +
+ + {name} + + {children} + + +
) } diff --git a/app/web/src/helpers/hooks/useIdeState.js b/app/web/src/helpers/hooks/useIdeState.js index 2079340..55f3055 100644 --- a/app/web/src/helpers/hooks/useIdeState.js +++ b/app/web/src/helpers/hooks/useIdeState.js @@ -47,6 +47,16 @@ let mutableState = null export const useIdeState = () => { const code = '' + const initialLayout = { + direction: 'row', + first: 'Editor', + second: { + direction: 'column', + first: 'Viewer', + second: 'Console', + splitPercentage: 70, + }, + } const initialState = { ideType: 'INIT', consoleMessages: [ @@ -57,16 +67,7 @@ export const useIdeState = () => { type: 'INIT', data: null, }, - layout: { - direction: 'row', - first: 'Editor', - second: { - direction: 'column', - first: 'Viewer', - second: 'Console', - splitPercentage: 70, - }, - }, + layout: initialLayout, camera: {}, viewerSize: { width: 0, height: 0 }, isLoading: false, @@ -129,6 +130,11 @@ export const useIdeState = () => { ...state, isLoading: false, } + case 'resetLayout': + return { + ...state, + layout: initialLayout, + } default: return state }