Merge branch 'feature/admin-view' into 'main'

Feature/admin view

See merge request vkuchenik/website-framework!68
This commit is contained in:
Dan Hansen
2025-08-13 22:43:32 +00:00
7 changed files with 176 additions and 25 deletions
+10 -4
View File
@@ -4,23 +4,29 @@ import Volcano from "./views/Volcano";
import Admin from "./views/Admin"; import Admin from "./views/Admin";
import Account from "./views/Account" import Account from "./views/Account"
import Home from "./views/Home"; 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 { chakra } from "@chakra-ui/react";
import Personal from "./views/Personal"; import Personal from "./views/Personal";
import Security from "./views/Security"; import Security from "./views/Security";
const ADMIN_DEFAULT = "medataentry";
export default function Canvas(props) { export default function Canvas(props) {
const { view } = props; const { view } = props;
return (
return (
<chakra.div width="100%" height="100%"> <chakra.div width="100%" height="100%">
{/* Check if view is a tab inside the Canvas Header */} {/* Check if view is a tab inside the Home Header */}
{ DASHBOARD_VIEWS.includes(view) && ( { DASHBOARD_VIEWS.includes(view) && (
<Home {...props}/> <Home {...props}/>
)} )}
{/* Check if view is a tab inside the Admin Header */}
{ ADMIN_VIEWS.includes(view) && (
<Admin {...props}/>
)}
{view === "global" && <GlobalMap />} {view === "global" && <GlobalMap />}
{view === "regional" && <RegionalMap />} {view === "regional" && <RegionalMap />}
{view === "volcano" && <Volcano />} {view === "volcano" && <Volcano />}
{view === "admin" && <Admin />}
{view === "account" && <Account />} {view === "account" && <Account />}
{view === "settings" && <Personal />} {view === "settings" && <Personal />}
{view === "personal" && <Personal />} {view === "personal" && <Personal />}
+70 -20
View File
@@ -1,24 +1,74 @@
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 }) {
const settingsButtonProps = { onEditWidgets, appendWidget };
return ( return (
<Box p={8} mt={4} ml="auto" mr="auto" width="600px"> /* HEADER */
<Box <Tabs.Root
bg="bg" width="100%"
shadow="md" height="100%"
borderRadius="md" lazyMount
p={8} value={ view }
width="600px" variant="line"
height="100px" // Prevent navigation away from 'My Dashboard' while in Edit mode
textAlign="center" onValueChange={(e) => {
display="flex" const nextView = e.value;
alignItems="center" onChangeView(nextView);
justifyContent="center" }}
>
<Flex
as="header"
position="sticky"
top="0"
zIndex="dropdown" // zIndex: 1100
bg="base200"
px={5}
pt={3}
pb={2}
align="center"
justify="space-between"
width="100%"
> >
<Text fontsize="2xl" fontWeight="bold" color="gray.700"> <Tabs.List>
Admin Canvas coming soon! <Tabs.Trigger value="medataentry" fontSize="lg">
</Text> M&E Data Entry
</Box> </Tabs.Trigger>
</Box> <Tabs.Trigger value="projectcollector" fontSize="lg">
Project Collector
</Tabs.Trigger>
<Tabs.Trigger value="nasapplication" fontSize="lg">
NAS Application
</Tabs.Trigger><Tabs.Trigger value="ivans" fontSize="lg">
IVANS
</Tabs.Trigger>
</Tabs.List>
<HStack width="258px" justifyContent="flex-end">
<SearchBar />
<SettingsButton {...settingsButtonProps}/>
</HStack>
</Flex>
{/* CANVAS */}
<Tabs.Content value="medataentry">
<MEDataEntry />
</Tabs.Content>
<Tabs.Content value="projectcollector">
<ProjectCollector />
</Tabs.Content>
<Tabs.Content value="nasapplication">
<NASApplication />
</Tabs.Content>
<Tabs.Content value="ivans">
<IVANS />
</Tabs.Content>
</Tabs.Root>
); );
} }
@@ -0,0 +1,22 @@
import { Box, Text } from "@chakra-ui/react";
export function IVANS() {
return(
<Box p={8} mt={4} ml="auto" mr="auto" width="600px">
<Box
bg="bg"
shadow="md"
borderRadius="md"
p={8}
width="600px"
height="100px"
textAlign="center"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text fontsize="2xl" fontWeight="bold" color="gray.700">IVANS dashboard coming soon.</Text>
</Box>
</Box>
);
}
@@ -0,0 +1,22 @@
import { Box, Text } from "@chakra-ui/react";
export function MEDataEntry() {
return(
<Box p={8} mt={4} ml="auto" mr="auto" width="600px">
<Box
bg="bg"
shadow="md"
borderRadius="md"
p={8}
width="600px"
height="100px"
textAlign="center"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text fontsize="2xl" fontWeight="bold" color="gray.700">M&E Data Entry dashboard coming soon.</Text>
</Box>
</Box>
);
}
@@ -0,0 +1,22 @@
import { Box, Text } from "@chakra-ui/react";
export function NASApplication() {
return(
<Box p={8} mt={4} ml="auto" mr="auto" width="600px">
<Box
bg="bg"
shadow="md"
borderRadius="md"
p={8}
width="600px"
height="100px"
textAlign="center"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text fontsize="2xl" fontWeight="bold" color="gray.700">NAS Application dashboard coming soon.</Text>
</Box>
</Box>
);
}
@@ -0,0 +1,22 @@
import { Box, Text } from "@chakra-ui/react";
export function ProjectCollector() {
return(
<Box p={8} mt={4} ml="auto" mr="auto" width="600px">
<Box
bg="bg"
shadow="md"
borderRadius="md"
p={8}
width="600px"
height="100px"
textAlign="center"
display="flex"
alignItems="center"
justifyContent="center"
>
<Text fontsize="2xl" fontWeight="bold" color="gray.700">Project Collector dashboard coming soon.</Text>
</Box>
</Box>
);
}
+8 -1
View File
@@ -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"] 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 // Sub views called from inside Home.jsx
export const VIEW_LABELS = { export const VIEW_LABELS = {
mydashboard: "My Dashboard", mydashboard: "My Dashboard",
@@ -12,6 +15,10 @@ export const VIEW_LABELS = {
regional: "Regional Map", regional: "Regional Map",
volcano: "Volcano", volcano: "Volcano",
admin: "Admin", admin: "Admin",
medataentry: "M&E Data Entry",
projectcollector: "Project Collector",
nasapplication: "NAS Application",
ivans: "IVANS",
settings: "Settings", settings: "Settings",
personal: "Personal Info", personal: "Personal Info",
security: "Security", security: "Security",