From c6e46d14755c483182e78ff8de8919a37230a63f Mon Sep 17 00:00:00 2001 From: Davor Hrg Date: Mon, 11 Oct 2021 00:08:06 +0200 Subject: [PATCH] second attempt --- .../components/IdeSideBar/sidebarConfig.tsx | 31 ++++++++++++------- app/web/src/helpers/hooks/useIdeState.ts | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/web/src/components/IdeSideBar/sidebarConfig.tsx b/app/web/src/components/IdeSideBar/sidebarConfig.tsx index 11925e5..5659a38 100644 --- a/app/web/src/components/IdeSideBar/sidebarConfig.tsx +++ b/app/web/src/components/IdeSideBar/sidebarConfig.tsx @@ -105,18 +105,25 @@ const settingsConfig: settingsConfig[] = [ { title: 'Console', name: 'console', - Content: () => ( -
-

- Coming Soon -

-
-

- We're building configuration settings for the Viewer pane now. Join us - on if you want to lend a hand! -

-
- ), + Content: () => { + const { state, thunkDispatch } = useIdeContext() + return ( +
+
  • +
    Visible
    + { + state.consoleVisible = !state.consoleVisible + if (state.consoleVisible) + thunkDispatch({ type: 'resetLayout'}) + else + thunkDispatch({ type: 'setLayout', payload:{ message:{ direction: 'row', first: 'Editor', second: 'Viewer'}}}) + }} + checked={state.consoleVisible}/> +
  • +
    + ) + }, }, ] diff --git a/app/web/src/helpers/hooks/useIdeState.ts b/app/web/src/helpers/hooks/useIdeState.ts index aaa880f..8e2a79e 100644 --- a/app/web/src/helpers/hooks/useIdeState.ts +++ b/app/web/src/helpers/hooks/useIdeState.ts @@ -57,6 +57,7 @@ export interface State { isLoading: boolean threeInstance: RootState sideTray: string[] // could probably be an array of a union type + consoleVisible: boolean } const code = '' @@ -93,6 +94,7 @@ export const initialState: State = { isLoading: false, threeInstance: null, sideTray: [], + consoleVisible: true, } const reducer = (state: State, { type, payload }): State => {