diff --git a/CHANGELOG.md b/CHANGELOG.md index 0926cc3..3ac7025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,10 @@ -# v1.0.0 (Unreleased) +# v0.17.0 (2024-03-06) -* Update expected JSON structures to match new snow-today-webapp-server specifications. +* Display sensor/platform/algorithm in variable selectors. +* Default basemap is now _USGS Topographic + Imagery_ +* Update expected JSON structures to match + [new snow-today-webapp-server specifications](https://snow-today-webapp-server.readthedocs.io/interfaces/). * Support arbitrary nesting of sub-regions specified in server-side data. -* Update appearance - * New Super Region splash selector on first launch of application. - * Legends are now displayed at the bottom of the map instead of as a draggable and - resizable element within the map viewport. - * Display sensor/platform/algorithm in variable selectors. ## Under the hood diff --git a/src/components/ControlPanel/BasemapSelector.tsx b/src/components/ControlPanel/BasemapSelector.tsx index 96d6493..f2bb35f 100644 --- a/src/components/ControlPanel/BasemapSelector.tsx +++ b/src/components/ControlPanel/BasemapSelector.tsx @@ -4,7 +4,7 @@ import {useAtom} from 'jotai'; import Dropdown from 'react-bootstrap/Dropdown'; import DropdownButton from 'react-bootstrap/DropdownButton'; -import {basemapNames} from '@src/util/layer/basemaps'; +import {basemapTitles, BasemapTitle} from '@src/util/layer/basemaps'; import {selectedBasemapNameAtom} from '@src/state/client/selectedBasemapName'; const BasemapSelector: React.FC = () => { @@ -14,11 +14,12 @@ const BasemapSelector: React.FC = () => { if (!eventKey) { return; } - setSelectedBasemap(eventKey); + // TODO: How to avoid cast? + setSelectedBasemap(eventKey as BasemapTitle); }; return ( - {basemapNames.map(basemapName => ( + {basemapTitles.map(basemapName => ( ('USGS Topographic'); +export const selectedBasemapNameAtom = atom('USGS Topographic + Imagery'); selectedBasemapNameAtom.debugLabel = 'selectedBasemapNameAtom'; diff --git a/src/util/layer/basemaps.ts b/src/util/layer/basemaps.ts index e6faed5..35eaf7d 100644 --- a/src/util/layer/basemaps.ts +++ b/src/util/layer/basemaps.ts @@ -12,14 +12,30 @@ import { } from './source'; +// TODO: Don't use titles as IDs anymore (NOTE: We're not using the source ID +// because those aren't necessarily unique) +export type BasemapTitle = + | "USGS Topographic" + | "USGS Topographic + Imagery" + | "USGS Imagery" + | "USGS Shaded Relief" + | "USGS Hydro Cached" + | "ArcGIS Dark Gray" + | "ArcGIS Dark Gray Reference" // TODO: Remove? + | "ArcGIS Dark Gray Base" // TODO: Remove? + | "ArcGIS Dark Gray - Base only" + | "ArcGIS National Geographic" + | "ArcGIS World Topographic" + interface ISourceAttrs { id: string; fn: (id: any) => XYZ; } interface IBasemapAttrs { - title: string; + title: BasemapTitle; visible: boolean; sourceInfo?: ISourceAttrs; + // For when multiple sources must be combined children?: IBasemapAttrs[]; } @@ -146,7 +162,10 @@ const basemapsInfo: IBasemapAttrs[] = [ visible: false, }, ]; -export const basemapNames = basemapsInfo.map( + +// NOTE: Children are not included here. Could probably use clearer +// nomenclature. +export const basemapTitles: Array = basemapsInfo.map( (basemapInfoEntry) => basemapInfoEntry['title'] );