From c4963960928b68b06fcd6763e36648253034e026 Mon Sep 17 00:00:00 2001 From: "Daniel S. Hansen" Date: Wed, 13 Aug 2025 15:18:03 -0700 Subject: [PATCH 1/2] Add new tabs and views under Admin sidebar tab --- client/src/components/Canvas/Canvas.jsx | 9 +- client/src/components/Canvas/views/Admin.jsx | 160 +++++++++++++++--- .../Canvas/views/AdminTabs/IVANS.jsx | 22 +++ .../Canvas/views/AdminTabs/MEDataEntry.jsx | 22 +++ .../Canvas/views/AdminTabs/NASApplication.jsx | 22 +++ .../views/AdminTabs/ProjectCollector.jsx | 22 +++ client/src/constants/viewKeys.js | 9 +- 7 files changed, 242 insertions(+), 24 deletions(-) create mode 100644 client/src/components/Canvas/views/AdminTabs/IVANS.jsx create mode 100644 client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx create mode 100644 client/src/components/Canvas/views/AdminTabs/NASApplication.jsx create mode 100644 client/src/components/Canvas/views/AdminTabs/ProjectCollector.jsx diff --git a/client/src/components/Canvas/Canvas.jsx b/client/src/components/Canvas/Canvas.jsx index 867ca1b..b6f49c7 100644 --- a/client/src/components/Canvas/Canvas.jsx +++ b/client/src/components/Canvas/Canvas.jsx @@ -4,7 +4,7 @@ import Volcano from "./views/Volcano"; import Admin from "./views/Admin"; import Account from "./views/Account" import Home from "./views/Home"; -import { DASHBOARD_VIEWS } from "@/constants/viewKeys"; +import { DASHBOARD_VIEWS, ADMIN_VIEWS } from "@/constants/viewKeys"; import { chakra } from "@chakra-ui/react"; import Personal from "./views/Personal"; import Security from "./views/Security"; @@ -13,14 +13,17 @@ export default function Canvas(props) { const { view } = props; return ( - {/* Check if view is a tab inside the Canvas Header */} + {/* Check if view is a tab inside the Home Header */} { DASHBOARD_VIEWS.includes(view) && ( )} + {/* Check if view is a tab inside the Admin Header */} + { ADMIN_VIEWS.includes(view) && ( + + )} {view === "global" && } {view === "regional" && } {view === "volcano" && } - {view === "admin" && } {view === "account" && } {view === "settings" && } {view === "personal" && } diff --git a/client/src/components/Canvas/views/Admin.jsx b/client/src/components/Canvas/views/Admin.jsx index 1c4b83a..ab3c50d 100644 --- a/client/src/components/Canvas/views/Admin.jsx +++ b/client/src/components/Canvas/views/Admin.jsx @@ -1,24 +1,144 @@ -import { Box, Text } from '@chakra-ui/react'; +import { Box, Text, Flex, Tabs, HStack } from '@chakra-ui/react'; +import { MEDataEntry } from './AdminTabs/MEDataEntry'; +import { ProjectCollector } from './AdminTabs/ProjectCollector'; +import { NASApplication } from './AdminTabs/NASApplication'; +import { IVANS } from './AdminTabs/IVANS' +import { SearchBar } from "../CanvasComponents/SearchBar"; +import { SettingsButton } from "../CanvasComponents/SettingsButton"; -export default function Admin() { +export default function Admin({ view, onChangeView, onEditWidgets, appendWidget }) { + // Prop Forwarding + // const { view, layout, setLayout, setOriginalLayout, onLayoutChange, onChangeView, onCancel, setOriginalWidgets, + // isDelete, setIsDelete, beginEditIfNeeded, isEditable, setIsEditable, widgetArray, setWidgetArray } = props; + + // const MyDashboardProps = { layout, onLayoutChange, isEditable, beginEditIfNeeded, isDelete, DeleteWidget, widgetArray, appendWidget }; + const settingsButtonProps = { onEditWidgets, appendWidget }; + return ( - - { + const nextView = e.value; + onChangeView(nextView); + }} + > + - - Admin Canvas coming soon! - - - + + + M&E Data Entry + + + Project Collector + + + NAS Application + + IVANS + + + + + + + + + + {/* CANVAS */} + + + + + + + + + + + + + ); -} \ No newline at end of file +} + + + // return ( + // /* HEADER */ + // { + // const nextView = e.value; + // onChangeView(nextView); + // }} + // > + // + // + // + // M&E Data Entry + // + // + // Project Collector + // + // + // NAS Application + // + // IVANS + // + // + // + // + // + // + // + + // {/* CANVAS */} + // + // + // + // + // + // + // + // + // + // + // + // + // + // ); + // } + \ No newline at end of file diff --git a/client/src/components/Canvas/views/AdminTabs/IVANS.jsx b/client/src/components/Canvas/views/AdminTabs/IVANS.jsx new file mode 100644 index 0000000..ede9794 --- /dev/null +++ b/client/src/components/Canvas/views/AdminTabs/IVANS.jsx @@ -0,0 +1,22 @@ +import { Box, Text } from "@chakra-ui/react"; + +export function IVANS() { + return( + + + IVANS dashboard coming soon. + + + ); +} \ No newline at end of file diff --git a/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx b/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx new file mode 100644 index 0000000..98822e6 --- /dev/null +++ b/client/src/components/Canvas/views/AdminTabs/MEDataEntry.jsx @@ -0,0 +1,22 @@ +import { Box, Text } from "@chakra-ui/react"; + +export function MEDataEntry() { + return( + + + M&E Data Entry dashboard coming soon. + + + ); +} \ No newline at end of file diff --git a/client/src/components/Canvas/views/AdminTabs/NASApplication.jsx b/client/src/components/Canvas/views/AdminTabs/NASApplication.jsx new file mode 100644 index 0000000..b66c8e3 --- /dev/null +++ b/client/src/components/Canvas/views/AdminTabs/NASApplication.jsx @@ -0,0 +1,22 @@ +import { Box, Text } from "@chakra-ui/react"; + +export function NASApplication() { + return( + + + NAS Application dashboard coming soon. + + + ); +} \ No newline at end of file diff --git a/client/src/components/Canvas/views/AdminTabs/ProjectCollector.jsx b/client/src/components/Canvas/views/AdminTabs/ProjectCollector.jsx new file mode 100644 index 0000000..b9c372d --- /dev/null +++ b/client/src/components/Canvas/views/AdminTabs/ProjectCollector.jsx @@ -0,0 +1,22 @@ +import { Box, Text } from "@chakra-ui/react"; + +export function ProjectCollector() { + return( + + + Project Collector dashboard coming soon. + + + ); +} \ No newline at end of file diff --git a/client/src/constants/viewKeys.js b/client/src/constants/viewKeys.js index 02cf9fc..efd0479 100644 --- a/client/src/constants/viewKeys.js +++ b/client/src/constants/viewKeys.js @@ -1,6 +1,9 @@ -// Main views called from Sidebar +// Main views called from Home tab -> Canvas navigation header export const DASHBOARD_VIEWS = ["mydashboard", "gas", "seismic", "remote", "daily"] +// Admin views called from Admin tab -> Canvas navigation header +export const ADMIN_VIEWS = ["admin", "medataentry", "projectcollector", "nasapplication", "ivans"] + // Sub views called from inside Home.jsx export const VIEW_LABELS = { mydashboard: "My Dashboard", @@ -12,4 +15,8 @@ export const VIEW_LABELS = { regional: "Regional Map", volcano: "Volcano", admin: "Admin", + medataentry: "M&E Data Entry", + projectcollector: "Project Collector", + nasapplication: "NAS Application", + ivans: "IVANS" }; \ No newline at end of file From d4645eb3c146161c497d6cb97f76dd6678674dfb Mon Sep 17 00:00:00 2001 From: "Daniel S. Hansen" Date: Wed, 13 Aug 2025 15:35:17 -0700 Subject: [PATCH 2/2] Add default admin tab now set to M&E Data Entry --- client/src/components/Canvas/Canvas.jsx | 5 +- client/src/components/Canvas/views/Admin.jsx | 72 +------------------- client/src/components/Sidebar/Sidebar.jsx | 2 +- 3 files changed, 6 insertions(+), 73 deletions(-) diff --git a/client/src/components/Canvas/Canvas.jsx b/client/src/components/Canvas/Canvas.jsx index b6f49c7..8594742 100644 --- a/client/src/components/Canvas/Canvas.jsx +++ b/client/src/components/Canvas/Canvas.jsx @@ -9,9 +9,12 @@ import { chakra } from "@chakra-ui/react"; import Personal from "./views/Personal"; import Security from "./views/Security"; +const ADMIN_DEFAULT = "medataentry"; + export default function Canvas(props) { const { view } = props; - return ( + + return ( {/* Check if view is a tab inside the Home Header */} { DASHBOARD_VIEWS.includes(view) && ( diff --git a/client/src/components/Canvas/views/Admin.jsx b/client/src/components/Canvas/views/Admin.jsx index ab3c50d..6b27590 100644 --- a/client/src/components/Canvas/views/Admin.jsx +++ b/client/src/components/Canvas/views/Admin.jsx @@ -7,11 +7,6 @@ import { SearchBar } from "../CanvasComponents/SearchBar"; import { SettingsButton } from "../CanvasComponents/SettingsButton"; export default function Admin({ view, onChangeView, onEditWidgets, appendWidget }) { - // Prop Forwarding - // const { view, layout, setLayout, setOriginalLayout, onLayoutChange, onChangeView, onCancel, setOriginalWidgets, - // isDelete, setIsDelete, beginEditIfNeeded, isEditable, setIsEditable, widgetArray, setWidgetArray } = props; - - // const MyDashboardProps = { layout, onLayoutChange, isEditable, beginEditIfNeeded, isDelete, DeleteWidget, widgetArray, appendWidget }; const settingsButtonProps = { onEditWidgets, appendWidget }; return ( @@ -76,69 +71,4 @@ export default function Admin({ view, onChangeView, onEditWidgets, appendWidget ); -} - - - // return ( - // /* HEADER */ - // { - // const nextView = e.value; - // onChangeView(nextView); - // }} - // > - // - // - // - // M&E Data Entry - // - // - // Project Collector - // - // - // NAS Application - // - // IVANS - // - // - // - // - // - // - // - - // {/* CANVAS */} - // - // - // - // - // - // - // - // - // - // - // - // - // - // ); - // } - \ No newline at end of file +} \ No newline at end of file diff --git a/client/src/components/Sidebar/Sidebar.jsx b/client/src/components/Sidebar/Sidebar.jsx index a403f76..a90e407 100644 --- a/client/src/components/Sidebar/Sidebar.jsx +++ b/client/src/components/Sidebar/Sidebar.jsx @@ -25,7 +25,7 @@ export default function Sidebar({ view, onChangeView, darkMode, setDarkMode }) { {icon: FaGlobeAmericas, name: "Global Map", view: "global"}, {icon: FaMapMarkerAlt, name: "Regional Map", view: "regional"}, {icon: FaVolcano, name: "Volcano", view: "volcano"}, - {icon: HiUsers, name: "Admin", view: "admin"} + {icon: HiUsers, name: "Admin", view: "medataentry"} ]; // Different Sidebar Button Options for Settings View