Frontend
The frontend is the web workspace package in apps/web. Its code lives in apps/web/src/,
and the @ alias points at that folder (apps/web/vite.config.ts). Paths below are relative
to apps/web.
App shell
Section titled “App shell”src/app/App.tsx renders ThemeProvider → AppShell. The shell:
- Mounts
useRailMode()to track thewide/default/compactbreakpoints. - Starts
loadManifestAndTables(). - Lays out
TopBar,LeftRail,MapCanvasandRightRailin a CSS grid. In narrower modes, rails move intoRailSheetoverlays. - Mounts
ProvenanceModal,AboutModaland theToasterfor short confirmations.
Feature folders
Section titled “Feature folders”| Folder | Responsibility |
|---|---|
features/topbar |
TopBar, GlobalSearch, DataStatus pill, TopBarActions (theme, provenance, bookmarks, export, settings) |
features/shell |
LeftRail, RightRail, RailSheet, useRailMode |
features/map |
MapCanvas, useMapLibre, MapControls, ScaleBar, NorthIndicator, overlays/TileOverlay, overlays/MeasureOverlay |
features/change-types |
The family-grouped layer list (ChangeTypeList, ChangeTypeRow) |
features/layers |
MapLayersPanel, LayerRow, OpacityControl, LayerOrderControl |
features/timeline |
TimeSeriesPanel, AnimationBar, PlaybackButton, usePlayback |
features/comparison |
ComparisonPanel, ComparisonMap (the baseline side of the swipe) |
features/inspector |
CurrentViewCard, LegendPanel, LocationInfoPanel, QuickStatsPanel |
features/tools |
ToolsPanel, ToolButton |
features/bookmarks |
BookmarkList (shown in the Tools panel) |
features/provenance |
ProvenanceModal |
features/search |
The locations.ts gazetteer and findNearestPlace() |
features/data |
FileImport, tileCache, geoTiffWorker (stubs; see below) |
Stores
Section titled “Stores”| Store | State |
|---|---|
datasetStore |
manifest, tables, load status and error, currentDate, range, comparison settings, and the tile-error count with the failing layers. Exposes useTimelineDates() and resolveManifestEntry(). |
layerStore |
The layer list (manifest layers plus basemap, boundary, landslide polygons and labels), visibility, opacity, order, and activeLayerId. hydrateFromManifest() builds it from the manifest. |
selectionStore |
The selected point and its samples. inspectCoordinate() calls Tauri sample_layers, or falls back to placeholders. |
uiStore |
Rail mode, open rails and panels, active tool, measure points, fly-to requests, provenance dialog. revealInspector() opens the right rail on Location Info. Panel state persists through the Tauri store. |
bookmarkStore |
Saved viewpoints, persisted through @tauri-apps/plugin-store in the desktop app and localStorage in the browser. |
toastStore |
Short confirmation messages (showToast()), dismissed after a few seconds. Rendered by shared/ui/Toaster. |
usePlaybackStore |
Playback state and speed, driven by a requestAnimationFrame loop. Lives in features/timeline. |
The Tauri plugins are imported dynamically and only used inside Tauri, so the same bundle runs in a plain browser.
Map and overlays
Section titled “Map and overlays”useMapLibrecreates the map frompublic/styles/basemap.jsonand fits the manifestboundson load. It routes clicks to the measure tool or, otherwise, to the inspector (and opens the right rail withrevealInspector()), and handles fly-to requests.MeasureOverlaydraws the measure points and the line between them on top of every other layer.ComparisonMapis the baseline side of the comparison swipe: a second, non-interactive map clipped to the left of the curtain withclip-path. It copies the main camera on everymove, applies the same terrain and layer switches, and draws the visible data layers at the baseline period withtilePathFor()andaddReferenceLayers()fromTileOverlay. It draws the Explore panel’s picture map at the baseline period withsyncTopicImage()fromTopicOverlays, the same helper the main map uses. Difference mode addsmix-blend-mode: difference.TileOverlayreconciles MapLibre with the layer store:- One raster source and layer per visible manifest layer, inserted below the boundary and label layers.
- Each source’s URL comes from the manifest entry that
resolveManifestEntry()picks for the current date. - Opacity and visibility are applied in place, without re-requesting tiles.
datasetStorehas a tile-error channel (recordTileError(),tileErrorCount,failingLayers) that the data status pill and provenance dialog already display. Nothing calls it yet:TileOverlaydoes not subscribe to MapLibre sourceerrorevents, so the warning state never appears today.
Shared code
Section titled “Shared code”shared/ui: primitives built on the design tokens:Badge,Button,Checkbox,IconButton,Panel,Popover,Progress,SegmentedControl,Slider,StatusPill,Switch,Toaster,Tooltip.shared/types:dataset.ts(LayerFamily,LAYER_FAMILIES),layer.ts,manifest.ts(types andvalidateManifest),selection.ts.shared/utils:dates.ts:resolvePeriod,periodSortKey,isForecastPeriod.colorScales.ts: gradients from ramps and classes, for swatches and legends.geo.ts: bounds and helpers.
Design tokens
Section titled “Design tokens”src/styles/tokens.css defines both themes as CSS custom properties: colours, radii, shadows,
z-indices, spring timings and more. Sand Atlas uses a sand scale with a terracotta accent
(#a9471c); Night Atlas uses #11151a with #e06d42. tokens.ts mirrors the motion values
for JavaScript. Components reference tokens such as var(--color-panel), never raw colours.
Unused surfaces
Section titled “Unused surfaces”Some groundwork is present but not wired into the main flow:
FileImport(renders nothing yet).- The
tileCache.tshelpers and the Rustread_tile_cache/write_tile_cachecommands. - The
geoTiffWorkerstub. - The
export_screenshotcommand (the UI exports JSON today). datasetStore.recordTileError()(see Map and overlays).
