Add dropdown menus to M&E Data Entry view

This commit is contained in:
Daniel S. Hansen
2025-08-20 17:44:21 -07:00
parent 7e23c6a98d
commit 8630340a07
4 changed files with 81 additions and 22 deletions
-2
View File
@@ -9,8 +9,6 @@ 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;
@@ -0,0 +1,30 @@
import { Portal, Select } from '@chakra-ui/react';
export default function DropDownMenu({ collection, placeholder = "Select...", size = "sm", width = "200px" }) {
return (
<Select.Root collection={collection} size={size} width={width}>
<Select.HiddenSelect />
<Select.Control>
<Select.Trigger>
<Select.ValueText placeholder={placeholder} />
</Select.Trigger>
<Select.IndicatorGroup>
<Select.ClearTrigger />
<Select.Indicator />
</Select.IndicatorGroup>
</Select.Control>
<Portal>
<Select.Positioner>
<Select.Content>
{collection.items.map((item) => (
<Select.Item key={item.value} item={item}>
{item.label}
<Select.ItemIndicator />
</Select.Item>
))}
</Select.Content>
</Select.Positioner>
</Portal>
</Select.Root>
);
}
@@ -1,22 +1,53 @@
import { Box, Text } from "@chakra-ui/react"; import { HStack, createListCollection } from "@chakra-ui/react"
import DropDownMenu from "../../CanvasComponents/DropDownMenu"
const startYear = 1970;
const currentYear = new Date().getFullYear();
const yearItems = Array.from(
{ length: currentYear - startYear + 1 },
(_, i) => {
const year = startYear + i;
return { label: String(year), value: String(year) };
}
);
const years = createListCollection({
items: yearItems.reverse(),
});
const quarters = createListCollection({
items: [
{ label: "Q1", value: "quarter_1" },
{ label: "Q2", value: "quarter_2" },
{ label: "Q3", value: "quarter_3" },
{ label: "Q4", value: "quarter_4" },
],
})
const sections = createListCollection({
items: [
{ label: "All", value: "all" },
{ label: "Com", value: "com" },
{ label: "Eng", value: "eng" },
{ label: "Gas", value: "gas" },
{ label: "Geophys", value: "geophys" },
{ label: "GRSP", value: "grsp" },
{ label: "IT", value: "it" },
],
})
export function MEDataEntry() { export function MEDataEntry() {
return( return(
<Box p={8} mt={4} ml="auto" mr="auto" width="600px"> <HStack spacing={4} m={4}>
<Box <DropDownMenu collection={quarters} placeholder="Quarter" width="130px" />
bg="bg" <DropDownMenu collection={years} placeholder="Year" width="130px" />
shadow="md" <DropDownMenu collection={sections} placeholder="Section" width="130px" />
borderRadius="md" </HStack>
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>
); );
} }