diff --git a/client/src/App.jsx b/client/src/App.jsx index 603d97f..ad2140b 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -1,67 +1,8 @@ -import { Global, css } from "@emotion/react"; -import Header from './components/layout/Header/Header.jsx'; -import Sidebar from './components/layout/Sidebar/Sidebar.jsx'; -import Canvas from './components/layout/Canvas/Canvas.jsx'; -import { Grid, GridItem, useRecipe, Box } from '@chakra-ui/react'; +import Dashboard from './components/layout/Dashboard.jsx' function App() { - const recipe = useRecipe({ key: "canvas" }); - const styles = recipe(); - return ( - <> - - - -
- - - - - - - - - + ); } diff --git a/client/src/components/layout/Canvas/Canvas.jsx b/client/src/components/layout/Canvas/Canvas.jsx index ef6e2a8..a527aa8 100644 --- a/client/src/components/layout/Canvas/Canvas.jsx +++ b/client/src/components/layout/Canvas/Canvas.jsx @@ -1,22 +1,24 @@ // This Canvas component will be used to dynamically populate // the main canvas section of the web App with a default state // of 'WidgetCanvas' -import { useState } from "react"; + import { Box } from "@chakra-ui/react"; import CanvasHeader from "./CanvasHeader"; import WidgetCanvas from "./views/WidgetCanvas"; -// import MapCanvas from "./views/MapCanvas"; -// import AdminCanvas from "./views/AdminCanvas"; - -export default function Canvas() { - const [view, setView] = useState("widget"); +import GlobalMapCanvas from "./views/GlobalMapCanvas"; +import RegionalMapCanvas from "./views/RegionalMapCanvas"; +import VolcanoCanvas from "./views/VolcanoCanvas"; +import AdminCanvas from "./views/AdminCanvas"; +export default function Canvas({ view }) { return ( - + {view === "widget" && } - {/* {view === "map" && } */} - {/* {view === "admin" && } */} + {view === "global" && } + {view === "regional" && } + {view === "volcano" && } + {view === "admin" && } ); } diff --git a/client/src/components/layout/Canvas/views/AdminCanvas.jsx b/client/src/components/layout/Canvas/views/AdminCanvas.jsx index e69de29..5cbb749 100644 --- a/client/src/components/layout/Canvas/views/AdminCanvas.jsx +++ b/client/src/components/layout/Canvas/views/AdminCanvas.jsx @@ -0,0 +1,24 @@ +import { Box, Text } from '@chakra-ui/react'; + +export default function AdminCanvas() { + return ( + + + + Admin Canvas coming soon! + + + + ); +} \ No newline at end of file diff --git a/client/src/components/layout/Canvas/views/GlobalMapCanvas.jsx b/client/src/components/layout/Canvas/views/GlobalMapCanvas.jsx new file mode 100644 index 0000000..223f81d --- /dev/null +++ b/client/src/components/layout/Canvas/views/GlobalMapCanvas.jsx @@ -0,0 +1,24 @@ +import { Box, Text } from '@chakra-ui/react'; + +export default function GlobalMapCanvas() { + return ( + + + + Global Map Canvas coming soon! + + + + ); +} \ No newline at end of file diff --git a/client/src/components/layout/Canvas/views/MapCanvas.jsx b/client/src/components/layout/Canvas/views/MapCanvas.jsx deleted file mode 100644 index e69de29..0000000 diff --git a/client/src/components/layout/Canvas/views/RegionalMapCanvas.jsx b/client/src/components/layout/Canvas/views/RegionalMapCanvas.jsx new file mode 100644 index 0000000..7bd3ef7 --- /dev/null +++ b/client/src/components/layout/Canvas/views/RegionalMapCanvas.jsx @@ -0,0 +1,26 @@ +import { Box, Text } from '@chakra-ui/react'; + +export default function RegionalMapCanvas() { + return ( + + + + Regional Map Canvas coming soon! + + + + ); +} \ No newline at end of file diff --git a/client/src/components/layout/Canvas/views/VolcanoCanvas.jsx b/client/src/components/layout/Canvas/views/VolcanoCanvas.jsx new file mode 100644 index 0000000..ab510f5 --- /dev/null +++ b/client/src/components/layout/Canvas/views/VolcanoCanvas.jsx @@ -0,0 +1,26 @@ +import { Box, Text } from '@chakra-ui/react'; + +export default function VolcanoCanvas() { + return ( + + + + Volcano Canvas coming soon! + + + + ); +} \ No newline at end of file diff --git a/client/src/components/layout/Dashboard.jsx b/client/src/components/layout/Dashboard.jsx new file mode 100644 index 0000000..11be033 --- /dev/null +++ b/client/src/components/layout/Dashboard.jsx @@ -0,0 +1,54 @@ +import { Global, css } from "@emotion/react"; +import Header from './Header/Header.jsx'; +import Sidebar from './Sidebar/Sidebar.jsx'; +import Canvas from './Canvas/Canvas.jsx'; +import { Grid, GridItem, useRecipe } from '@chakra-ui/react'; +import { useState } from 'react'; + +export default function Dashboard() { + const recipe = useRecipe({ key: "canvas" }); + const styles = recipe(); + + // Lifted State - defaults to widget dashboard + const [view, setView] = useState("widget"); + + return ( + <> + + + +
+ + + + + + + + + + ); +} + + diff --git a/client/src/components/layout/Sidebar/Sidebar.jsx b/client/src/components/layout/Sidebar/Sidebar.jsx index b488a94..65fd73b 100644 --- a/client/src/components/layout/Sidebar/Sidebar.jsx +++ b/client/src/components/layout/Sidebar/Sidebar.jsx @@ -57,19 +57,19 @@ export const Users = createIcon({ ), }); -export default function Sidebar() { +export default function Sidebar({ onChangeView }) { const [isOpen, setIsOpen] = useState(true); + const [activeButton, setActiveButton] = useState(0) // this list of btns will come from the db (not every usr will have access to admin) const buttons = [ - {icon: PushPin, name: "Dashboard"}, - {icon: Globe, name: "Global Map"}, - {icon: MapMarker, name: "Regional Map"}, - {icon: FaVolcano, name: "Volcano"}, - {icon: Users, name: "Admin"} + {icon: PushPin, name: "Dashboard", view: "widget"}, + {icon: Globe, name: "Global Map", view: "global"}, + {icon: MapMarker, name: "Regional Map", view: "regional"}, + {icon: FaVolcano, name: "Volcano", view: "volcano"}, + {icon: Users, name: "Admin", view: "admin"} ]; - const [activeButton, setActiveButton] = useState(0) const recipe = useSlotRecipe({ key: "sidebar" }); const styles = recipe(); @@ -99,7 +99,10 @@ export default function Sidebar() { return (