From 10efe97d27a0cf62d14b6eeb96ebe390d2ba61eb Mon Sep 17 00:00:00 2001 From: Dammshine <84041999+Dammshine@users.noreply.github.com> Date: Mon, 18 Mar 2024 01:56:56 +1100 Subject: [PATCH] 605 hide collaboration functioanlity (#610) * add back homepage * revert back font default color to whit * rearrange file locations * introduce devMode state => for releasing new feature that won't deploy * change to isDev => is in development --------- Co-authored-by: david zhou --- client/src/App.tsx | 10 +++---- .../{visualiser-debugger => }/Feedback.tsx | 0 .../{visualiser-debugger => }/HomePage.tsx | 0 .../{visualiser-debugger => }/Page404.scss | 0 .../src/{visualiser-debugger => }/Page404.tsx | 0 .../VisualiserPage.tsx | 0 client/src/components/Navbars/TopNavbar.tsx | 30 +++++++++++-------- .../VisualiserInterface/CreateMenu.tsx | 11 +++++-- client/src/store/globalStore.ts | 11 +++++++ client/src/structsThemes.ts | 2 +- .../Component/Console}/Console.tsx | 0 .../visualiser-debugger/DevelopmentMode.tsx | 8 ++--- 12 files changed, 47 insertions(+), 25 deletions(-) rename client/src/{visualiser-debugger => }/Feedback.tsx (100%) rename client/src/{visualiser-debugger => }/HomePage.tsx (100%) rename client/src/{visualiser-debugger => }/Page404.scss (100%) rename client/src/{visualiser-debugger => }/Page404.tsx (100%) rename client/src/{visualiser-debugger => }/VisualiserPage.tsx (100%) create mode 100644 client/src/store/globalStore.ts rename client/src/{components/DevelopmentMode => visualiser-debugger/Component/Console}/Console.tsx (100%) diff --git a/client/src/App.tsx b/client/src/App.tsx index 228041816..ab2909cde 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,10 +1,10 @@ import { ThemeProvider, Box } from '@mui/material'; import { AnimatePresence } from 'framer-motion'; import { Route, Routes } from 'react-router-dom'; -import Feedback from 'visualiser-debugger/Feedback'; -import HomePage from 'visualiser-debugger/HomePage'; -import Page404 from 'visualiser-debugger/Page404'; -import VisualiserPage from 'visualiser-debugger/VisualiserPage'; +import Feedback from 'Feedback'; +import HomePage from 'HomePage'; +import Page404 from 'Page404'; +import VisualiserPage from 'VisualiserPage'; import { structsTheme } from 'structsThemes'; import './App.scss'; import DevelopmentMode from 'visualiser-debugger/DevelopmentMode'; @@ -15,7 +15,7 @@ const App = () => ( {/* Homepage */} - } /> + } /> {/* Visualiser routes */} } /> diff --git a/client/src/visualiser-debugger/Feedback.tsx b/client/src/Feedback.tsx similarity index 100% rename from client/src/visualiser-debugger/Feedback.tsx rename to client/src/Feedback.tsx diff --git a/client/src/visualiser-debugger/HomePage.tsx b/client/src/HomePage.tsx similarity index 100% rename from client/src/visualiser-debugger/HomePage.tsx rename to client/src/HomePage.tsx diff --git a/client/src/visualiser-debugger/Page404.scss b/client/src/Page404.scss similarity index 100% rename from client/src/visualiser-debugger/Page404.scss rename to client/src/Page404.scss diff --git a/client/src/visualiser-debugger/Page404.tsx b/client/src/Page404.tsx similarity index 100% rename from client/src/visualiser-debugger/Page404.tsx rename to client/src/Page404.tsx diff --git a/client/src/visualiser-debugger/VisualiserPage.tsx b/client/src/VisualiserPage.tsx similarity index 100% rename from client/src/visualiser-debugger/VisualiserPage.tsx rename to client/src/VisualiserPage.tsx diff --git a/client/src/components/Navbars/TopNavbar.tsx b/client/src/components/Navbars/TopNavbar.tsx index c3937cd46..55029d372 100644 --- a/client/src/components/Navbars/TopNavbar.tsx +++ b/client/src/components/Navbars/TopNavbar.tsx @@ -22,6 +22,7 @@ import { titleToUrl, toTitleCase, urlToTitle } from 'utils/url'; import axios from 'axios'; import Login from 'components/Login/Login'; import { getTopics } from '../../visualiser-src/common/helpers'; +import useGlobalState from '../../store/globalStore'; const LogoText = styled(Typography)({ textTransform: 'none', @@ -57,6 +58,7 @@ const TopNavbar: FC = ({ position = 'fixed' }) => { setLoggedIn(false); }; + const inDev = useGlobalState((state) => state.inDev); return ( = ({ position = 'fixed' }) => { - - {loggedIn ? ( - <> - - - - ) : ( - - )} - + + {/* TODO: Release this feature */} + {inDev && ( + + {loggedIn ? ( + <> + + + + ) : ( + + )} + + )} diff --git a/client/src/components/Visualiser/VisualiserInterface/CreateMenu.tsx b/client/src/components/Visualiser/VisualiserInterface/CreateMenu.tsx index c04bd1a63..70a44e477 100644 --- a/client/src/components/Visualiser/VisualiserInterface/CreateMenu.tsx +++ b/client/src/components/Visualiser/VisualiserInterface/CreateMenu.tsx @@ -4,6 +4,7 @@ import React, { useCallback, useContext } from 'react'; import VisualiserContext from './VisualiserContext'; import CreateLink from './CreateLink'; import Saving from './Saving'; +import useGlobalState from '../../../store/globalStore'; const MenuButton = styled(Button)({ backgroundColor: '#46B693', @@ -39,6 +40,7 @@ const CreateMenu = () => { controller.generateDataStructure(); }, [controller]); + const inDev = useGlobalState((state) => state.inDev); return ( { Reset All - - + {/* TODO: Release this feature */} + {inDev && ( + <> + + + + )} ); }; diff --git a/client/src/store/globalStore.ts b/client/src/store/globalStore.ts new file mode 100644 index 000000000..778be1636 --- /dev/null +++ b/client/src/store/globalStore.ts @@ -0,0 +1,11 @@ +import { create } from 'zustand'; + +export interface GlobalState { + inDev: boolean; +} + +const useGlobalState = create(() => ({ + inDev: true, +})); + +export default useGlobalState; diff --git a/client/src/structsThemes.ts b/client/src/structsThemes.ts index 548336c23..c0c6c8808 100644 --- a/client/src/structsThemes.ts +++ b/client/src/structsThemes.ts @@ -26,7 +26,7 @@ export const structsTheme = createTheme({ paper: '#14113C', }, text: { - primary: '#00000', + primary: '#FFFFFF', secondary: 'rgba(255, 255, 255, 0.7)', disabled: 'rgba(255, 255, 255, 0.5)', }, diff --git a/client/src/components/DevelopmentMode/Console.tsx b/client/src/visualiser-debugger/Component/Console/Console.tsx similarity index 100% rename from client/src/components/DevelopmentMode/Console.tsx rename to client/src/visualiser-debugger/Component/Console/Console.tsx diff --git a/client/src/visualiser-debugger/DevelopmentMode.tsx b/client/src/visualiser-debugger/DevelopmentMode.tsx index 1e3af7852..c22e29fde 100644 --- a/client/src/visualiser-debugger/DevelopmentMode.tsx +++ b/client/src/visualiser-debugger/DevelopmentMode.tsx @@ -5,7 +5,7 @@ import globalStyles from 'styles/global.module.css'; import classNames from 'classnames'; import { Tabs, Tab } from 'components/Tabs'; import { Socket } from 'socket.io-client'; -import Console from 'components/DevelopmentMode/Console'; +import Console from 'visualiser-debugger/Component/Console/Console'; import DevelopmentModeNavbar from '../components/Navbars/DevelopmentModeNavbar'; import Configuration from './Component/Configuration/Configuration'; import Controls from './Component/Control/Controls'; @@ -21,6 +21,7 @@ import { PLACEHOLDER_WORKSPACE, loadCode, } from './Component/FileTree/Util/util'; +import useGlobalState from '../store/globalStore'; type ExtendedWindow = Window & typeof globalThis & { socket: Socket; getBreakpoints: (line: string, listName: string) => void }; @@ -190,8 +191,7 @@ const DevelopmentMode = () => { // Refactor to better support Debugger mode // - There're a lot of console.log functions, we can delegate responsibility in each component // - Refactor Tabs - const DEBUG_MODE = false; - return !DEBUG_MODE ? ( + return (
@@ -255,8 +255,6 @@ const DevelopmentMode = () => {
- ) : ( - ); };