diff --git a/src/components/trays/layers/list.js b/src/components/trays/layers/list.js index 14df997e..fc578458 100644 --- a/src/components/trays/layers/list.js +++ b/src/components/trays/layers/list.js @@ -3,11 +3,11 @@ import { Accordion, AccordionGroup, AccordionDetails, + Avatar, Box, ButtonGroup, Divider, IconButton, - ListItemContent, Stack, Switch, Typography, @@ -17,28 +17,21 @@ import { KeyboardArrowDown as ExpandIcon, ArrowDropUp as MoveUpArrow, ArrowDropDown as MoveDownArrow, + Schedule as ClockIcon, + DragIndicator as DragHandleIcon, } from '@mui/icons-material'; import { useLayers } from '@context'; export const LayersList = () => { const { defaultModelLayers, + layerTypes, removeLayer, swapLayers, 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", - }; - const [expandedIds, setExpandedIds] = useState(new Set()); const handleToggleExpansion = id => () => { @@ -53,8 +46,8 @@ export const LayersList = () => { }; const handleClickRemove = id => () => { - removeLayer(id) - } + removeLayer(id); + }; return ( @@ -64,10 +57,7 @@ export const LayersList = () => { .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; - + const LayerIcon = layerTypes[layer.properties.product_type].icon; return ( { borderLeft: '6px solid', borderLeftColor: isVisible ? 'primary.400' : 'primary.100', '.MuiIconButton-root': { filter: 'opacity(0.1)', transition: 'filter 250ms' }, - '.MuiSwitch-root': { filter: 'opacity(0.1)', transition: 'filter 250ms' }, + '.MuiSwitch-root': { + filter: 'opacity(0.1)', + transition: 'filter 250ms', + }, '&:hover .MuiIconButton-root': { filter: 'opacity(0.5)' }, '&:hover .MuiSwitch-root': { filter: 'opacity(0.5)' }, '& .MuiIconButton-root:hover': { filter: 'opacity(1.0)' }, '& .MuiSwitch-root:hover': { filter: 'opacity(1.0)' }, }} > - - swapLayers(layer.state.order, layer.state.order - 1) } - > - swapLayers(layer.state.order, layer.state.order + 1) } - > - - - - - {layerTitle} - - - { layer.layers } - - + + + + + { console.log(layer)} + + {layerTypes[layer.properties.product_type].name} + + + + + + + + + { new Date(layer.properties.run_date).toLocaleString() } + + Cycle { layer.properties.cycle } + + + + { - + + swapLayers(layer.state.order, layer.state.order - 1) } + > + swapLayers(layer.state.order, layer.state.order + 1) } + > + + + useContext(LayersContext); +// convert the product type to a readable layer name +const layerTypes = { + obs: { + name: "Observations", + icon: ObservationIcon, + }, + maxwvel63: { + name: "Maximum Wind Velocity", + icon: WindVelocityIcon, + }, + maxele63: { + name: "Maximum Water Level", + icon: WaterLevelIcon, + }, + swan_HS_max63: { + name: "Maximum Wave Height", + icon: WaveHeightIcon, + }, + maxele_level_downscaled_epsg4326: { + name: "Hi-Res Maximum Water Level", + icon: WaterLevelIcon, + }, + hec_ras_water_surface: { + name: "HEC/RAS Water Surface", + icon: WaterSurfaceIcon, + }, +}; + export const LayersProvider = ({ children }) => { const [defaultModelLayers, setDefaultModelLayers] = useState([]); const [filteredModelLayers, setFilteredModelLayers] = useState([]); @@ -80,7 +116,8 @@ export const LayersProvider = ({ children }) => { selectedObservations, setSelectedObservations, swapLayers, - removeLayer + removeLayer, + layerTypes, }} > {children}