diff --git a/src/components/sidebar/toggler.js b/src/components/sidebar/toggler.js
new file mode 100644
index 00000000..f76bee07
--- /dev/null
+++ b/src/components/sidebar/toggler.js
@@ -0,0 +1,22 @@
+import React from 'react';
+import { IconButton } from '@mui/joy';
+import {
+ Menu as HamburgerIcon,
+ Close as CloseMenuIcon,
+} from '@mui/icons-material';
+import { useLayout } from '@context';
+
+export const DrawerToggler = () => {
+ const { drawer } = useLayout();
+
+ return (
+
+ { drawer.isOpen ? : }
+
+ );
+};
diff --git a/src/components/trays/layers/list.js b/src/components/trays/layers/list.js
index 94b5c01c..c02144df 100644
--- a/src/components/trays/layers/list.js
+++ b/src/components/trays/layers/list.js
@@ -1,32 +1,153 @@
-import React from 'react';
+import React, { useState } from 'react';
import {
+ Accordion,
AccordionGroup,
+ AccordionDetails,
+ Box,
Divider,
+ IconButton,
+ ListItemContent,
+ Stack,
+ Switch,
+ Typography,
} from '@mui/joy';
+import {
+ DragIndicator as DragHandleIcon,
+ KeyboardArrowDown as ExpandIcon,
+} from '@mui/icons-material';
import { useLayers } from '@context';
-import { LayerCard } from './layer-card';
export const LayersList = () => {
- const { defaultModelLayers } = useLayers();
+ const { defaultModelLayers, toggleLayerVisibility } = useLayers();
const layers = [...defaultModelLayers];
+ // convert the product type to a readable layer name
+ const layer_names = {
+ obs: "Observations",
+ maxwvel63: "Maximum Wind Velocity",
+ maxele63: "Maximum Water Level",
+ swan_HS_max63: "Maximum Wave Height",
+ maxele_level_downscaled_epsg4326: "Hi-Res Maximum Water Level",
+ hec_ras_water_surface: "HEC/RAS Water Surface",
+ };
+
+ console.table(layers[0]);
+
+ const [expandedIds, setExpandedIds] = useState(new Set());
+
+ const handleToggleExpansion = id => () => {
+ const _expandedIds = new Set([...expandedIds]);
+ if (_expandedIds.has(id)) {
+ _expandedIds.delete(id);
+ setExpandedIds(_expandedIds);
+ return;
+ }
+ _expandedIds.add(id);
+ setExpandedIds(_expandedIds);
+ };
+
return (
{
- layers
- .sort((a, b) => a.state.order - b.state.order)
- .map((layer, index) => {
- return (
-
- );
- })
+ layers.map(layer => {
+ const isExpanded = expandedIds.has(layer.id);
+ const isVisible = layer.state.visible;
+ const layerTitle = layer_names[layer.properties.product_type] + " " +
+ layer.properties.run_date + " " +
+ layer.properties.cycle;
+
+
+ return (
+
+ {/*
+ the usual AccordionSummary component results in a button,
+ but we want some buttons _inside_ the accordion summary,
+ so we'll build a custom component here.
+ */}
+
+
+
+
+
+
+
+ {layerTitle}
+
+
+ { layer.layers }
+
+
+
+ toggleLayerVisibility(layer.id) }
+ />
+
+
+
+
+
+
+
+ { JSON.stringify(layer.properties, null, 2) }
+
+
+
+ );
+ })
}
);
};
-