app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
import React, {useEffect, useRef, useState} from "react";
|
2023-08-23 20:14:23 -06:00
|
|
|
import {
|
|
|
|
|
APIButton,
|
2023-09-07 20:13:36 -06:00
|
|
|
ErrorMessage,
|
2024-04-17 11:25:26 -06:00
|
|
|
HandPointMessage,
|
2023-08-23 20:14:23 -06:00
|
|
|
humanFileSize,
|
|
|
|
|
InfoMessage,
|
|
|
|
|
TabLinks,
|
|
|
|
|
useTitle,
|
|
|
|
|
WROLModeMessage
|
|
|
|
|
} from "./Common";
|
2026-03-29 18:58:31 -06:00
|
|
|
import {Route, Routes, useNavigate} from "react-router";
|
2022-08-06 05:22:07 +00:00
|
|
|
import {
|
A fallout simulator on the map: nuclear mode, targets, live winds aloft (#1007)
* A fallout model, checked against six Nevada tests
The local fallout of a surface burst lands where layered winds carry particles of every size
from the stabilized cloud. Cloud and particle sizes come from DNAF-1, WSEG-10 and DELFIC;
the air is the 1976 standard atmosphere. The six shots' wind profiles, measured contour
areas and plume bearings are in nts-shots.json with their sources, alongside HPAC's
predictions of the same contours.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A prototype fallout panel on the map
Right-click "Simulate Fallout Here" draws the dose rate at H+1 of one surface burst, in one
wind or in the winds aloft of one of the six Nevada tests. Nothing is saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout lands where it meets the ground
A particle stops falling at the first level where it is at or below the ground under it, not
at a plane at the height of ground zero: early on a ridge in its way, later in a valley. The
map panel reads the ground from the terrain files the user has downloaded; the Nevada tests
are checked against a small elevation grid of Mapterhorn terrain, as WROLPi publishes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout falls from the cloud's cap, skirt and stem
The cloud of a surface burst holds 77.5% of its activity in the cap, 15% in a skirt below it
and 7.5% in the stem (Philippe et al.); the stem starts as narrow as the early fireball at the
ground and widens up to the cap (DNAF-1). More of the fallout lands near ground zero: a 1 Mt
burst now draws a 1000 R/hr contour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Close-in fallout measured after three Nevada surface bursts
Jangle Sugar, Small Boy and Johnie Boy, from DNAF-1's Table 3: the area, hotline length and
azimuth of each contour from 35 to 1000 R/hr, as observed and as DNAF-1, DELFIC and WSEG-10
predicted them, with each shot's winds. The deposition grid can look closely at part of the
fallout, and measures hotlines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout rises with the cloud, and heavy particles drop out low
All of the activity starts in the early fireball and rises with the cloud, whose base and top
climb with the square root of time (SIMFIC). Each particle rises with the air less its own
settling speed, so a heavy one leaves the cloud low and early and lands near ground zero, and a
light one rides to the top. A burst above the ground puts down less, by its scaled height.
Against the close-in fallout of Jangle Sugar and Small Boy this is within 2.4x in area and 1.7x
in hotline length (it was 100x short); across the six Nevada tests, 4.2x a priori (it was 8.9x).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel offers the weapons in service today
Weapons deployed or stockpiled by each country, each with its yield quoted from the 2025-2026
Nuclear Notebook or SIPRI Yearbook, and the improvised devices FEMA plans for; no retired or
historical weapons, and none whose yield no source gives. Variable-yield weapons have one entry
for each published setting. Fission shares are not public; they are assumed as Glasstone and
Dolan plan for, and the user may change them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's dropdowns open above it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A variable-yield weapon is named once, with each setting's yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel uses the forecast winds aloft
WROLPi fetches, on request, Open-Meteo's hourly forecast of the wind at nineteen pressure levels
(about 100 m to 24 km) and the rain, for the whole degree around the burst: the place is rounded
before it is sent. The forecast is kept, so the panel can use it offline. The panel picks the
hour nearest now, gives the forecast's age, and warns of rain, which brings fallout down in places
the map does not show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A nuclear mode on the map: targets, and fallout
A radiation button under the print button turns nuclear mode on and off. In it, targets (likely
detonation sites) are shown alongside the pins, a pin added is saved as a target, and fallout can
be simulated at a target or anywhere on the map. A pin's kind is kept in map_pins.yaml; a pin
without one is a plain pin, as every pin was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets keep their weapon, and nuclear mode shows the fallout of all of them
A target keeps the weapon chosen for it (or a yield of the user's own) and its fission share in
map_pins.yaml. Nuclear mode opens on the fallout of every saved target at once, in the forecast
winds aloft fetched most recently; a burst tried out from the map can be saved as a target.
A whole-degree latitude or longitude, which a browser sends as an integer, is a valid pin, and a
pin's label and color may be left out of an update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* An improvised device is named once, with each yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout of many targets is calculated in seconds, and shown as it goes
A particle size's settling speed is read from a table by altitude rather than solved again for
every fall of every burst (a burst: 40 ms to 6 ms). The view yields to the page only every 40 ms,
through a message channel, which a browser does not hold back in a hidden tab as it does timers;
it says how far it has got, and draws the fallout on flat ground while the terrain is read.
A target in the list shows its weapon, and is given a weapon picker when asked; one picker sets
every target's weapon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout grid covers where fallout shows, not past the poles
The faintest particles of a burst are carried thousands of km in two days; with many targets the
grid stretched past 90 degrees and the map refused the image ("Invalid LngLat latitude"). The grid
now covers the spots which can reach the faintest band drawn, the image's corners stay within
Web Mercator's 85 degrees, and so does the area whose terrain is read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout across a continent is drawn where it lands
The map stretches an image evenly in Web Mercator between its corners, but the fallout grid's rows
are evenly apart in latitude; over tens of degrees (targets across a country) they part ways, and
the southern part of the image was drawn far from its targets. Each image row now takes the grid
row at its own latitude. A burst far from the first target keeps its plume as wide, east to west,
as at its own latitude.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Terrain across the antimeridian, and ground with no number, do not break the fallout
Targets in Alaska and Hawaii carry fallout west of 180 degrees, where the terrain's tile arithmetic
read past the tile's pixels; one sample with no number made every target's lowest ground NaN and
every spot fall off the map, and the grid's size Infinity. Longitudes wrap, a sample with no number
is left out (of the lowest ground, and of the elevation between samples), and a spot not on the map
is left out of the grid rather than breaking it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Every target's weapon is set in one change
Setting it target by target, eight at once, lost most of the changes: each request wrote the whole
pin list, undoing the others (QA: 47 of 156 changed). PUT /api/map/pins/targets/weapon gives
every target the weapon in one change of the config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The every-target weapon picker starts empty and always applies
It showed the first target's weapon, so choosing that weapon for all of them did nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout is carried by the winds where it is, region by region
A field of forecasts on a grid over the targets replaces the one forecast for
all of them. Each particle rises and falls through the wind at its place,
height and hour, read between the surrounding grid points, hours and heights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The winds aloft are fetched as a Job, ninety places a minute
The free forecast service allows 600 calls a minute and a place costs six, so
a field of up to 540 points is fetched in paced batches by a Job, which the
fallout panel follows, instead of inside one request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A small burst's hot fallout is kept on a grid over many, and the panel says what it shows
- Each burst's narrow close-in fallout is also put on a fine grid, so the
lethal zone of a small target is not averaged away in the cells kilometers
wide of a grid over targets far apart.
- The legend says the dose rate is as at one hour, with all the fallout down,
and what R/hr is; the error quoted is the unscaled model's.
- The TNA's yield is 150 kt: its source gives only an upper bound below 300.
- Weapons show their fission share beside their yield.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout can be watched landing, hour by hour
A timeline under the legend plays, or steps through, the 48 hours after the
bursts: each hour shows only the fallout which has landed by then, at its
dose rate then (t^-1.2 from H+1), on the same cells as the whole of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The map can show the total dose of someone outdoors, hour by hour
A "Show" picker switches from the dose rate to the total dose (R) someone
outdoors gets from when the fallout arrives: t^-1.2 added up from each spot's
arrival to the hour on the timeline, or over the first two weeks. Its bands
say what each dose does to a person.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against the Army's fallout manuals
- FM 3-3-1's worked decay and dose problems are tests.
- FM 3-11.3's cloud and Zone I nomograms, read from their images, are a
fixture; the model's cloud top is within 10% of them from 1 kt to 10 Mt,
and its Zone I within 0.7-1.7 times from 10 kt to 1 Mt, the yields of
modern weapons, which the test shots do not reach.
- The legend says real fallout may decay faster or slower than usual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against two megaton bursts in the Pacific
Redwing Zuni (3.5 Mt), whose winds were measured above its cloud: the hot
fallout goes where it went and about as far. Castle Bravo (15 Mt), whose
winds were measured only below its cloud: its fallout arrives when it did,
and its hot fallout reaching a third as far is kept in view as a known gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Winds are read from the right points at every spacing, and cover the landing
- A field's points were filed by rounding (lat + 90) / spacing but looked up
by flooring it: at 4 and 8 degrees, which do not divide 90, every point read
half its neighbor's wind. Both now count whole spacings from the equator.
- The forecast starts at midnight UTC, so two days could end before the
fallout of a burst this hour was down; three are fetched (the same call
weight), and the panel says when the last hour's winds are held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bravo's known gap is not its unmeasured upper winds
Reanalysis winds above the 1954 sounding turn the plume to within 10 degrees
of the measured one but do not lengthen its hot contours; the fixture's caveat
and the test's explanation said otherwise, and now say what was found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Rain takes fallout out of the air where it falls
A falling particle in rain loses a share of its activity every step: fast
inside the rain cloud ("rainout"), slower below it, by how hard it rains
("washout"), at Glasstone and Dolan's rates (Tables 9.74a and b), and none
above it. What is taken out comes down where the particle was. The forecast
now asks for relative humidity at 14 levels, and each hour's rain cloud is
taken as HYSPLIT takes it: from the lowest level 80% humid to the first above
it less than 60%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* With no forecast, the fallout of 30 past days of the month
- wrolpi/scripts/build_fallout_climatology.py builds, from NOAA's reanalysis,
the winds aloft of 30 days of each month (one from each year 1991-2020) over
the whole world: a gzip file a month, about 4 MB, for the release download
location.
- WROLPi fetches the months it lacks once, while there is the Internet, each
checked against a sha256 pinned in modules/map/climatology.py (none pinned
until the files are published), and serves them to the panel.
- The panel's "Past days of a month" wind runs the bursts in each day and shows
on what share of the days each place had the chosen dose rate; it is chosen
for us when there is no forecast, or it has run out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology's months are published, and their sha256 pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology worker waits for the Internet and the drive on startup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Counting the past days says flat ground at once, not the forecast's terrain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout reuses each yield's paths, about 10 times faster
On flat ground in a day's held winds, how each parcel rises with the cloud
and falls does not depend on the wind, so it is worked out once per yield
and kept for every burst and day. The rising cloud is carried by the winds
over ground zero (it drifts about 10 km); the fall still reads the winds
where the particle is. A field of one hour is read without its hours, and
the nearest point to a cell past the field is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rising cloud reads the winds over ground zero from arrays, by level
Each parcel's rise is kept as the levels of the column it passes through
(steps in the same level as one) and their seconds, so a burst reads the
column once and sums.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel shows a progress bar while it calculates
At the top of the panel, filled as far as the bursts are done, or moving
without a count until there is one. A calculation stopped by removing the
last target no longer leaves the panel busy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout runs in Web Workers, with a Cancel button
The days are spread over workers, one for each core but one (left for the
page), at most 6, and at most 2 where the browser says it has 2 GB or less.
A worker is given the next day as it finishes one, and sends back only the
cells reached. Where workers cannot be made, or fail, the days are
calculated on the page as before.
The days are counted on cells as wide as the coarsest day's grid, so the
count does not depend on which day finishes first.
Cancel, beside the progress bar, stops a calculation (and its workers) at
once; Calculate starts it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's bursts are spread over Web Workers too
The workers now take any task: a past day, or a burst. The page and the
workers build each burst's winds and terrain with the same functions
(work.js), so the fallout is the same either way; the flat pass and the
terrain pass each run on their own workers, and Cancel stops them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The bursts' grid is made in parts by the Web Workers
The grid is a sum over the bursts' spots, sharpened by the most any burst
raises a cell, so it is made in a fixed number of parts (a burst's spots
in one) on one frame, and joined on the page. The page makes the same
parts when there are no workers, so the grid is the same either way.
The forecast's warnings (bursts outside the winds, rain) are no longer
worked out again on every progress update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's hours are labeled once an hour, not on every progress update
Writing each hour's label (toLocaleString) took most of the page's time
while the workers calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Faster forecast fallout: the nearest point outside the field, progress, and what workers are sent
- Outside the forecast's field, the nearest point is looked for only
among the points which can be nearest somewhere in the grid cell (kept
for each cell); the same point as looking through them all. Longitudes
are wrapped however far round the world a particle is carried.
- The progress is shown at most ten times a second.
- The workers are sent the forecast's arrays, not the forecast as fetched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel in steps: the targets, then the fallout hour by hour or in total
Nuclear mode opens on the targets; nothing is calculated until the user goes on.
The winds and terrain wait under Options, with what is used said beside it.
The timeline runs from the first hour to two weeks, saying how much the fallout
has weakened since H+1; the view of all the fallout as if landed at H+1 is gone.
Going back and on again with nothing changed draws what was calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's winds: the forecast, past days, or one wind; no test shots' winds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is a step of its own, between the targets and the fallout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel says it is an estimate; how it compares with the test bursts goes in the help
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets are tried out until saved; the saved ones are loaded first, and saved all at once
Nuclear mode starts with no targets. Targets added are tried out, and the saved
targets join them when the user loads them. Saving replaces the saved targets
with the list, in one change, and is refused until they were loaded (or there are
none), so none are lost unseen. A target can be taken out of the list. The
burst tried out from the map's menu is gone: a target tried out does the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Nuclear targets are kept in their own config, map_nuclear.yaml, and listed apart from the pins
The pins are plain pins again. The targets have their own endpoints, and their
own table on the Pins tab, where one can be deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rest of keeping nuclear targets in map_nuclear.yaml: the config, its endpoints, and the table
The commit before this one was missing these files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is the forecast when it has the winds until the fallout is down, else one wind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The weather is a subscription: a forecast around the saved targets, downloaded every day
The Open-Meteo fetch is a recurring Download (daily) instead of a Job the panel
starts. The Manage tab has a Weather section: turning it on or off, what it
downloads, how its downloads went, and the forecast kept. Only the newest
forecast is kept, and it covers four days. The wind step asks the user to turn
the download on, and warns, there and beside the fallout, when the forecast runs
out before the fallout is down.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast service may take three minutes to answer, and a timeout says so
A batch of four days' forecasts took 43 seconds, near the old 60-second limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's targets step has an Add a target button: the next click on the map places it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:01:13 -07:00
|
|
|
deleteMapFile, deleteMapPin, deleteMapTarget, fetchMapSubscriptions, getMapFiles, getMapPins, getMapTargets,
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
mapSubscribe, mapUnsubscribe, rebuildMapSearchIndex, setMapFileVisible, updateMapPin
|
2026-03-29 18:58:31 -06:00
|
|
|
} from "../api";
|
A fallout simulator on the map: nuclear mode, targets, live winds aloft (#1007)
* A fallout model, checked against six Nevada tests
The local fallout of a surface burst lands where layered winds carry particles of every size
from the stabilized cloud. Cloud and particle sizes come from DNAF-1, WSEG-10 and DELFIC;
the air is the 1976 standard atmosphere. The six shots' wind profiles, measured contour
areas and plume bearings are in nts-shots.json with their sources, alongside HPAC's
predictions of the same contours.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A prototype fallout panel on the map
Right-click "Simulate Fallout Here" draws the dose rate at H+1 of one surface burst, in one
wind or in the winds aloft of one of the six Nevada tests. Nothing is saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout lands where it meets the ground
A particle stops falling at the first level where it is at or below the ground under it, not
at a plane at the height of ground zero: early on a ridge in its way, later in a valley. The
map panel reads the ground from the terrain files the user has downloaded; the Nevada tests
are checked against a small elevation grid of Mapterhorn terrain, as WROLPi publishes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout falls from the cloud's cap, skirt and stem
The cloud of a surface burst holds 77.5% of its activity in the cap, 15% in a skirt below it
and 7.5% in the stem (Philippe et al.); the stem starts as narrow as the early fireball at the
ground and widens up to the cap (DNAF-1). More of the fallout lands near ground zero: a 1 Mt
burst now draws a 1000 R/hr contour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Close-in fallout measured after three Nevada surface bursts
Jangle Sugar, Small Boy and Johnie Boy, from DNAF-1's Table 3: the area, hotline length and
azimuth of each contour from 35 to 1000 R/hr, as observed and as DNAF-1, DELFIC and WSEG-10
predicted them, with each shot's winds. The deposition grid can look closely at part of the
fallout, and measures hotlines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout rises with the cloud, and heavy particles drop out low
All of the activity starts in the early fireball and rises with the cloud, whose base and top
climb with the square root of time (SIMFIC). Each particle rises with the air less its own
settling speed, so a heavy one leaves the cloud low and early and lands near ground zero, and a
light one rides to the top. A burst above the ground puts down less, by its scaled height.
Against the close-in fallout of Jangle Sugar and Small Boy this is within 2.4x in area and 1.7x
in hotline length (it was 100x short); across the six Nevada tests, 4.2x a priori (it was 8.9x).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel offers the weapons in service today
Weapons deployed or stockpiled by each country, each with its yield quoted from the 2025-2026
Nuclear Notebook or SIPRI Yearbook, and the improvised devices FEMA plans for; no retired or
historical weapons, and none whose yield no source gives. Variable-yield weapons have one entry
for each published setting. Fission shares are not public; they are assumed as Glasstone and
Dolan plan for, and the user may change them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's dropdowns open above it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A variable-yield weapon is named once, with each setting's yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel uses the forecast winds aloft
WROLPi fetches, on request, Open-Meteo's hourly forecast of the wind at nineteen pressure levels
(about 100 m to 24 km) and the rain, for the whole degree around the burst: the place is rounded
before it is sent. The forecast is kept, so the panel can use it offline. The panel picks the
hour nearest now, gives the forecast's age, and warns of rain, which brings fallout down in places
the map does not show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A nuclear mode on the map: targets, and fallout
A radiation button under the print button turns nuclear mode on and off. In it, targets (likely
detonation sites) are shown alongside the pins, a pin added is saved as a target, and fallout can
be simulated at a target or anywhere on the map. A pin's kind is kept in map_pins.yaml; a pin
without one is a plain pin, as every pin was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets keep their weapon, and nuclear mode shows the fallout of all of them
A target keeps the weapon chosen for it (or a yield of the user's own) and its fission share in
map_pins.yaml. Nuclear mode opens on the fallout of every saved target at once, in the forecast
winds aloft fetched most recently; a burst tried out from the map can be saved as a target.
A whole-degree latitude or longitude, which a browser sends as an integer, is a valid pin, and a
pin's label and color may be left out of an update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* An improvised device is named once, with each yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout of many targets is calculated in seconds, and shown as it goes
A particle size's settling speed is read from a table by altitude rather than solved again for
every fall of every burst (a burst: 40 ms to 6 ms). The view yields to the page only every 40 ms,
through a message channel, which a browser does not hold back in a hidden tab as it does timers;
it says how far it has got, and draws the fallout on flat ground while the terrain is read.
A target in the list shows its weapon, and is given a weapon picker when asked; one picker sets
every target's weapon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout grid covers where fallout shows, not past the poles
The faintest particles of a burst are carried thousands of km in two days; with many targets the
grid stretched past 90 degrees and the map refused the image ("Invalid LngLat latitude"). The grid
now covers the spots which can reach the faintest band drawn, the image's corners stay within
Web Mercator's 85 degrees, and so does the area whose terrain is read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout across a continent is drawn where it lands
The map stretches an image evenly in Web Mercator between its corners, but the fallout grid's rows
are evenly apart in latitude; over tens of degrees (targets across a country) they part ways, and
the southern part of the image was drawn far from its targets. Each image row now takes the grid
row at its own latitude. A burst far from the first target keeps its plume as wide, east to west,
as at its own latitude.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Terrain across the antimeridian, and ground with no number, do not break the fallout
Targets in Alaska and Hawaii carry fallout west of 180 degrees, where the terrain's tile arithmetic
read past the tile's pixels; one sample with no number made every target's lowest ground NaN and
every spot fall off the map, and the grid's size Infinity. Longitudes wrap, a sample with no number
is left out (of the lowest ground, and of the elevation between samples), and a spot not on the map
is left out of the grid rather than breaking it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Every target's weapon is set in one change
Setting it target by target, eight at once, lost most of the changes: each request wrote the whole
pin list, undoing the others (QA: 47 of 156 changed). PUT /api/map/pins/targets/weapon gives
every target the weapon in one change of the config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The every-target weapon picker starts empty and always applies
It showed the first target's weapon, so choosing that weapon for all of them did nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout is carried by the winds where it is, region by region
A field of forecasts on a grid over the targets replaces the one forecast for
all of them. Each particle rises and falls through the wind at its place,
height and hour, read between the surrounding grid points, hours and heights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The winds aloft are fetched as a Job, ninety places a minute
The free forecast service allows 600 calls a minute and a place costs six, so
a field of up to 540 points is fetched in paced batches by a Job, which the
fallout panel follows, instead of inside one request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A small burst's hot fallout is kept on a grid over many, and the panel says what it shows
- Each burst's narrow close-in fallout is also put on a fine grid, so the
lethal zone of a small target is not averaged away in the cells kilometers
wide of a grid over targets far apart.
- The legend says the dose rate is as at one hour, with all the fallout down,
and what R/hr is; the error quoted is the unscaled model's.
- The TNA's yield is 150 kt: its source gives only an upper bound below 300.
- Weapons show their fission share beside their yield.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout can be watched landing, hour by hour
A timeline under the legend plays, or steps through, the 48 hours after the
bursts: each hour shows only the fallout which has landed by then, at its
dose rate then (t^-1.2 from H+1), on the same cells as the whole of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The map can show the total dose of someone outdoors, hour by hour
A "Show" picker switches from the dose rate to the total dose (R) someone
outdoors gets from when the fallout arrives: t^-1.2 added up from each spot's
arrival to the hour on the timeline, or over the first two weeks. Its bands
say what each dose does to a person.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against the Army's fallout manuals
- FM 3-3-1's worked decay and dose problems are tests.
- FM 3-11.3's cloud and Zone I nomograms, read from their images, are a
fixture; the model's cloud top is within 10% of them from 1 kt to 10 Mt,
and its Zone I within 0.7-1.7 times from 10 kt to 1 Mt, the yields of
modern weapons, which the test shots do not reach.
- The legend says real fallout may decay faster or slower than usual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against two megaton bursts in the Pacific
Redwing Zuni (3.5 Mt), whose winds were measured above its cloud: the hot
fallout goes where it went and about as far. Castle Bravo (15 Mt), whose
winds were measured only below its cloud: its fallout arrives when it did,
and its hot fallout reaching a third as far is kept in view as a known gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Winds are read from the right points at every spacing, and cover the landing
- A field's points were filed by rounding (lat + 90) / spacing but looked up
by flooring it: at 4 and 8 degrees, which do not divide 90, every point read
half its neighbor's wind. Both now count whole spacings from the equator.
- The forecast starts at midnight UTC, so two days could end before the
fallout of a burst this hour was down; three are fetched (the same call
weight), and the panel says when the last hour's winds are held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bravo's known gap is not its unmeasured upper winds
Reanalysis winds above the 1954 sounding turn the plume to within 10 degrees
of the measured one but do not lengthen its hot contours; the fixture's caveat
and the test's explanation said otherwise, and now say what was found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Rain takes fallout out of the air where it falls
A falling particle in rain loses a share of its activity every step: fast
inside the rain cloud ("rainout"), slower below it, by how hard it rains
("washout"), at Glasstone and Dolan's rates (Tables 9.74a and b), and none
above it. What is taken out comes down where the particle was. The forecast
now asks for relative humidity at 14 levels, and each hour's rain cloud is
taken as HYSPLIT takes it: from the lowest level 80% humid to the first above
it less than 60%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* With no forecast, the fallout of 30 past days of the month
- wrolpi/scripts/build_fallout_climatology.py builds, from NOAA's reanalysis,
the winds aloft of 30 days of each month (one from each year 1991-2020) over
the whole world: a gzip file a month, about 4 MB, for the release download
location.
- WROLPi fetches the months it lacks once, while there is the Internet, each
checked against a sha256 pinned in modules/map/climatology.py (none pinned
until the files are published), and serves them to the panel.
- The panel's "Past days of a month" wind runs the bursts in each day and shows
on what share of the days each place had the chosen dose rate; it is chosen
for us when there is no forecast, or it has run out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology's months are published, and their sha256 pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology worker waits for the Internet and the drive on startup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Counting the past days says flat ground at once, not the forecast's terrain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout reuses each yield's paths, about 10 times faster
On flat ground in a day's held winds, how each parcel rises with the cloud
and falls does not depend on the wind, so it is worked out once per yield
and kept for every burst and day. The rising cloud is carried by the winds
over ground zero (it drifts about 10 km); the fall still reads the winds
where the particle is. A field of one hour is read without its hours, and
the nearest point to a cell past the field is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rising cloud reads the winds over ground zero from arrays, by level
Each parcel's rise is kept as the levels of the column it passes through
(steps in the same level as one) and their seconds, so a burst reads the
column once and sums.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel shows a progress bar while it calculates
At the top of the panel, filled as far as the bursts are done, or moving
without a count until there is one. A calculation stopped by removing the
last target no longer leaves the panel busy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout runs in Web Workers, with a Cancel button
The days are spread over workers, one for each core but one (left for the
page), at most 6, and at most 2 where the browser says it has 2 GB or less.
A worker is given the next day as it finishes one, and sends back only the
cells reached. Where workers cannot be made, or fail, the days are
calculated on the page as before.
The days are counted on cells as wide as the coarsest day's grid, so the
count does not depend on which day finishes first.
Cancel, beside the progress bar, stops a calculation (and its workers) at
once; Calculate starts it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's bursts are spread over Web Workers too
The workers now take any task: a past day, or a burst. The page and the
workers build each burst's winds and terrain with the same functions
(work.js), so the fallout is the same either way; the flat pass and the
terrain pass each run on their own workers, and Cancel stops them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The bursts' grid is made in parts by the Web Workers
The grid is a sum over the bursts' spots, sharpened by the most any burst
raises a cell, so it is made in a fixed number of parts (a burst's spots
in one) on one frame, and joined on the page. The page makes the same
parts when there are no workers, so the grid is the same either way.
The forecast's warnings (bursts outside the winds, rain) are no longer
worked out again on every progress update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's hours are labeled once an hour, not on every progress update
Writing each hour's label (toLocaleString) took most of the page's time
while the workers calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Faster forecast fallout: the nearest point outside the field, progress, and what workers are sent
- Outside the forecast's field, the nearest point is looked for only
among the points which can be nearest somewhere in the grid cell (kept
for each cell); the same point as looking through them all. Longitudes
are wrapped however far round the world a particle is carried.
- The progress is shown at most ten times a second.
- The workers are sent the forecast's arrays, not the forecast as fetched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel in steps: the targets, then the fallout hour by hour or in total
Nuclear mode opens on the targets; nothing is calculated until the user goes on.
The winds and terrain wait under Options, with what is used said beside it.
The timeline runs from the first hour to two weeks, saying how much the fallout
has weakened since H+1; the view of all the fallout as if landed at H+1 is gone.
Going back and on again with nothing changed draws what was calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's winds: the forecast, past days, or one wind; no test shots' winds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is a step of its own, between the targets and the fallout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel says it is an estimate; how it compares with the test bursts goes in the help
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets are tried out until saved; the saved ones are loaded first, and saved all at once
Nuclear mode starts with no targets. Targets added are tried out, and the saved
targets join them when the user loads them. Saving replaces the saved targets
with the list, in one change, and is refused until they were loaded (or there are
none), so none are lost unseen. A target can be taken out of the list. The
burst tried out from the map's menu is gone: a target tried out does the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Nuclear targets are kept in their own config, map_nuclear.yaml, and listed apart from the pins
The pins are plain pins again. The targets have their own endpoints, and their
own table on the Pins tab, where one can be deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rest of keeping nuclear targets in map_nuclear.yaml: the config, its endpoints, and the table
The commit before this one was missing these files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is the forecast when it has the winds until the fallout is down, else one wind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The weather is a subscription: a forecast around the saved targets, downloaded every day
The Open-Meteo fetch is a recurring Download (daily) instead of a Job the panel
starts. The Manage tab has a Weather section: turning it on or off, what it
downloads, how its downloads went, and the forecast kept. Only the newest
forecast is kept, and it covers four days. The wind step asks the user to turn
the download on, and warns, there and beside the fallout, when the forecast runs
out before the fallout is down.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast service may take three minutes to answer, and a timeout says so
A batch of four days' forecasts took 43 seconds, near the old 60-second limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's targets step has an Add a target button: the next click on the map places it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:01:13 -07:00
|
|
|
import {targetWeapon} from "../map-shared/fallout/targets.js";
|
|
|
|
|
import {formatYieldAndFission} from "../map-shared/fallout/weapons.js";
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
import {Button, Divider, Group, Header, Icon, Modal, Table, TextInput, Toggle} from "./ui";
|
2026-02-15 14:16:35 -07:00
|
|
|
import {SortableTable} from "./SortableTable";
|
2026-04-11 20:09:30 -06:00
|
|
|
import {Media, StatusContext} from "../contexts/contexts";
|
2024-11-02 15:14:02 -06:00
|
|
|
import {MAP_VIEWER_URI} from "./Vars";
|
2026-03-29 18:58:31 -06:00
|
|
|
import MapViewer from "./MapViewer";
|
A fallout simulator on the map: nuclear mode, targets, live winds aloft (#1007)
* A fallout model, checked against six Nevada tests
The local fallout of a surface burst lands where layered winds carry particles of every size
from the stabilized cloud. Cloud and particle sizes come from DNAF-1, WSEG-10 and DELFIC;
the air is the 1976 standard atmosphere. The six shots' wind profiles, measured contour
areas and plume bearings are in nts-shots.json with their sources, alongside HPAC's
predictions of the same contours.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A prototype fallout panel on the map
Right-click "Simulate Fallout Here" draws the dose rate at H+1 of one surface burst, in one
wind or in the winds aloft of one of the six Nevada tests. Nothing is saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout lands where it meets the ground
A particle stops falling at the first level where it is at or below the ground under it, not
at a plane at the height of ground zero: early on a ridge in its way, later in a valley. The
map panel reads the ground from the terrain files the user has downloaded; the Nevada tests
are checked against a small elevation grid of Mapterhorn terrain, as WROLPi publishes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout falls from the cloud's cap, skirt and stem
The cloud of a surface burst holds 77.5% of its activity in the cap, 15% in a skirt below it
and 7.5% in the stem (Philippe et al.); the stem starts as narrow as the early fireball at the
ground and widens up to the cap (DNAF-1). More of the fallout lands near ground zero: a 1 Mt
burst now draws a 1000 R/hr contour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Close-in fallout measured after three Nevada surface bursts
Jangle Sugar, Small Boy and Johnie Boy, from DNAF-1's Table 3: the area, hotline length and
azimuth of each contour from 35 to 1000 R/hr, as observed and as DNAF-1, DELFIC and WSEG-10
predicted them, with each shot's winds. The deposition grid can look closely at part of the
fallout, and measures hotlines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout rises with the cloud, and heavy particles drop out low
All of the activity starts in the early fireball and rises with the cloud, whose base and top
climb with the square root of time (SIMFIC). Each particle rises with the air less its own
settling speed, so a heavy one leaves the cloud low and early and lands near ground zero, and a
light one rides to the top. A burst above the ground puts down less, by its scaled height.
Against the close-in fallout of Jangle Sugar and Small Boy this is within 2.4x in area and 1.7x
in hotline length (it was 100x short); across the six Nevada tests, 4.2x a priori (it was 8.9x).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel offers the weapons in service today
Weapons deployed or stockpiled by each country, each with its yield quoted from the 2025-2026
Nuclear Notebook or SIPRI Yearbook, and the improvised devices FEMA plans for; no retired or
historical weapons, and none whose yield no source gives. Variable-yield weapons have one entry
for each published setting. Fission shares are not public; they are assumed as Glasstone and
Dolan plan for, and the user may change them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's dropdowns open above it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A variable-yield weapon is named once, with each setting's yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel uses the forecast winds aloft
WROLPi fetches, on request, Open-Meteo's hourly forecast of the wind at nineteen pressure levels
(about 100 m to 24 km) and the rain, for the whole degree around the burst: the place is rounded
before it is sent. The forecast is kept, so the panel can use it offline. The panel picks the
hour nearest now, gives the forecast's age, and warns of rain, which brings fallout down in places
the map does not show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A nuclear mode on the map: targets, and fallout
A radiation button under the print button turns nuclear mode on and off. In it, targets (likely
detonation sites) are shown alongside the pins, a pin added is saved as a target, and fallout can
be simulated at a target or anywhere on the map. A pin's kind is kept in map_pins.yaml; a pin
without one is a plain pin, as every pin was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets keep their weapon, and nuclear mode shows the fallout of all of them
A target keeps the weapon chosen for it (or a yield of the user's own) and its fission share in
map_pins.yaml. Nuclear mode opens on the fallout of every saved target at once, in the forecast
winds aloft fetched most recently; a burst tried out from the map can be saved as a target.
A whole-degree latitude or longitude, which a browser sends as an integer, is a valid pin, and a
pin's label and color may be left out of an update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* An improvised device is named once, with each yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout of many targets is calculated in seconds, and shown as it goes
A particle size's settling speed is read from a table by altitude rather than solved again for
every fall of every burst (a burst: 40 ms to 6 ms). The view yields to the page only every 40 ms,
through a message channel, which a browser does not hold back in a hidden tab as it does timers;
it says how far it has got, and draws the fallout on flat ground while the terrain is read.
A target in the list shows its weapon, and is given a weapon picker when asked; one picker sets
every target's weapon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout grid covers where fallout shows, not past the poles
The faintest particles of a burst are carried thousands of km in two days; with many targets the
grid stretched past 90 degrees and the map refused the image ("Invalid LngLat latitude"). The grid
now covers the spots which can reach the faintest band drawn, the image's corners stay within
Web Mercator's 85 degrees, and so does the area whose terrain is read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout across a continent is drawn where it lands
The map stretches an image evenly in Web Mercator between its corners, but the fallout grid's rows
are evenly apart in latitude; over tens of degrees (targets across a country) they part ways, and
the southern part of the image was drawn far from its targets. Each image row now takes the grid
row at its own latitude. A burst far from the first target keeps its plume as wide, east to west,
as at its own latitude.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Terrain across the antimeridian, and ground with no number, do not break the fallout
Targets in Alaska and Hawaii carry fallout west of 180 degrees, where the terrain's tile arithmetic
read past the tile's pixels; one sample with no number made every target's lowest ground NaN and
every spot fall off the map, and the grid's size Infinity. Longitudes wrap, a sample with no number
is left out (of the lowest ground, and of the elevation between samples), and a spot not on the map
is left out of the grid rather than breaking it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Every target's weapon is set in one change
Setting it target by target, eight at once, lost most of the changes: each request wrote the whole
pin list, undoing the others (QA: 47 of 156 changed). PUT /api/map/pins/targets/weapon gives
every target the weapon in one change of the config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The every-target weapon picker starts empty and always applies
It showed the first target's weapon, so choosing that weapon for all of them did nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout is carried by the winds where it is, region by region
A field of forecasts on a grid over the targets replaces the one forecast for
all of them. Each particle rises and falls through the wind at its place,
height and hour, read between the surrounding grid points, hours and heights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The winds aloft are fetched as a Job, ninety places a minute
The free forecast service allows 600 calls a minute and a place costs six, so
a field of up to 540 points is fetched in paced batches by a Job, which the
fallout panel follows, instead of inside one request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A small burst's hot fallout is kept on a grid over many, and the panel says what it shows
- Each burst's narrow close-in fallout is also put on a fine grid, so the
lethal zone of a small target is not averaged away in the cells kilometers
wide of a grid over targets far apart.
- The legend says the dose rate is as at one hour, with all the fallout down,
and what R/hr is; the error quoted is the unscaled model's.
- The TNA's yield is 150 kt: its source gives only an upper bound below 300.
- Weapons show their fission share beside their yield.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout can be watched landing, hour by hour
A timeline under the legend plays, or steps through, the 48 hours after the
bursts: each hour shows only the fallout which has landed by then, at its
dose rate then (t^-1.2 from H+1), on the same cells as the whole of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The map can show the total dose of someone outdoors, hour by hour
A "Show" picker switches from the dose rate to the total dose (R) someone
outdoors gets from when the fallout arrives: t^-1.2 added up from each spot's
arrival to the hour on the timeline, or over the first two weeks. Its bands
say what each dose does to a person.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against the Army's fallout manuals
- FM 3-3-1's worked decay and dose problems are tests.
- FM 3-11.3's cloud and Zone I nomograms, read from their images, are a
fixture; the model's cloud top is within 10% of them from 1 kt to 10 Mt,
and its Zone I within 0.7-1.7 times from 10 kt to 1 Mt, the yields of
modern weapons, which the test shots do not reach.
- The legend says real fallout may decay faster or slower than usual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against two megaton bursts in the Pacific
Redwing Zuni (3.5 Mt), whose winds were measured above its cloud: the hot
fallout goes where it went and about as far. Castle Bravo (15 Mt), whose
winds were measured only below its cloud: its fallout arrives when it did,
and its hot fallout reaching a third as far is kept in view as a known gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Winds are read from the right points at every spacing, and cover the landing
- A field's points were filed by rounding (lat + 90) / spacing but looked up
by flooring it: at 4 and 8 degrees, which do not divide 90, every point read
half its neighbor's wind. Both now count whole spacings from the equator.
- The forecast starts at midnight UTC, so two days could end before the
fallout of a burst this hour was down; three are fetched (the same call
weight), and the panel says when the last hour's winds are held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bravo's known gap is not its unmeasured upper winds
Reanalysis winds above the 1954 sounding turn the plume to within 10 degrees
of the measured one but do not lengthen its hot contours; the fixture's caveat
and the test's explanation said otherwise, and now say what was found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Rain takes fallout out of the air where it falls
A falling particle in rain loses a share of its activity every step: fast
inside the rain cloud ("rainout"), slower below it, by how hard it rains
("washout"), at Glasstone and Dolan's rates (Tables 9.74a and b), and none
above it. What is taken out comes down where the particle was. The forecast
now asks for relative humidity at 14 levels, and each hour's rain cloud is
taken as HYSPLIT takes it: from the lowest level 80% humid to the first above
it less than 60%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* With no forecast, the fallout of 30 past days of the month
- wrolpi/scripts/build_fallout_climatology.py builds, from NOAA's reanalysis,
the winds aloft of 30 days of each month (one from each year 1991-2020) over
the whole world: a gzip file a month, about 4 MB, for the release download
location.
- WROLPi fetches the months it lacks once, while there is the Internet, each
checked against a sha256 pinned in modules/map/climatology.py (none pinned
until the files are published), and serves them to the panel.
- The panel's "Past days of a month" wind runs the bursts in each day and shows
on what share of the days each place had the chosen dose rate; it is chosen
for us when there is no forecast, or it has run out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology's months are published, and their sha256 pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology worker waits for the Internet and the drive on startup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Counting the past days says flat ground at once, not the forecast's terrain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout reuses each yield's paths, about 10 times faster
On flat ground in a day's held winds, how each parcel rises with the cloud
and falls does not depend on the wind, so it is worked out once per yield
and kept for every burst and day. The rising cloud is carried by the winds
over ground zero (it drifts about 10 km); the fall still reads the winds
where the particle is. A field of one hour is read without its hours, and
the nearest point to a cell past the field is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rising cloud reads the winds over ground zero from arrays, by level
Each parcel's rise is kept as the levels of the column it passes through
(steps in the same level as one) and their seconds, so a burst reads the
column once and sums.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel shows a progress bar while it calculates
At the top of the panel, filled as far as the bursts are done, or moving
without a count until there is one. A calculation stopped by removing the
last target no longer leaves the panel busy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout runs in Web Workers, with a Cancel button
The days are spread over workers, one for each core but one (left for the
page), at most 6, and at most 2 where the browser says it has 2 GB or less.
A worker is given the next day as it finishes one, and sends back only the
cells reached. Where workers cannot be made, or fail, the days are
calculated on the page as before.
The days are counted on cells as wide as the coarsest day's grid, so the
count does not depend on which day finishes first.
Cancel, beside the progress bar, stops a calculation (and its workers) at
once; Calculate starts it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's bursts are spread over Web Workers too
The workers now take any task: a past day, or a burst. The page and the
workers build each burst's winds and terrain with the same functions
(work.js), so the fallout is the same either way; the flat pass and the
terrain pass each run on their own workers, and Cancel stops them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The bursts' grid is made in parts by the Web Workers
The grid is a sum over the bursts' spots, sharpened by the most any burst
raises a cell, so it is made in a fixed number of parts (a burst's spots
in one) on one frame, and joined on the page. The page makes the same
parts when there are no workers, so the grid is the same either way.
The forecast's warnings (bursts outside the winds, rain) are no longer
worked out again on every progress update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's hours are labeled once an hour, not on every progress update
Writing each hour's label (toLocaleString) took most of the page's time
while the workers calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Faster forecast fallout: the nearest point outside the field, progress, and what workers are sent
- Outside the forecast's field, the nearest point is looked for only
among the points which can be nearest somewhere in the grid cell (kept
for each cell); the same point as looking through them all. Longitudes
are wrapped however far round the world a particle is carried.
- The progress is shown at most ten times a second.
- The workers are sent the forecast's arrays, not the forecast as fetched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel in steps: the targets, then the fallout hour by hour or in total
Nuclear mode opens on the targets; nothing is calculated until the user goes on.
The winds and terrain wait under Options, with what is used said beside it.
The timeline runs from the first hour to two weeks, saying how much the fallout
has weakened since H+1; the view of all the fallout as if landed at H+1 is gone.
Going back and on again with nothing changed draws what was calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's winds: the forecast, past days, or one wind; no test shots' winds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is a step of its own, between the targets and the fallout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel says it is an estimate; how it compares with the test bursts goes in the help
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets are tried out until saved; the saved ones are loaded first, and saved all at once
Nuclear mode starts with no targets. Targets added are tried out, and the saved
targets join them when the user loads them. Saving replaces the saved targets
with the list, in one change, and is refused until they were loaded (or there are
none), so none are lost unseen. A target can be taken out of the list. The
burst tried out from the map's menu is gone: a target tried out does the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Nuclear targets are kept in their own config, map_nuclear.yaml, and listed apart from the pins
The pins are plain pins again. The targets have their own endpoints, and their
own table on the Pins tab, where one can be deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rest of keeping nuclear targets in map_nuclear.yaml: the config, its endpoints, and the table
The commit before this one was missing these files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is the forecast when it has the winds until the fallout is down, else one wind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The weather is a subscription: a forecast around the saved targets, downloaded every day
The Open-Meteo fetch is a recurring Download (daily) instead of a Job the panel
starts. The Manage tab has a Weather section: turning it on or off, what it
downloads, how its downloads went, and the forecast kept. Only the newest
forecast is kept, and it covers four days. The wind step asks the user to turn
the download on, and warns, there and beside the fallout, when the forecast runs
out before the fallout is down.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast service may take three minutes to answer, and a timeout says so
A batch of four days' forecasts took 43 seconds, near the old 60-second limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's targets step has an Add a target button: the next click on the map places it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:01:13 -07:00
|
|
|
import {WeatherSection} from "./MapWeather";
|
Add ordered collections (playlists): polymorphic items + item API (#475)
* Add Playlists: ordered, mixed-type collections
A playlist (Collection kind='playlist') is a manually-curated, ordered list that
mixes item types. Squash of the playlists feature branch (24 commits).
Data model & API:
- CollectionItem is polymorphic via item_kind: 'file' (FileGroup), 'zim'
(zim_id + zim_entry), or 'url' (link to anything the WROLPi browser opens,
e.g. /map?lat=&lon=&z=). CHECK constraint enforces exactly one kind; per-kind
unique constraints; migration a7b1c2d3e4f5.
- Endpoints: create playlist; add/remove/reorder items (idempotent adds: 201 new,
200 existing); GET returns the ordered items. All mutations wrol_mode_check'd.
Config (source of truth):
- playlists.yaml (PlaylistsConfig) stores each playlist's metadata AND ordered
items (file by relative path, zim by path+entry, url inline); round-trips a
DB wipe. Supports backup import (DB_CONFIG_FILE_NAMES).
- The redundant generic CollectionsConfig (collections.yaml) is deleted:
channels/domains own their configs, authors/subjects are re-derived.
On-disk sync (sync_playlists_directory switch):
- Each playlist materializes into the configurable Playlists Directory
(playlists_destination, Settings UI input, excluded from indexing) with
position-prefixed entries: NNNN_<file> hard links (copy fallback across
filesystems) and NNNN_<title>.html stubs for zim/url items.
- Tagged playlists are namespaced like channels: <playlists>/<tag>/<name>;
a tag change moves the directory and prunes the empty old tag dir.
- Deletion safety: managed files are only removed when they are our marked
stubs or still have another hard link (st_nlink > 1) -- never a last copy.
Stray loose files at the playlists root are removed; stub URLs are
scheme-allowlisted (no javascript:/data:).
Frontend:
- /playlists list page (CollectionTable, name filter, New Playlist modal, Tag
column) between Files and Zim in the nav.
- View-only detail page (Name link) and edit page (Edit button): themed table
with model icons/colors + poster thumbnails, items link to their model page
(video/archive/doc) or preview, up/down reorder, remove, add-URL form,
single-tag selector; all editing disabled in WROL Mode.
- Reusable green "Add to Playlist" button on Video/Archive/Doc detail pages,
the FilePreview toolbar, Zim search results, and Map pins (added as a /map
URL item with a map-marker icon).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Playlist edit page parity: rename, custom directory, tag modal move suggestion
Match the ChannelEditPage/DomainEditPage UX on the playlist edit page:
Back/View buttons, an edit form (name, description, directory), and the
shared CollectionTagModal with the violet "Tag" button. The tag modal now
suggests moving the playlist to its managed tag location
(playlists/<tag>/<name>); accepting the suggestion stores directory=None so
the sync keeps auto-managing the location. Tag buttons on the Channel and
Domain edit pages are now violet to match.
Backend: update_collection learns rename (with per-kind validation and
duplicate checks) and playlist custom directories (cleanup of the abandoned
directory, config round-trip, commit-before-switch to avoid the background
sync racing pre-commit state). tag_collection's duplicated untag/tag
branches are merged, and the per-kind config-save dispatch is consolidated
into _activate_config_save().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Deduplicate Collection error handling and Tag creation
Delete the duplicate UnknownCollection in wrolpi/collections/errors.py and
re-export the canonical one from wrolpi/errors.py, which carries
status_code=NOT_FOUND (the local copy inherited 500). Replace the repeated
query/raise pattern in reorganize.py with Collection.find_by_id.
Add Tag.get_or_create_tag and use it for collection tagging; flush the new
Tag before returning so callers can read .id immediately -- previously
tagging a collection with a brand-new tag name set tag_id=None. Regression
test included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:37:34 -06:00
|
|
|
import {AddToPlaylistButton} from "./AddToPlaylist";
|
Add a Solar calculator (#778)
* Add a Solar calculator with offline NASA POWER data
Estimates a solar array's typical-year production from a location and the
panels; everything else has defaults under an optional "Fine-tune" section.
The model works from 12 monthly averages: Klein's average day per month, the
Erbs monthly diffuse fraction, Collares-Pereira & Rabl / Liu & Jordan hourly
split, HDKR transposition for fixed, single-axis and dual-axis arrays, then
PVWatts' ASHRAE incidence loss, SAPM cell temperature, DC power, system
losses and optional inverter. "Best for the year" and "Best for winter" sweep
the tilt.
Sunlight, diffuse, albedo and temperature come from NASA POWER's 2001-2020
climatology on a 1 degree grid, packed into app/public/data (3.1 MB, ~1 MB
gzipped) by scripts/build_solar_climatology.py and fetched only when the
calculator opens. Users can replace it with their own monthly values.
Every setting lives in the URL, with defaults left out, so the Share button
shares the whole configuration.
Against PVWatts v8 for a 1 kW fixed array: Phoenix +0.6%, Seattle +8.8%,
Anchorage +8.0% annually; these are recorded as tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Open the Solar calculator from the map, pins and current location
The map's right-click (or long-press) menu gains "Calculate Solar
Performance", and each saved pin a sun button; both open the calculator at
that location. A button beside Latitude fills in the browser's current
location. Locations are rounded to 4 decimals, and longitudes from a map
panned around the world are wrapped back to -180..180.
The map removed lat/lon/z from the URL when it closed, even after navigating
to another page, which stripped the calculator's location from its URL (and
from links shared with the Share button). It now only cleans up while the
URL is still a map page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add off-grid sizing to the Solar calculator
A new "Off-grid sizing" tab sizes a battery system for the darkest month
from a list of devices (watts x hours per day):
- Battery bank for a number of days without sun, for LiFePO4 or lead-acid,
at 12, 24 or 48 V. Outdoor lead-acid is enlarged for the cold; outdoor
lithium warns against charging below 0 C.
- Panels needed, from the worst month's DC production per kW at the chosen
angle, with a button to apply the count. A PWM controller's loss (battery
voltage over the panel's Vmp) raises the count.
- Charge controller current, and the string voltage on the coldest morning
against the controller's limit, since cold panels exceed their rated Voc.
The coldest morning defaults to 25 C below the coldest monthly average.
All inputs live in the URL like the rest of the calculator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bump wrolpi-help for the Solar calculator help page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Credit NASA POWER as it asks, and say how the data was changed
- The calculator gains a "Data attribution" link under the location with
NASA POWER's requested acknowledgment, the data reference (Climatology API
v2.10.0, downloaded 2026/10/04), the CC BY 4.0 license, and how WROLPi
modified the data (rounded to one byte per value, temperature averaged
into 1 degree cells, interpolated between cells), which CC BY 4.0 requires.
- The build script writes the same text to solar-climatology.LICENSE.txt
beside the data, with the API version taken from NASA's responses and the
date the tiles were downloaded. A test keeps the page and file in step.
- Bumps wrolpi-help for the updated attribution in the help page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: fix PWM sizing, Voc sign, unit switching and loading on review
- PWM usable power now uses the string's voltage (Vmp x panels in series),
delivers nothing when the charging voltage is at or above the string's Voc,
and falls off between Vmp and Voc. The "too little voltage" warning covers
PWM as well as MPPT. Previously two panels in series counted double, and a
panel that could not charge a 48 V bank counted as fully usable.
- A Voc temperature coefficient entered without its minus sign is treated as
negative, in the math, the URL and the input, so the cold-morning check
cannot be made too generous.
- Switching Fahrenheit on or off converts the entered temperatures instead
of reinterpreting them.
- While the sunlight data downloads, the off-grid tab shows a loader rather
than asking for a location, and holds the cold-morning verdict until the
site's temperatures are known or one has been entered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: move the data attribution to the bottom of the page
The full NASA POWER acknowledgment, license and changes now sit in a small
"Data attribution" section at the end of the calculator, always visible,
instead of behind a link under the location. The source line under the
location points to it. Bumps wrolpi-help to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: drop the data source line under the location
The attribution at the bottom of the page is enough. The line under the
location now only appears to report the data's state: loading, failed to
load, or replaced by the user's own values. Bumps wrolpi-help for the
refreshed screenshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:32:26 -06:00
|
|
|
import {solarCalculatorPath} from "./calculators/solar";
|
2026-03-29 18:58:31 -06:00
|
|
|
import maplibregl from "maplibre-gl";
|
|
|
|
|
import {Protocol} from "pmtiles";
|
|
|
|
|
import layers from "protomaps-themes-base";
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
import {planMapFiles, pmtilesUrl} from "./mapOverlays";
|
Map tiles for ATAK and iTAK (#1024)
* Map tiles for ATAK and iTAK
A new service, wrolpi-tiles (tiles/), draws WROLPi's map as 256 px raster
tiles from the map's PMTiles with MapLibre Native (mapli), so ATAK and iTAK
can use the map as a map source, and ATAK can download an area of it.
- Tiles are drawn in blocks of 4x4 (ATAK asks for tiles in quadtree order),
each block once however many requests wait on it, in render processes of
their own. Phones are served in turn.
- A tile is always a 200: blank where there is no map, or when it was not
drawn before ATAK's 5 second timeout. Five failed tiles in a row stop an
ATAK download, and a 401/403 stops the map source.
- Drawn tiles are kept in /var/cache/wrolpi-tiles, with a size cap and a
free-space floor; JPEG, about a seventh of a PNG.
- The basemap is the web map's (protomaps-themes-base, light), kept equal
to it by a Jest test. Unreadable map files and missing map fonts are
left out rather than failing every tile.
- Caddy serves it at /tiles/ over HTTPS and on port 8088 over plain HTTP
(a phone must trust WROLPi's CA for HTTPS). /tiles/wrolpi.xml is the
MOBAC map source to import.
- A separate service with lower CPU priority and a memory cap, so a phone
downloading an area cannot slow the API. Docker runs it from the api
image.
- The map page has an ATAK tab: the map source links, how to use them, and
what the tile service is doing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: bound PMTiles decompression before it happens
A few bytes of a downloaded map file could decompress to far more than the
cap, which was applied only afterwards. Decompress at most MAX_METADATA_SIZE,
as modules.map.pmtiles does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: never send a blank for a late tile; start render processes with the service
QA on a Pi 4 found the first tile after a start sent blank: starting the
render processes and the first draw took 4.5 s, past the deadline. A
downloader (ATAK's, iTAK's) keeps whatever a tile request returns, so a
blank sent for a late or failed tile is a hole in its offline map for
good. Such a tile is now a 503 (ATAK tries each tile twice; only 401 and
403 stop a map source), and the render processes start with the service.
Also:
- OOMScoreAdjust=500: Raspberry Pi OS disables the memory cgroup, so
MemoryMax does nothing there; the tile service is killed before the API.
- sanic-ext's auto extensions are off in the tile service.
- The map's ATAK tab is before Manage: Manage is the last tab.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: put backgroundColor back in the map source; iTAK requires it
iTAK refuses a MOBAC map source without <backgroundColor> ("The data couldn't
be read because it is missing"). ATAK ignores it. It is the map's own
background color.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: leave out the map files hidden on the Manage tab, as the web map does
maps.yaml's ignored_files names the map files the user hid; the web map
does not draw them, and the tiles drew them anyway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: bound the render processes' memory and the tiles-per-second times
QA on a Pi 4, a phone taking 123,000 tiles offline: each render process
grew from about 270 MB to 370 MB (MapLibre keeps what it has read and
drawn) and did not shrink when idle. A render process is now replaced
after 2,000 blocks. The serve times behind tiles-per-second were only
forgotten when the status was asked for; they are forgotten as tiles are
served.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Map ATAK tab: iTAK takes an area offline too
An iPhone downloaded 123,000 tiles with iTAK and showed them offline with
none missing; the tab said only ATAK could.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Map ATAK tab: a button to clear the tiles the tile service keeps
POST /tiles/cache/clear on the tile service (which keeps the cache's size)
removes the kept tiles; they are drawn again when next asked for. The
button asks first, and says that maps already downloaded to phones are not
changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: measure the cache as the disk does; clear it at once, delete in the background
QA on a Pi 4 after a 123,000-tile download: the cache counted 375 MB of tile
bytes while its files took 660 MB of the SD card (each small file takes a
whole 4 KiB block), so the 1 GB cap allowed about 1.7 GB. The cache is now
measured in disk blocks.
Clearing deleted 128,000 files in the request: about 40 seconds, with the
Pi's load warning on. A clear (or a new style) now renames the tiles out of
the way at once and deletes them in a lowest-priority thread, pausing every
500 files; a deletion cut short is finished at the next start. A tile drawn
again no longer counts twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Help: ATAK and iTAK
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: a page on port 8088 saying what it is
A person who finds port 8088 got a 404. / (and /tiles/) is now a short page:
WROLPi's map tile service for ATAK and iTAK, the map source to open on a
phone, and links to the WROLPi app and the map's ATAK tab, made from the
address the page was reached by (Docker publishes the app on
TILES_HTTPS_PORT). Port 8088 serves WROLPi's icon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: review fixes
- Caddy: a tile request is never redirected to the fallback page when the
tile service is down or restarting (handle_errors on 443). ATAK keeps
whatever a tile request ends with, so the page was stored as the tile;
it is now a 503 with Retry-After, which ATAK tries again.
- The cache's oldest tiles are found and deleted in a lowest-priority
thread, pausing as it goes, not in the tile request which filled it.
- ATAK tab: only the newest status request writes the status, so a slow
answer can not undo a newer one (or a clear). It says when the page was
opened on localhost and the addresses work only there, and names each
map source as the app lists it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 11:21:27 -07:00
|
|
|
import {MapAtak} from "./MapAtak";
|
2022-11-04 09:03:13 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
// Ensure PMTiles protocol is registered (may already be registered by MapViewer).
|
|
|
|
|
try { maplibregl.addProtocol("pmtiles", new Protocol().tile); } catch (e) { /* already registered */ }
|
2022-11-04 09:03:13 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const MAP_OVERVIEW_URL = "/blobs/map-overview.pmtiles";
|
2022-11-04 09:03:13 -06:00
|
|
|
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
// How the map draws a file (the API's `kind`).
|
|
|
|
|
const MAP_FILE_KINDS = {
|
|
|
|
|
basemap: 'Basemap',
|
|
|
|
|
overlay: 'Overlay',
|
|
|
|
|
terrain: 'Terrain',
|
|
|
|
|
unknown: 'Unreadable',
|
|
|
|
|
};
|
2022-11-04 09:03:13 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
// Resolve the best available base map source for preview maps.
|
|
|
|
|
// Checks for a user's planet file first, falls back to the overview blob.
|
|
|
|
|
async function getPreviewMapSource() {
|
|
|
|
|
try {
|
|
|
|
|
const data = await getMapFiles();
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
const {planet} = planMapFiles(data?.files);
|
|
|
|
|
if (planet) {
|
|
|
|
|
return {type: 'vector', url: pmtilesUrl(planet.path)};
|
2026-03-29 18:58:31 -06:00
|
|
|
}
|
|
|
|
|
} catch (e) { /* ignore */ }
|
|
|
|
|
return {type: 'vector', url: `pmtiles://${MAP_OVERVIEW_URL}`};
|
|
|
|
|
}
|
2022-11-04 09:03:13 -06:00
|
|
|
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
/*
|
|
|
|
|
* The container is a piece of state set by a callback ref, not a `useRef` read in the effect.
|
|
|
|
|
*
|
|
|
|
|
* A modal body is not in the DOM on the render that opens the modal -- Mantine mounts it a
|
|
|
|
|
* commit later -- so an effect gated on `open` that reads `ref.current` finds null, returns,
|
|
|
|
|
* and never runs again, because nothing it depends on changes after that. Both previews were
|
|
|
|
|
* silently blank for exactly this reason. A callback ref re-runs the effect when the node
|
|
|
|
|
* arrives, whenever that is, so this does not depend on any modal's mounting schedule.
|
|
|
|
|
*/
|
2026-03-29 18:58:31 -06:00
|
|
|
function RegionPreviewModal({bbox, name, open, onClose}) {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
const [mapContainer, setMapContainer] = useState(null);
|
2026-03-29 18:58:31 -06:00
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
if (!open || !mapContainer || !bbox) return;
|
2026-03-29 18:58:31 -06:00
|
|
|
|
|
|
|
|
const [minLon, minLat, maxLon, maxLat] = bbox.split(',').map(Number);
|
|
|
|
|
const centerLon = (minLon + maxLon) / 2;
|
|
|
|
|
const centerLat = (minLat + maxLat) / 2;
|
|
|
|
|
|
|
|
|
|
let map;
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
// The source lookup is async, so the modal can close before it resolves. Without this
|
|
|
|
|
// the cleanup below runs while `map` is still undefined and the map built afterwards
|
|
|
|
|
// is never removed -- a leaked WebGL context on every quick open-and-close.
|
|
|
|
|
let cancelled = false;
|
2026-03-29 18:58:31 -06:00
|
|
|
getPreviewMapSource().then(source => {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
if (cancelled) return;
|
2026-03-29 18:58:31 -06:00
|
|
|
map = new maplibregl.Map({
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
container: mapContainer,
|
2026-03-29 18:58:31 -06:00
|
|
|
style: {
|
|
|
|
|
version: 8,
|
|
|
|
|
sources: {'basemap': source},
|
|
|
|
|
layers: layers('basemap', 'light'),
|
|
|
|
|
glyphs: '/map-assets/fonts/{fontstack}/{range}.pbf',
|
|
|
|
|
sprite: `${window.location.origin}/map-assets/sprites/light`,
|
|
|
|
|
},
|
|
|
|
|
center: [centerLon, centerLat],
|
|
|
|
|
zoom: 1,
|
|
|
|
|
attributionControl: false,
|
|
|
|
|
});
|
2022-11-04 09:03:13 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
map.on('load', () => {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
// The flag again: cleanup can land between construction and `load`, and this
|
|
|
|
|
// body draws into a map `remove()` has already torn down.
|
|
|
|
|
if (cancelled) return;
|
2026-03-29 18:58:31 -06:00
|
|
|
map.addSource('bbox', {
|
|
|
|
|
type: 'geojson',
|
|
|
|
|
data: {
|
|
|
|
|
type: 'Feature',
|
|
|
|
|
geometry: {
|
|
|
|
|
type: 'Polygon',
|
|
|
|
|
coordinates: [[
|
|
|
|
|
[minLon, minLat],
|
|
|
|
|
[maxLon, minLat],
|
|
|
|
|
[maxLon, maxLat],
|
|
|
|
|
[minLon, maxLat],
|
|
|
|
|
[minLon, minLat],
|
|
|
|
|
]],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
map.addLayer({
|
|
|
|
|
id: 'bbox-fill',
|
|
|
|
|
type: 'fill',
|
|
|
|
|
source: 'bbox',
|
|
|
|
|
paint: {'fill-color': '#6435c9', 'fill-opacity': 0.2},
|
|
|
|
|
});
|
|
|
|
|
map.addLayer({
|
|
|
|
|
id: 'bbox-outline',
|
|
|
|
|
type: 'line',
|
|
|
|
|
source: 'bbox',
|
|
|
|
|
paint: {'line-color': '#6435c9', 'line-width': 2},
|
|
|
|
|
});
|
|
|
|
|
map.fitBounds([[minLon, minLat], [maxLon, maxLat]], {padding: 40});
|
|
|
|
|
});
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
}).catch(e => console.error('Could not build the region preview map:', e));
|
2022-11-05 14:38:51 -06:00
|
|
|
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
return () => {
|
|
|
|
|
cancelled = true;
|
|
|
|
|
if (map) map.remove();
|
|
|
|
|
};
|
|
|
|
|
}, [open, bbox, mapContainer]);
|
2022-11-05 14:38:51 -06:00
|
|
|
|
ui: only the top modal answers Escape, and the audited widths
Two things, both reported from the running app.
Nested modals could not exist. Mantine binds a window-level keydown listener
per open modal, gated only on whether that modal is open -- nothing checks which
one the user is looking at:
useWindowEvent('keydown', (event) => {
if (event.key === 'Escape' && closeOnEscape && ... && opened) onClose();
}, {capture: true});
Two open modals meant two listeners, so one Escape closed both. Reproduced on
the dashboard: the download modal plus the search modal over it, one press, both
gone, back to the page. Both also sat at z-index 200, so which one drew on top
was DOM order rather than which the user opened.
Mantine's own answer is Modal.Stack with a stackId, which is the only thing that
gates closeOnEscape. Not used, for two reasons: every call site would have to
be rewritten to hoist its modal into a stack, and it sets `__hidden` on
everything below the top -- the parent disappears while the child is open. The
parent should be dimmed and still there, as it was before the migration.
So the wrapper keeps the register itself: a module-level list of open modals,
most recent on top, from which each modal takes closeOnEscape, trapFocus and a
z-index two above its parent. Module-level rather than React context because
the two modals in the bug are not nested in the JSX at all -- the search modal
is rendered by KeyboardShortcutsProvider near the app root and the download
modal by the dashboard. They are siblings that happen to be open together, and
no context relates them. The increment is small on purpose: Mantine puts
popovers at 300, and a stack that climbed past it would paint over the select
dropdowns inside its own forms.
Widths: Roland audited the modal list and chose sizes against Mantine's scale.
Sixteen get wider -- twelve to `large` (620), four to `fullscreen` -- and eleven
keep the width they had, with the size now written down so the decision is in
the source rather than in a default. Flasher was passing Mantine's raw `sm`,
which worked but bypassed the naming the audit used; it says `tiny` now.
The size table itself is guarded, because it is the single thing that halved
every modal during the migration and a quiet edit to it moves seventy at once.
Semantic's widths, measured on the pre-migration build still running on the QA
Pi: mini 360, tiny 540, small 720, large 1080, no-size 900. Mantine's, read out
of its stylesheet: 320/380/440/620/780. A `small` modal went 720 -> 440 and one
with no size went 900 -> 440. Three cases now hold the scale, the mapping, and
the rule that no call site may name a size the table does not know -- an unknown
name is passed to Mantine, ignored, and silently rendered at the default.
Tested in a real browser: none of it is visible to jsdom -- the listener is on
window with capture, the stacking is z-index, and "still visible behind" is
geometry. Note that `should('be.visible')` is the wrong assertion for the
parent: it is an occlusion check, so a child drawn correctly over its parent
trips it. The test uses a wide viewport and asserts the parent is rendered and
shows to both sides of the child. Planting the pre-fix behaviour reddens three.
1124 jest / 62 suites, 8 in modal-stack.cy.js, clean npm run build. The 12
failures in Tags/Channels/Download/Inventory.cy.js are the known pre-existing
Semantic-era selector failures, unchanged.
2026-08-02 15:26:15 -06:00
|
|
|
return <Modal open={open} onClose={onClose} size='fullscreen' closeIcon title={name}>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
{/* No `.media` here: the bbox highlight is drawn as a map layer on the canvas itself
|
|
|
|
|
(see the `bbox` source/layers above), so the automatic `canvas` element-type filter
|
|
|
|
|
already covers it. There is no separate DOM overlay to wrap. */}
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
<div ref={setMapContainer} style={{width: '100%', height: '50vh'}}/>
|
2026-03-29 18:58:31 -06:00
|
|
|
</Modal>;
|
2022-11-04 09:03:13 -06:00
|
|
|
}
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
// Random-ish distinct colors for region boxes. These are map-data paint colors (drawn
|
|
|
|
|
// on the WebGL canvas itself), not UI chrome, so they are not theme tokens.
|
2026-03-29 18:58:31 -06:00
|
|
|
const REGION_COLORS = [
|
|
|
|
|
'#6435c9', '#e03997', '#00b5ad', '#2185d0', '#f2711c', '#b5cc18',
|
|
|
|
|
'#a333c8', '#21ba45', '#db2828', '#fbbd08', '#a5673f', '#767676',
|
|
|
|
|
];
|
|
|
|
|
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
// See RegionPreviewModal for why the container is state set by a callback ref.
|
2026-03-29 18:58:31 -06:00
|
|
|
function AllRegionsPreviewModal({catalog, open, onClose}) {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
const [mapContainer, setMapContainer] = useState(null);
|
2026-03-29 18:58:31 -06:00
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
if (!open || !mapContainer) return;
|
2026-03-29 18:58:31 -06:00
|
|
|
|
|
|
|
|
let map;
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
let cancelled = false;
|
2026-03-29 18:58:31 -06:00
|
|
|
getPreviewMapSource().then(source => {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
if (cancelled) return;
|
2026-03-29 18:58:31 -06:00
|
|
|
map = new maplibregl.Map({
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
container: mapContainer,
|
2026-03-29 18:58:31 -06:00
|
|
|
style: {
|
|
|
|
|
version: 8,
|
|
|
|
|
sources: {'basemap': source},
|
|
|
|
|
layers: layers('basemap', 'light'),
|
|
|
|
|
glyphs: '/map-assets/fonts/{fontstack}/{range}.pbf',
|
|
|
|
|
sprite: `${window.location.origin}/map-assets/sprites/light`,
|
|
|
|
|
},
|
|
|
|
|
center: [0, 20],
|
|
|
|
|
zoom: 1,
|
|
|
|
|
attributionControl: false,
|
|
|
|
|
});
|
2022-11-04 09:03:13 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
map.on('load', () => {
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
// See RegionPreviewModal: cleanup can land between construction and `load`.
|
|
|
|
|
if (cancelled) return;
|
2026-03-29 18:58:31 -06:00
|
|
|
const regions = catalog.filter(r => r.bbox);
|
|
|
|
|
regions.forEach((region, i) => {
|
|
|
|
|
const [minLon, minLat, maxLon, maxLat] = region.bbox.split(',').map(Number);
|
|
|
|
|
const color = REGION_COLORS[i % REGION_COLORS.length];
|
|
|
|
|
const id = `region-${i}`;
|
|
|
|
|
|
|
|
|
|
map.addSource(id, {
|
|
|
|
|
type: 'geojson',
|
|
|
|
|
data: {
|
|
|
|
|
type: 'Feature',
|
|
|
|
|
geometry: {
|
|
|
|
|
type: 'Polygon',
|
|
|
|
|
coordinates: [[
|
|
|
|
|
[minLon, minLat], [maxLon, minLat],
|
|
|
|
|
[maxLon, maxLat], [minLon, maxLat],
|
|
|
|
|
[minLon, minLat],
|
|
|
|
|
]],
|
|
|
|
|
},
|
|
|
|
|
properties: {name: region.name},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
map.addLayer({
|
|
|
|
|
id: `${id}-fill`, type: 'fill', source: id,
|
|
|
|
|
paint: {'fill-color': color, 'fill-opacity': 0.15},
|
|
|
|
|
});
|
|
|
|
|
map.addLayer({
|
|
|
|
|
id: `${id}-outline`, type: 'line', source: id,
|
|
|
|
|
paint: {'line-color': color, 'line-width': 1.5},
|
|
|
|
|
});
|
|
|
|
|
map.addLayer({
|
|
|
|
|
id: `${id}-label`, type: 'symbol', source: id,
|
|
|
|
|
layout: {
|
|
|
|
|
'text-field': ['get', 'name'],
|
|
|
|
|
'text-size': 11,
|
|
|
|
|
'text-allow-overlap': true,
|
|
|
|
|
},
|
|
|
|
|
paint: {
|
|
|
|
|
'text-color': color,
|
|
|
|
|
'text-halo-color': 'white',
|
|
|
|
|
'text-halo-width': 1,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
}).catch(e => console.error('Could not build the all-regions preview map:', e));
|
2022-11-04 09:03:13 -06:00
|
|
|
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
return () => {
|
|
|
|
|
cancelled = true;
|
|
|
|
|
if (map) map.remove();
|
|
|
|
|
};
|
|
|
|
|
}, [open, catalog, mapContainer]);
|
2022-11-04 09:03:13 -06:00
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
return <Modal open={open} onClose={onClose} size='fullscreen' closeIcon title='All Map Regions'>
|
|
|
|
|
{/* No `.media` here either — same reasoning as RegionPreviewModal. */}
|
Map previews that never drew, and a Docker map with no world under it (#658)
* ui: a preview map that waited for a container it could never see
Both map preview modals -- the per-region eye button and "View All Regions"
-- opened to an empty box. Each renders a div into a Modal and hands it to
MapLibre from an effect gated on `open`, reading the node out of a `useRef`:
if (!open || !mapContainer.current) return;
Mantine's Modal mounts its body one commit after `opened` flips true, so on
the render that opens the modal the ref is still null. The effect returns,
nothing it depends on changes again, and it never runs a second time. No
console error, no rejected promise, no canvas -- just an empty div.
Semantic UI's Portal mounted the body in the same commit that opened it, so
the ref was attached by the time effects ran. The effect bodies are
byte-identical across that migration; the modal library is the only variable,
confirmed against a device still running the older build where both previews
render.
A callback ref instead, so the effect re-runs when the node arrives and this
stops depending on any modal's mounting schedule. The async source lookup
also gets a cancelled flag: it could resolve after the cleanup ran, building
a map nothing would ever remove and leaking a WebGL context per open.
The tests drive the real page and assert a map was built against a node that
is in the document -- the outcome, rather than the mechanism that quietly
changed underneath it. Seven of the eight fail on the code before this.
* build: docker had no world underneath its map regions
Caddy serves /blobs/map-overview.pmtiles out of /opt/wrolpi-blobs, and that
blob is the world at zoom 0-6 -- what a regional extract sits on top of.
Without it a user who subscribes to a few regions gets those regions floating
on an empty background everywhere their data does not reach. Only a full
planet file, at 134GB, makes it unnecessary.
Raspberry Pi and Debian installs get the blob from pi-gen, the live-build
config, and upgrade.sh. Docker got nothing: the compose file bind-mounted a
git-ignored host directory over /opt/wrolpi-blobs, and a bind mount replaces
the image's directory rather than merging with it, so the path existed and was
empty on every Docker WROLPi. Verified against a running deployment, where
that URL returned 404 while the same URL on hardware returned 206.
So the web image fetches the blob at build time, as the other three builders
do, and the mount that would hide it is gone. `curl -f` so an HTTP error
fails the layer -- an image that builds without the blob is this same bug,
except silent at build time too.
The tests read the deployment files rather than a built container: building
to check costs a CDN download and several minutes, and both things that broke
-- nothing fetches it, a mount hides it -- are visible in the source.
* ui: cancel the load handler too, and make the cancel test falsifiable
Review follow-ups on the preview modals.
The `cancelled` flag was checked before constructing the map but not inside
the `load` handler it installs, so cleanup landing between the two left that
body drawing into a map `remove()` had already torn down. Guarded, mirroring
the `destroyed` pattern in MapViewer.js. The source promise also gets a
`.catch`: the helper cannot reject today, but nothing says it never will, and
an unhandled rejection here would be as quiet as the bug this all started as.
Two test corrections, both cases of an assertion claiming more than it read:
The region-drawing test spied on `addSource` AFTER construction and then
re-fired `load` by hand, so its count came entirely from that manual call and
said nothing about the production path. FakeMap now records the sources it is
given, and the assertion reads what the component's own `load` drew -- each
region once, in order, and none for the entry with no bbox.
The new cancel test passed with the guard deleted, which is worse than not
having it: Mantine had not mounted the modal body when it closed, so the
effect had never run and there was nothing to cancel. It now waits for the
effect to reach the source lookup before closing, and ships beside a control
that releases the same held promise WITHOUT closing and requires a map. The
control is what makes the zero meaningful; verified that removing the guard
fails the cancel test while the control still passes.
2026-08-11 20:37:14 -06:00
|
|
|
<div ref={setMapContainer} style={{width: '100%', height: '75vh'}}/>
|
2026-03-29 18:58:31 -06:00
|
|
|
</Modal>;
|
2022-11-04 09:03:13 -06:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
function MapCatalogRow({item, subscribedRegions, fetchData}) {
|
|
|
|
|
const {name, region, size_estimate, bbox} = item;
|
|
|
|
|
const isSubscribed = subscribedRegions.has(region);
|
|
|
|
|
const [previewOpen, setPreviewOpen] = useState(false);
|
2024-04-17 11:25:26 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const handleButton = async () => {
|
|
|
|
|
if (isSubscribed) {
|
|
|
|
|
await mapUnsubscribe(region);
|
|
|
|
|
} else {
|
|
|
|
|
await mapSubscribe(name, region);
|
2022-03-08 13:26:03 -07:00
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
if (fetchData) {
|
|
|
|
|
await fetchData();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
return <Table.Row>
|
|
|
|
|
<Table.Cell>{name}</Table.Cell>
|
|
|
|
|
<Table.Cell>{humanFileSize(size_estimate)}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
ui: the map pin buttons were three sizes for three reasons
Reported as "all different sizes", and the pin row's three actions measured
46x30, 30x30 and 54x36. Three causes.
APIButton dropped `size`. `useAPIButton` declared `size = 'medium'` as a
parameter and then never put it into the props it hands to Button, so every
APIButton in the app rendered at Mantine's default regardless of what its call
site asked for -- seventeen call sites pass one, from `xs` on the map pins to
`big` and `huge` on Settings. The delete pin was 36px tall beside two 30px
siblings because of it. Passing the parameter default through would have fixed
the bug by breaking everything else -- every APIButton naming no size would have
grown from `sm` to `md` -- so the default is undefined now and Button's own
default stands. Eight buttons on three other pages do grow as a result, which is
their call sites finally being honoured: VideoPlayer's `large`, one of Channels'
`big`, and Settings' two `big` and two `huge`.
An icon-only Button was not square. A Button is as wide as its content plus its
horizontal padding; an ActionIcon is square by construction; and the pin row
mixes the two, because AddToPlaylistButton renders an IconButton when it has no
label. Their heights already agreed -- ActionIcon's scale was remapped onto
Button's some commits ago -- and this is the other axis of the same alignment,
keyed off Mantine's own `--button-height` so the two stay in step through every
size.
They were also misaligned and touching, which is a third thing: bare inline-block
siblings align on text BASELINES, and a Button's baseline is not an ActionIcon's,
so the middle control sat 4.3px above the other two. A Group, as every other row
of buttons in the app uses.
Written test-first at Roland's request. Seven cypress cases went red on the
sizes -- widths 46 against 30, 54 against 36, 62 against 42, 70 against 50, and
"xs is shorter than lg: expected 36 to be below 32" for the dropped size -- with
both inverses green throughout: a labelled button stays as wide as its label, and
an APIButton naming no size keeps the height it had.
The alignment claim is measured in ui-layout.cy.js, including the premise that
bare siblings really are misaligned, since three controls of identical height not
lining up is not believable otherwise. The call sites are held by a source
guard, because MapPins fetches from the API and builds its rows through
SortableTable.
That guard earned itself twice over. Written for the pin rows, it found the
map-files subscribe cell putting a preview button beside a subscribe button with
the same defect. Then a first attempt at a general "any cell with two controls"
rule had to be abandoned: a cell whose buttons are the arms of a ternary renders
only one and needs no Group, and excluding ternaries to allow for that also
excluded the subscribe cell, whose `role={isSubscribed ? ... : ...}` says nothing
about how many controls it holds. Named cells with a stated scope beat a general
rule that quietly stops covering things.
Two slips of mine in that file, both caught by running it: `expect(value, message)`
is chai and throws in jest, and `onSave(pin.id, ...)` was not unique to the cell
it named -- the edit row's TextInput calls it from onKeyDown in a different cell,
so the check passed against the wrong one.
1132 jest / 64 suites, 243 in ui-layout.cy.js, clean npm run build. Confirmed
live: three 30x30 controls, vertical spread 0, 10px gaps.
2026-08-02 17:44:25 -06:00
|
|
|
{/* See PinEditRow: a Group so the preview and subscribe controls line up and are
|
|
|
|
|
spaced, rather than sitting on baselines they do not share. */}
|
|
|
|
|
<Group gap='xs' wrap='nowrap'>
|
|
|
|
|
{bbox && <Button
|
|
|
|
|
size='xs'
|
|
|
|
|
icon='eye'
|
review: name the icon-only controls, and make two guards mean what they say
Acting on the review of #626. No bugs; one suggestion and three nits.
The map's icon-only controls had no accessible name. IconButton requires a
label by construction and AddToPlaylistButton supplies one, but the plain Button
and APIButton used for edit, delete and the catalog preview reached assistive tech
as unnamed buttons -- and my own Cypress fixtures carefully passed `aria-label`
on the same pattern while production did not, which is its own kind of tell. All
four are named now, and named with the row's subject rather than the verb alone:
"Delete Water tank", not "Delete", because a table of pins otherwise offers a
screen reader a column of identical buttons.
A source guard holds that: it scans for controls that carry an icon and no label
text, and reports any without an `aria-label`. Paired with a premise that it
found some, since a scanner matching nothing reads exactly like a clean file.
The Group guard asserted only that `<Group` appeared somewhere in the cell, which
would pass on an empty Group left beside the bare siblings it was meant to wrap.
It now checks that every control in the cell is inside the Group -- and the first
version of THAT was wrong too: it sliced from `<Group` to the end of the cell
rather than to `</Group>`, so controls after the closing tag still counted as
inside, and the empty-Group plant stayed green. Slicing between the tags makes
it fail.
Coverage the review asked for: the Semantic size names the call sites actually
use (`small`, `big`, `huge`) rather than only the Mantine ones, since the
translation step was untested on the exact spellings that were broken; icon-only
buttons stay square while loading, when the glyph is replaced by a spinner sized
from the button's height; and `iconAfter`-only squares as well as `icon`-only.
On the size passthrough, which was flagged as the highest-risk change outside the
map: the buttons that grow are Settings' Shutdown and Reboot (`huge`, to 60px),
Settings' Upgrade and Save and Channels' Save (`big`, to 50px), and VideoPlayer's
Refresh (`large`, to 50px). All six read as deliberate emphasis -- the two
biggest are the two destructive ones -- so they are left honoured rather than
re-broken at the call site. `size='small'` resolves to `sm`, which is what the
accidental default already was, so the detail pages do not move.
1134 jest / 64 suites, 246 in ui-layout.cy.js, clean npm run build.
2026-08-02 17:57:27 -06:00
|
|
|
aria-label={`Preview ${name}`}
|
ui: the map pin buttons were three sizes for three reasons
Reported as "all different sizes", and the pin row's three actions measured
46x30, 30x30 and 54x36. Three causes.
APIButton dropped `size`. `useAPIButton` declared `size = 'medium'` as a
parameter and then never put it into the props it hands to Button, so every
APIButton in the app rendered at Mantine's default regardless of what its call
site asked for -- seventeen call sites pass one, from `xs` on the map pins to
`big` and `huge` on Settings. The delete pin was 36px tall beside two 30px
siblings because of it. Passing the parameter default through would have fixed
the bug by breaking everything else -- every APIButton naming no size would have
grown from `sm` to `md` -- so the default is undefined now and Button's own
default stands. Eight buttons on three other pages do grow as a result, which is
their call sites finally being honoured: VideoPlayer's `large`, one of Channels'
`big`, and Settings' two `big` and two `huge`.
An icon-only Button was not square. A Button is as wide as its content plus its
horizontal padding; an ActionIcon is square by construction; and the pin row
mixes the two, because AddToPlaylistButton renders an IconButton when it has no
label. Their heights already agreed -- ActionIcon's scale was remapped onto
Button's some commits ago -- and this is the other axis of the same alignment,
keyed off Mantine's own `--button-height` so the two stay in step through every
size.
They were also misaligned and touching, which is a third thing: bare inline-block
siblings align on text BASELINES, and a Button's baseline is not an ActionIcon's,
so the middle control sat 4.3px above the other two. A Group, as every other row
of buttons in the app uses.
Written test-first at Roland's request. Seven cypress cases went red on the
sizes -- widths 46 against 30, 54 against 36, 62 against 42, 70 against 50, and
"xs is shorter than lg: expected 36 to be below 32" for the dropped size -- with
both inverses green throughout: a labelled button stays as wide as its label, and
an APIButton naming no size keeps the height it had.
The alignment claim is measured in ui-layout.cy.js, including the premise that
bare siblings really are misaligned, since three controls of identical height not
lining up is not believable otherwise. The call sites are held by a source
guard, because MapPins fetches from the API and builds its rows through
SortableTable.
That guard earned itself twice over. Written for the pin rows, it found the
map-files subscribe cell putting a preview button beside a subscribe button with
the same defect. Then a first attempt at a general "any cell with two controls"
rule had to be abandoned: a cell whose buttons are the arms of a ternary renders
only one and needs no Group, and excluding ternaries to allow for that also
excluded the subscribe cell, whose `role={isSubscribed ? ... : ...}` says nothing
about how many controls it holds. Named cells with a stated scope beat a general
rule that quietly stops covering things.
Two slips of mine in that file, both caught by running it: `expect(value, message)`
is chai and throws in jest, and `onSave(pin.id, ...)` was not unique to the cell
it named -- the edit row's TextInput calls it from onKeyDown in a different cell,
so the check passed against the wrong one.
1132 jest / 64 suites, 243 in ui-layout.cy.js, clean npm run build. Confirmed
live: three 30x30 controls, vertical spread 0, 10px gaps.
2026-08-02 17:44:25 -06:00
|
|
|
onClick={() => setPreviewOpen(true)}
|
|
|
|
|
/>}
|
|
|
|
|
<Button
|
|
|
|
|
role={isSubscribed ? 'danger' : undefined}
|
|
|
|
|
color={isSubscribed ? undefined : 'violet'}
|
|
|
|
|
size='xs'
|
|
|
|
|
onClick={handleButton}
|
|
|
|
|
>
|
|
|
|
|
{isSubscribed ? 'Unsubscribe' : 'Subscribe'}
|
|
|
|
|
</Button>
|
|
|
|
|
</Group>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
{previewOpen && <RegionPreviewModal
|
|
|
|
|
bbox={bbox}
|
|
|
|
|
name={name}
|
|
|
|
|
open={previewOpen}
|
|
|
|
|
onClose={() => setPreviewOpen(false)}
|
|
|
|
|
/>}
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Row>;
|
2026-03-29 18:58:31 -06:00
|
|
|
}
|
2022-03-08 13:26:03 -07:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
function ManageMap() {
|
|
|
|
|
const [files, setFiles] = useState(null);
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
// null = pending, undefined = fetch failed, [] = no regions in the catalog.
|
|
|
|
|
const [catalog, setCatalog] = useState(null);
|
2026-03-29 18:58:31 -06:00
|
|
|
const [subscriptions, setSubscriptions] = useState([]);
|
|
|
|
|
const [allRegionsOpen, setAllRegionsOpen] = useState(false);
|
2026-04-11 20:09:30 -06:00
|
|
|
const {status} = React.useContext(StatusContext);
|
|
|
|
|
const searchBuilding = status?.flags?.map_search_building;
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
// Only the newest subscriptions request may write state: a subscribe or unsubscribe refetches
|
|
|
|
|
// while the mount request may still be in flight.
|
|
|
|
|
const subscriptionsGen = useRef(0);
|
2022-03-08 13:26:03 -07:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const fetchFiles = async () => {
|
2022-05-01 21:03:30 -06:00
|
|
|
try {
|
2026-03-29 18:58:31 -06:00
|
|
|
const data = await getMapFiles();
|
|
|
|
|
if (data) {
|
|
|
|
|
setFiles(data.files || []);
|
|
|
|
|
}
|
2022-05-01 21:03:30 -06:00
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
2026-03-29 18:58:31 -06:00
|
|
|
setFiles(undefined);
|
2023-08-15 15:12:45 -06:00
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
};
|
2022-03-08 13:26:03 -07:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const fetchSubscriptionData = async () => {
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
const gen = ++subscriptionsGen.current;
|
2026-03-29 18:58:31 -06:00
|
|
|
try {
|
|
|
|
|
const data = await fetchMapSubscriptions();
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
if (gen !== subscriptionsGen.current) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
if (data) {
|
|
|
|
|
setCatalog(data.catalog || []);
|
|
|
|
|
setSubscriptions(data.subscriptions || []);
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
} else {
|
|
|
|
|
// The api helper already toasted the non-OK response.
|
|
|
|
|
setCatalog(undefined);
|
2022-03-08 13:26:03 -07:00
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
if (gen === subscriptionsGen.current) {
|
|
|
|
|
setCatalog(undefined);
|
|
|
|
|
}
|
2022-03-08 13:26:03 -07:00
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchFiles();
|
|
|
|
|
fetchSubscriptionData();
|
|
|
|
|
const interval = setInterval(fetchFiles, 30000);
|
|
|
|
|
return () => clearInterval(interval);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const handleDelete = async (filename) => {
|
|
|
|
|
await deleteMapFile(filename);
|
|
|
|
|
await fetchFiles();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// --- Files table ---
|
|
|
|
|
const fileHeaders = [
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
{key: 'name', text: 'File', sortBy: i => i.map_path.toLowerCase()},
|
|
|
|
|
{key: 'kind', text: 'Type', sortBy: i => i.kind || ''},
|
2026-03-29 18:58:31 -06:00
|
|
|
{key: 'size', text: 'Size', sortBy: i => i.size || 0},
|
2026-04-11 20:09:30 -06:00
|
|
|
{key: 'search', text: 'Search', sortBy: null},
|
2026-03-29 18:58:31 -06:00
|
|
|
{key: 'actions', text: '', sortBy: null},
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
{key: 'visible', text: 'Visible', sortBy: i => (i.visible === false ? 0 : 1)},
|
2026-03-29 18:58:31 -06:00
|
|
|
];
|
2022-03-08 13:26:03 -07:00
|
|
|
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
const handleBuildSearch = async (mapPath) => {
|
|
|
|
|
await rebuildMapSearchIndex(mapPath);
|
2026-04-11 20:09:30 -06:00
|
|
|
await fetchFiles();
|
|
|
|
|
};
|
|
|
|
|
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
const handleVisible = async (file, visible) => {
|
|
|
|
|
try {
|
|
|
|
|
await setMapFileVisible(file.map_path, visible);
|
|
|
|
|
} finally {
|
|
|
|
|
await fetchFiles();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const fileRowFunc = (file) => {
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
return <Table.Row key={file.map_path}>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
{/* A file in a sub-directory is shown with its directory. */}
|
|
|
|
|
{file.map_path}
|
|
|
|
|
{file.title && file.title !== file.name.replace(/\.pmtiles$/, '') && <div style={{fontSize: '0.75rem', color: 'var(--muted)'}}
|
|
|
|
|
title={file.description || undefined}>{file.title}</div>}
|
|
|
|
|
</Table.Cell>
|
2026-11-13 15:41:43 -07:00
|
|
|
<Table.Cell>
|
|
|
|
|
{MAP_FILE_KINDS[file.kind] || ''}
|
|
|
|
|
{/* A style beside the file says how it is drawn. */}
|
|
|
|
|
{file.kind === 'overlay' && file.style_path ? ' (styled)' : ''}
|
|
|
|
|
</Table.Cell>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
<Table.Cell>{humanFileSize(file.size)}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
{/* A search index is built from a basemap's places; other files have none. */}
|
|
|
|
|
{file.kind !== 'basemap'
|
2026-04-11 20:09:30 -06:00
|
|
|
? null
|
|
|
|
|
: file.has_search_index
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
? <Button size='xs' icon='check' disabled role='save'>Built</Button>
|
|
|
|
|
: <APIButton size='xs' icon='search'
|
2026-04-11 20:09:30 -06:00
|
|
|
disabled={searchBuilding}
|
|
|
|
|
loading={searchBuilding}
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
onClick={() => handleBuildSearch(file.map_path)}>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
{searchBuilding ? 'Building...' : 'Build'}
|
|
|
|
|
</APIButton>
|
2026-04-11 20:09:30 -06:00
|
|
|
}
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
<APIButton
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
role='danger'
|
|
|
|
|
size='xs'
|
2026-03-29 18:58:31 -06:00
|
|
|
confirmContent='Delete this map file?'
|
|
|
|
|
confirmButton='Delete'
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
onClick={() => handleDelete(file.map_path)}
|
2026-03-29 18:58:31 -06:00
|
|
|
>
|
|
|
|
|
Delete
|
|
|
|
|
</APIButton>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
<Table.Cell>
|
|
|
|
|
<Toggle
|
|
|
|
|
aria-label={`Show ${file.map_path} on the map`}
|
|
|
|
|
title='Show this file on the map, or ignore it.'
|
|
|
|
|
checked={file.visible !== false}
|
|
|
|
|
onChange={(e) => handleVisible(file, e.currentTarget.checked)}
|
|
|
|
|
/>
|
|
|
|
|
</Table.Cell>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Row>;
|
2026-03-29 18:58:31 -06:00
|
|
|
};
|
2026-02-15 14:16:35 -07:00
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
const emptyRow = <Table.Row>
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
<Table.Cell colSpan={6}>No PMTiles map files were found in <b>map/</b></Table.Cell>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Row>;
|
2026-02-15 14:16:35 -07:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
// --- Catalog table ---
|
|
|
|
|
const catalogHeaders = [
|
|
|
|
|
{key: 'name', text: 'Region', sortBy: i => i.name.toLowerCase()},
|
|
|
|
|
{key: 'size', text: 'Estimated Size', sortBy: i => i.size_estimate || 0},
|
|
|
|
|
{key: 'actions', text: '', sortBy: null},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const catalogRowFunc = (item) => {
|
|
|
|
|
return <MapCatalogRow
|
|
|
|
|
key={item.region}
|
|
|
|
|
item={item}
|
|
|
|
|
subscribedRegions={new Set(subscriptions.map(s => s.region))}
|
|
|
|
|
fetchData={fetchSubscriptionData}
|
|
|
|
|
/>;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (files === undefined) {
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
return <>
|
2022-08-06 05:22:07 +00:00
|
|
|
<WROLModeMessage content='Cannot modify Map'/>
|
2026-03-29 18:58:31 -06:00
|
|
|
<ErrorMessage>Could not fetch map files</ErrorMessage>
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
</>;
|
2022-03-08 13:26:03 -07:00
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
const catalogLoaded = Array.isArray(catalog);
|
|
|
|
|
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
/*
|
|
|
|
|
* A fragment, not a `PageContainer`. `MapRoute` already provides the page chrome -- a
|
|
|
|
|
* `wrolpi-stack` wrapper with its own top margin -- so a second one put this page a further
|
|
|
|
|
* 1em down and 1em in from the tab bar than the viewer beside it.
|
|
|
|
|
*/
|
|
|
|
|
return <>
|
2026-03-29 18:58:31 -06:00
|
|
|
<WROLModeMessage content='Cannot modify Map'/>
|
|
|
|
|
|
|
|
|
|
<Header as='h3'>Map Files</Header>
|
|
|
|
|
<SortableTable
|
|
|
|
|
tableHeaders={fileHeaders}
|
|
|
|
|
data={files}
|
|
|
|
|
rowFunc={fileRowFunc}
|
The map draws any PMTiles file as an overlay, in any sub-directory (#962)
Any PMTiles file under the map directory, at any depth, can be shown. The API reads each file's header and metadata and says what it is (basemap, terrain, overlay, unreadable). Overlays are offered in the layer control under the name the file gives itself, hidden until turned on, with a checkbox per vector layer, and are drawn generically.
Map files are named by their path within the map directory everywhere, and unfinished downloads are no longer listed. A file can be ignored from the Manage page; ignored files are kept in a new maps.yaml config.
PMTiles metadata is not decompressed past its size limit, and the standalone viewer encodes map file paths.
2026-11-13 15:11:01 -07:00
|
|
|
rowKey='map_path'
|
2026-03-29 18:58:31 -06:00
|
|
|
defaultSortColumn='name'
|
|
|
|
|
emptyRow={emptyRow}
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<Divider/>
|
|
|
|
|
|
|
|
|
|
<div style={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '0.5em'}}>
|
|
|
|
|
<Header as='h3'>Map Subscriptions</Header>
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
{/* A pending or failed catalog is not "zero regions": the preview waits for one. The
|
|
|
|
|
modal is mounted only then, so it receives the state array itself and its map is
|
|
|
|
|
not rebuilt by a fresh `[]` on every status tick. */}
|
|
|
|
|
<Button size='xs' icon='globe' disabled={!catalogLoaded} onClick={() => setAllRegionsOpen(true)}>
|
|
|
|
|
View All Regions
|
|
|
|
|
</Button>
|
2026-03-29 18:58:31 -06:00
|
|
|
</div>
|
|
|
|
|
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
{catalogLoaded && <AllRegionsPreviewModal catalog={catalog} open={allRegionsOpen}
|
|
|
|
|
onClose={() => setAllRegionsOpen(false)}/>}
|
2026-03-29 18:58:31 -06:00
|
|
|
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
{catalog === undefined
|
|
|
|
|
? <ErrorMessage>Could not fetch map subscriptions</ErrorMessage>
|
|
|
|
|
: <SortableTable
|
|
|
|
|
tableHeaders={catalogHeaders}
|
|
|
|
|
data={catalog}
|
|
|
|
|
rowFunc={catalogRowFunc}
|
|
|
|
|
rowKey='region'
|
|
|
|
|
defaultSortColumn='name'
|
|
|
|
|
/>}
|
2026-03-29 18:58:31 -06:00
|
|
|
|
|
|
|
|
<InfoMessage storageName='hint_map_subscribe'>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
<div style={{fontWeight: 600, marginBottom: 4}}>How to get map files</div>
|
2026-03-29 18:58:31 -06:00
|
|
|
<p>Subscribe to a map region to automatically download it. Subscriptions will
|
|
|
|
|
periodically check for updated maps. Downloads may take a long time depending on
|
|
|
|
|
the region size and your internet speed. You can monitor progress on
|
|
|
|
|
the <b>Downloads</b> page.</p>
|
|
|
|
|
<p>You can also manually extract a region using the <b>pmtiles</b> command-line tool
|
|
|
|
|
and place the resulting file into the <b>map/</b> directory:</p>
|
|
|
|
|
<pre> pmtiles extract https://build.protomaps.com/YYYYMMDD.pmtiles region.pmtiles \{'\n'} --bbox="-125.0,24.4,-66.9,49.4"</pre>
|
|
|
|
|
<p>Find the latest build date at
|
|
|
|
|
<a href='https://maps.protomaps.com/builds/' rel='noopener noreferrer'
|
|
|
|
|
target='_blank'>maps.protomaps.com/builds</a>
|
|
|
|
|
</p>
|
|
|
|
|
</InfoMessage>
|
|
|
|
|
|
A fallout simulator on the map: nuclear mode, targets, live winds aloft (#1007)
* A fallout model, checked against six Nevada tests
The local fallout of a surface burst lands where layered winds carry particles of every size
from the stabilized cloud. Cloud and particle sizes come from DNAF-1, WSEG-10 and DELFIC;
the air is the 1976 standard atmosphere. The six shots' wind profiles, measured contour
areas and plume bearings are in nts-shots.json with their sources, alongside HPAC's
predictions of the same contours.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A prototype fallout panel on the map
Right-click "Simulate Fallout Here" draws the dose rate at H+1 of one surface burst, in one
wind or in the winds aloft of one of the six Nevada tests. Nothing is saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout lands where it meets the ground
A particle stops falling at the first level where it is at or below the ground under it, not
at a plane at the height of ground zero: early on a ridge in its way, later in a valley. The
map panel reads the ground from the terrain files the user has downloaded; the Nevada tests
are checked against a small elevation grid of Mapterhorn terrain, as WROLPi publishes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout falls from the cloud's cap, skirt and stem
The cloud of a surface burst holds 77.5% of its activity in the cap, 15% in a skirt below it
and 7.5% in the stem (Philippe et al.); the stem starts as narrow as the early fireball at the
ground and widens up to the cap (DNAF-1). More of the fallout lands near ground zero: a 1 Mt
burst now draws a 1000 R/hr contour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Close-in fallout measured after three Nevada surface bursts
Jangle Sugar, Small Boy and Johnie Boy, from DNAF-1's Table 3: the area, hotline length and
azimuth of each contour from 35 to 1000 R/hr, as observed and as DNAF-1, DELFIC and WSEG-10
predicted them, with each shot's winds. The deposition grid can look closely at part of the
fallout, and measures hotlines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout rises with the cloud, and heavy particles drop out low
All of the activity starts in the early fireball and rises with the cloud, whose base and top
climb with the square root of time (SIMFIC). Each particle rises with the air less its own
settling speed, so a heavy one leaves the cloud low and early and lands near ground zero, and a
light one rides to the top. A burst above the ground puts down less, by its scaled height.
Against the close-in fallout of Jangle Sugar and Small Boy this is within 2.4x in area and 1.7x
in hotline length (it was 100x short); across the six Nevada tests, 4.2x a priori (it was 8.9x).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel offers the weapons in service today
Weapons deployed or stockpiled by each country, each with its yield quoted from the 2025-2026
Nuclear Notebook or SIPRI Yearbook, and the improvised devices FEMA plans for; no retired or
historical weapons, and none whose yield no source gives. Variable-yield weapons have one entry
for each published setting. Fission shares are not public; they are assumed as Glasstone and
Dolan plan for, and the user may change them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's dropdowns open above it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A variable-yield weapon is named once, with each setting's yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel uses the forecast winds aloft
WROLPi fetches, on request, Open-Meteo's hourly forecast of the wind at nineteen pressure levels
(about 100 m to 24 km) and the rain, for the whole degree around the burst: the place is rounded
before it is sent. The forecast is kept, so the panel can use it offline. The panel picks the
hour nearest now, gives the forecast's age, and warns of rain, which brings fallout down in places
the map does not show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A nuclear mode on the map: targets, and fallout
A radiation button under the print button turns nuclear mode on and off. In it, targets (likely
detonation sites) are shown alongside the pins, a pin added is saved as a target, and fallout can
be simulated at a target or anywhere on the map. A pin's kind is kept in map_pins.yaml; a pin
without one is a plain pin, as every pin was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets keep their weapon, and nuclear mode shows the fallout of all of them
A target keeps the weapon chosen for it (or a yield of the user's own) and its fission share in
map_pins.yaml. Nuclear mode opens on the fallout of every saved target at once, in the forecast
winds aloft fetched most recently; a burst tried out from the map can be saved as a target.
A whole-degree latitude or longitude, which a browser sends as an integer, is a valid pin, and a
pin's label and color may be left out of an update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* An improvised device is named once, with each yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout of many targets is calculated in seconds, and shown as it goes
A particle size's settling speed is read from a table by altitude rather than solved again for
every fall of every burst (a burst: 40 ms to 6 ms). The view yields to the page only every 40 ms,
through a message channel, which a browser does not hold back in a hidden tab as it does timers;
it says how far it has got, and draws the fallout on flat ground while the terrain is read.
A target in the list shows its weapon, and is given a weapon picker when asked; one picker sets
every target's weapon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout grid covers where fallout shows, not past the poles
The faintest particles of a burst are carried thousands of km in two days; with many targets the
grid stretched past 90 degrees and the map refused the image ("Invalid LngLat latitude"). The grid
now covers the spots which can reach the faintest band drawn, the image's corners stay within
Web Mercator's 85 degrees, and so does the area whose terrain is read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout across a continent is drawn where it lands
The map stretches an image evenly in Web Mercator between its corners, but the fallout grid's rows
are evenly apart in latitude; over tens of degrees (targets across a country) they part ways, and
the southern part of the image was drawn far from its targets. Each image row now takes the grid
row at its own latitude. A burst far from the first target keeps its plume as wide, east to west,
as at its own latitude.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Terrain across the antimeridian, and ground with no number, do not break the fallout
Targets in Alaska and Hawaii carry fallout west of 180 degrees, where the terrain's tile arithmetic
read past the tile's pixels; one sample with no number made every target's lowest ground NaN and
every spot fall off the map, and the grid's size Infinity. Longitudes wrap, a sample with no number
is left out (of the lowest ground, and of the elevation between samples), and a spot not on the map
is left out of the grid rather than breaking it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Every target's weapon is set in one change
Setting it target by target, eight at once, lost most of the changes: each request wrote the whole
pin list, undoing the others (QA: 47 of 156 changed). PUT /api/map/pins/targets/weapon gives
every target the weapon in one change of the config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The every-target weapon picker starts empty and always applies
It showed the first target's weapon, so choosing that weapon for all of them did nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout is carried by the winds where it is, region by region
A field of forecasts on a grid over the targets replaces the one forecast for
all of them. Each particle rises and falls through the wind at its place,
height and hour, read between the surrounding grid points, hours and heights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The winds aloft are fetched as a Job, ninety places a minute
The free forecast service allows 600 calls a minute and a place costs six, so
a field of up to 540 points is fetched in paced batches by a Job, which the
fallout panel follows, instead of inside one request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A small burst's hot fallout is kept on a grid over many, and the panel says what it shows
- Each burst's narrow close-in fallout is also put on a fine grid, so the
lethal zone of a small target is not averaged away in the cells kilometers
wide of a grid over targets far apart.
- The legend says the dose rate is as at one hour, with all the fallout down,
and what R/hr is; the error quoted is the unscaled model's.
- The TNA's yield is 150 kt: its source gives only an upper bound below 300.
- Weapons show their fission share beside their yield.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout can be watched landing, hour by hour
A timeline under the legend plays, or steps through, the 48 hours after the
bursts: each hour shows only the fallout which has landed by then, at its
dose rate then (t^-1.2 from H+1), on the same cells as the whole of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The map can show the total dose of someone outdoors, hour by hour
A "Show" picker switches from the dose rate to the total dose (R) someone
outdoors gets from when the fallout arrives: t^-1.2 added up from each spot's
arrival to the hour on the timeline, or over the first two weeks. Its bands
say what each dose does to a person.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against the Army's fallout manuals
- FM 3-3-1's worked decay and dose problems are tests.
- FM 3-11.3's cloud and Zone I nomograms, read from their images, are a
fixture; the model's cloud top is within 10% of them from 1 kt to 10 Mt,
and its Zone I within 0.7-1.7 times from 10 kt to 1 Mt, the yields of
modern weapons, which the test shots do not reach.
- The legend says real fallout may decay faster or slower than usual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against two megaton bursts in the Pacific
Redwing Zuni (3.5 Mt), whose winds were measured above its cloud: the hot
fallout goes where it went and about as far. Castle Bravo (15 Mt), whose
winds were measured only below its cloud: its fallout arrives when it did,
and its hot fallout reaching a third as far is kept in view as a known gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Winds are read from the right points at every spacing, and cover the landing
- A field's points were filed by rounding (lat + 90) / spacing but looked up
by flooring it: at 4 and 8 degrees, which do not divide 90, every point read
half its neighbor's wind. Both now count whole spacings from the equator.
- The forecast starts at midnight UTC, so two days could end before the
fallout of a burst this hour was down; three are fetched (the same call
weight), and the panel says when the last hour's winds are held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bravo's known gap is not its unmeasured upper winds
Reanalysis winds above the 1954 sounding turn the plume to within 10 degrees
of the measured one but do not lengthen its hot contours; the fixture's caveat
and the test's explanation said otherwise, and now say what was found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Rain takes fallout out of the air where it falls
A falling particle in rain loses a share of its activity every step: fast
inside the rain cloud ("rainout"), slower below it, by how hard it rains
("washout"), at Glasstone and Dolan's rates (Tables 9.74a and b), and none
above it. What is taken out comes down where the particle was. The forecast
now asks for relative humidity at 14 levels, and each hour's rain cloud is
taken as HYSPLIT takes it: from the lowest level 80% humid to the first above
it less than 60%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* With no forecast, the fallout of 30 past days of the month
- wrolpi/scripts/build_fallout_climatology.py builds, from NOAA's reanalysis,
the winds aloft of 30 days of each month (one from each year 1991-2020) over
the whole world: a gzip file a month, about 4 MB, for the release download
location.
- WROLPi fetches the months it lacks once, while there is the Internet, each
checked against a sha256 pinned in modules/map/climatology.py (none pinned
until the files are published), and serves them to the panel.
- The panel's "Past days of a month" wind runs the bursts in each day and shows
on what share of the days each place had the chosen dose rate; it is chosen
for us when there is no forecast, or it has run out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology's months are published, and their sha256 pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology worker waits for the Internet and the drive on startup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Counting the past days says flat ground at once, not the forecast's terrain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout reuses each yield's paths, about 10 times faster
On flat ground in a day's held winds, how each parcel rises with the cloud
and falls does not depend on the wind, so it is worked out once per yield
and kept for every burst and day. The rising cloud is carried by the winds
over ground zero (it drifts about 10 km); the fall still reads the winds
where the particle is. A field of one hour is read without its hours, and
the nearest point to a cell past the field is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rising cloud reads the winds over ground zero from arrays, by level
Each parcel's rise is kept as the levels of the column it passes through
(steps in the same level as one) and their seconds, so a burst reads the
column once and sums.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel shows a progress bar while it calculates
At the top of the panel, filled as far as the bursts are done, or moving
without a count until there is one. A calculation stopped by removing the
last target no longer leaves the panel busy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout runs in Web Workers, with a Cancel button
The days are spread over workers, one for each core but one (left for the
page), at most 6, and at most 2 where the browser says it has 2 GB or less.
A worker is given the next day as it finishes one, and sends back only the
cells reached. Where workers cannot be made, or fail, the days are
calculated on the page as before.
The days are counted on cells as wide as the coarsest day's grid, so the
count does not depend on which day finishes first.
Cancel, beside the progress bar, stops a calculation (and its workers) at
once; Calculate starts it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's bursts are spread over Web Workers too
The workers now take any task: a past day, or a burst. The page and the
workers build each burst's winds and terrain with the same functions
(work.js), so the fallout is the same either way; the flat pass and the
terrain pass each run on their own workers, and Cancel stops them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The bursts' grid is made in parts by the Web Workers
The grid is a sum over the bursts' spots, sharpened by the most any burst
raises a cell, so it is made in a fixed number of parts (a burst's spots
in one) on one frame, and joined on the page. The page makes the same
parts when there are no workers, so the grid is the same either way.
The forecast's warnings (bursts outside the winds, rain) are no longer
worked out again on every progress update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's hours are labeled once an hour, not on every progress update
Writing each hour's label (toLocaleString) took most of the page's time
while the workers calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Faster forecast fallout: the nearest point outside the field, progress, and what workers are sent
- Outside the forecast's field, the nearest point is looked for only
among the points which can be nearest somewhere in the grid cell (kept
for each cell); the same point as looking through them all. Longitudes
are wrapped however far round the world a particle is carried.
- The progress is shown at most ten times a second.
- The workers are sent the forecast's arrays, not the forecast as fetched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel in steps: the targets, then the fallout hour by hour or in total
Nuclear mode opens on the targets; nothing is calculated until the user goes on.
The winds and terrain wait under Options, with what is used said beside it.
The timeline runs from the first hour to two weeks, saying how much the fallout
has weakened since H+1; the view of all the fallout as if landed at H+1 is gone.
Going back and on again with nothing changed draws what was calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's winds: the forecast, past days, or one wind; no test shots' winds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is a step of its own, between the targets and the fallout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel says it is an estimate; how it compares with the test bursts goes in the help
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets are tried out until saved; the saved ones are loaded first, and saved all at once
Nuclear mode starts with no targets. Targets added are tried out, and the saved
targets join them when the user loads them. Saving replaces the saved targets
with the list, in one change, and is refused until they were loaded (or there are
none), so none are lost unseen. A target can be taken out of the list. The
burst tried out from the map's menu is gone: a target tried out does the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Nuclear targets are kept in their own config, map_nuclear.yaml, and listed apart from the pins
The pins are plain pins again. The targets have their own endpoints, and their
own table on the Pins tab, where one can be deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rest of keeping nuclear targets in map_nuclear.yaml: the config, its endpoints, and the table
The commit before this one was missing these files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is the forecast when it has the winds until the fallout is down, else one wind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The weather is a subscription: a forecast around the saved targets, downloaded every day
The Open-Meteo fetch is a recurring Download (daily) instead of a Job the panel
starts. The Manage tab has a Weather section: turning it on or off, what it
downloads, how its downloads went, and the forecast kept. Only the newest
forecast is kept, and it covers four days. The wind step asks the user to turn
the download on, and warns, there and beside the fallout, when the forecast runs
out before the fallout is down.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast service may take three minutes to answer, and a timeout says so
A batch of four days' forecasts took 43 seconds, near the old 60-second limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's targets step has an Add a target button: the next click on the map places it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:01:13 -07:00
|
|
|
<Divider/>
|
|
|
|
|
|
|
|
|
|
<WeatherSection/>
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
<HandPointMessage>
|
|
|
|
|
<p>You can also view the map at <a href={MAP_VIEWER_URI}>{MAP_VIEWER_URI}</a></p>
|
|
|
|
|
</HandPointMessage>
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
</>
|
2022-03-08 13:26:03 -07:00
|
|
|
}
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const PIN_COLORS = ["red", "blue", "green", "yellow", "orange", "purple"];
|
|
|
|
|
|
|
|
|
|
function PinEditRow({pin, onSave, onCancel}) {
|
|
|
|
|
const [label, setLabel] = useState(pin.label);
|
|
|
|
|
const [color, setColor] = useState(pin.color);
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
return <Table.Row>
|
|
|
|
|
<Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
<div style={{display: "flex", gap: 4}}>
|
|
|
|
|
{PIN_COLORS.map(c =>
|
|
|
|
|
<div
|
|
|
|
|
key={c}
|
|
|
|
|
onClick={() => setColor(c)}
|
|
|
|
|
style={{
|
|
|
|
|
width: 20, height: 20, borderRadius: "50%", background: c, cursor: "pointer",
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
border: color === c ? "3px solid var(--text)" : "2px solid var(--border)",
|
2026-03-29 18:58:31 -06:00
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
<TextInput
|
|
|
|
|
size='sm'
|
2026-03-29 18:58:31 -06:00
|
|
|
value={label}
|
|
|
|
|
onChange={(e) => setLabel(e.target.value)}
|
|
|
|
|
onKeyDown={(e) => e.key === 'Enter' && label.trim() && onSave(pin.id, label.trim(), color)}
|
|
|
|
|
/>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{pin.lat.toFixed(4)}, {pin.lon.toFixed(4)}</Table.Cell>
|
|
|
|
|
<Media greaterThan='mobile'><Table.Cell>{pin.created}</Table.Cell></Media>
|
|
|
|
|
<Table.Cell>
|
ui: the map pin buttons were three sizes for three reasons
Reported as "all different sizes", and the pin row's three actions measured
46x30, 30x30 and 54x36. Three causes.
APIButton dropped `size`. `useAPIButton` declared `size = 'medium'` as a
parameter and then never put it into the props it hands to Button, so every
APIButton in the app rendered at Mantine's default regardless of what its call
site asked for -- seventeen call sites pass one, from `xs` on the map pins to
`big` and `huge` on Settings. The delete pin was 36px tall beside two 30px
siblings because of it. Passing the parameter default through would have fixed
the bug by breaking everything else -- every APIButton naming no size would have
grown from `sm` to `md` -- so the default is undefined now and Button's own
default stands. Eight buttons on three other pages do grow as a result, which is
their call sites finally being honoured: VideoPlayer's `large`, one of Channels'
`big`, and Settings' two `big` and two `huge`.
An icon-only Button was not square. A Button is as wide as its content plus its
horizontal padding; an ActionIcon is square by construction; and the pin row
mixes the two, because AddToPlaylistButton renders an IconButton when it has no
label. Their heights already agreed -- ActionIcon's scale was remapped onto
Button's some commits ago -- and this is the other axis of the same alignment,
keyed off Mantine's own `--button-height` so the two stay in step through every
size.
They were also misaligned and touching, which is a third thing: bare inline-block
siblings align on text BASELINES, and a Button's baseline is not an ActionIcon's,
so the middle control sat 4.3px above the other two. A Group, as every other row
of buttons in the app uses.
Written test-first at Roland's request. Seven cypress cases went red on the
sizes -- widths 46 against 30, 54 against 36, 62 against 42, 70 against 50, and
"xs is shorter than lg: expected 36 to be below 32" for the dropped size -- with
both inverses green throughout: a labelled button stays as wide as its label, and
an APIButton naming no size keeps the height it had.
The alignment claim is measured in ui-layout.cy.js, including the premise that
bare siblings really are misaligned, since three controls of identical height not
lining up is not believable otherwise. The call sites are held by a source
guard, because MapPins fetches from the API and builds its rows through
SortableTable.
That guard earned itself twice over. Written for the pin rows, it found the
map-files subscribe cell putting a preview button beside a subscribe button with
the same defect. Then a first attempt at a general "any cell with two controls"
rule had to be abandoned: a cell whose buttons are the arms of a ternary renders
only one and needs no Group, and excluding ternaries to allow for that also
excluded the subscribe cell, whose `role={isSubscribed ? ... : ...}` says nothing
about how many controls it holds. Named cells with a stated scope beat a general
rule that quietly stops covering things.
Two slips of mine in that file, both caught by running it: `expect(value, message)`
is chai and throws in jest, and `onSave(pin.id, ...)` was not unique to the cell
it named -- the edit row's TextInput calls it from onKeyDown in a different cell,
so the check passed against the wrong one.
1132 jest / 64 suites, 243 in ui-layout.cy.js, clean npm run build. Confirmed
live: three 30x30 controls, vertical spread 0, 10px gaps.
2026-08-02 17:44:25 -06:00
|
|
|
{/* A Group, not bare siblings: inline-block controls align on text baselines they
|
|
|
|
|
do not share, and JSX leaves no whitespace between them to space them out. */}
|
|
|
|
|
<Group gap='xs' wrap='nowrap'>
|
|
|
|
|
<Button size='xs' role='save'
|
|
|
|
|
onClick={() => label.trim() && onSave(pin.id, label.trim(), color)}>Save</Button>
|
|
|
|
|
<Button size='xs' role='cancel' onClick={onCancel}>Cancel</Button>
|
|
|
|
|
</Group>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
2026-03-29 18:58:31 -06:00
|
|
|
}
|
2024-06-17 10:40:30 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
function MapPins() {
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
// null = pending, undefined = fetch failed, [] = no pins. The empty row invites the user to
|
|
|
|
|
// add one, so it may only appear for a confirmed empty list.
|
|
|
|
|
const [pins, setPins] = useState(null);
|
2026-03-29 18:58:31 -06:00
|
|
|
const [filter, setFilter] = useState('');
|
|
|
|
|
const [editingId, setEditingId] = useState(null);
|
|
|
|
|
const navigate = useNavigate();
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
// Only the newest pins request may write state: an edit or delete refetches while the mount
|
|
|
|
|
// request may still be in flight.
|
|
|
|
|
const pinsGen = useRef(0);
|
2024-07-30 17:14:08 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const fetchPins = async () => {
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
const gen = ++pinsGen.current;
|
2026-03-29 18:58:31 -06:00
|
|
|
try {
|
|
|
|
|
const data = await getMapPins();
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
if (gen === pinsGen.current) {
|
|
|
|
|
// The api helper returns undefined on a non-OK response.
|
|
|
|
|
setPins(data ? data.pins || [] : undefined);
|
|
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
} catch (e) {
|
|
|
|
|
console.error(e);
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
if (gen === pinsGen.current) {
|
|
|
|
|
setPins(undefined);
|
|
|
|
|
}
|
2026-03-29 18:58:31 -06:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchPins();
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const handleDelete = async (pinId) => {
|
|
|
|
|
await deleteMapPin(pinId);
|
|
|
|
|
setEditingId(null);
|
|
|
|
|
await fetchPins();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleSave = async (pinId, label, color) => {
|
|
|
|
|
await updateMapPin(pinId, label, color);
|
|
|
|
|
setEditingId(null);
|
|
|
|
|
await fetchPins();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleNavigate = (pin) => {
|
|
|
|
|
navigate(`/map?lat=${pin.lat}&lon=${pin.lon}&z=14`);
|
|
|
|
|
};
|
|
|
|
|
|
Add a Solar calculator (#778)
* Add a Solar calculator with offline NASA POWER data
Estimates a solar array's typical-year production from a location and the
panels; everything else has defaults under an optional "Fine-tune" section.
The model works from 12 monthly averages: Klein's average day per month, the
Erbs monthly diffuse fraction, Collares-Pereira & Rabl / Liu & Jordan hourly
split, HDKR transposition for fixed, single-axis and dual-axis arrays, then
PVWatts' ASHRAE incidence loss, SAPM cell temperature, DC power, system
losses and optional inverter. "Best for the year" and "Best for winter" sweep
the tilt.
Sunlight, diffuse, albedo and temperature come from NASA POWER's 2001-2020
climatology on a 1 degree grid, packed into app/public/data (3.1 MB, ~1 MB
gzipped) by scripts/build_solar_climatology.py and fetched only when the
calculator opens. Users can replace it with their own monthly values.
Every setting lives in the URL, with defaults left out, so the Share button
shares the whole configuration.
Against PVWatts v8 for a 1 kW fixed array: Phoenix +0.6%, Seattle +8.8%,
Anchorage +8.0% annually; these are recorded as tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Open the Solar calculator from the map, pins and current location
The map's right-click (or long-press) menu gains "Calculate Solar
Performance", and each saved pin a sun button; both open the calculator at
that location. A button beside Latitude fills in the browser's current
location. Locations are rounded to 4 decimals, and longitudes from a map
panned around the world are wrapped back to -180..180.
The map removed lat/lon/z from the URL when it closed, even after navigating
to another page, which stripped the calculator's location from its URL (and
from links shared with the Share button). It now only cleans up while the
URL is still a map page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add off-grid sizing to the Solar calculator
A new "Off-grid sizing" tab sizes a battery system for the darkest month
from a list of devices (watts x hours per day):
- Battery bank for a number of days without sun, for LiFePO4 or lead-acid,
at 12, 24 or 48 V. Outdoor lead-acid is enlarged for the cold; outdoor
lithium warns against charging below 0 C.
- Panels needed, from the worst month's DC production per kW at the chosen
angle, with a button to apply the count. A PWM controller's loss (battery
voltage over the panel's Vmp) raises the count.
- Charge controller current, and the string voltage on the coldest morning
against the controller's limit, since cold panels exceed their rated Voc.
The coldest morning defaults to 25 C below the coldest monthly average.
All inputs live in the URL like the rest of the calculator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bump wrolpi-help for the Solar calculator help page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Credit NASA POWER as it asks, and say how the data was changed
- The calculator gains a "Data attribution" link under the location with
NASA POWER's requested acknowledgment, the data reference (Climatology API
v2.10.0, downloaded 2026/10/04), the CC BY 4.0 license, and how WROLPi
modified the data (rounded to one byte per value, temperature averaged
into 1 degree cells, interpolated between cells), which CC BY 4.0 requires.
- The build script writes the same text to solar-climatology.LICENSE.txt
beside the data, with the API version taken from NASA's responses and the
date the tiles were downloaded. A test keeps the page and file in step.
- Bumps wrolpi-help for the updated attribution in the help page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: fix PWM sizing, Voc sign, unit switching and loading on review
- PWM usable power now uses the string's voltage (Vmp x panels in series),
delivers nothing when the charging voltage is at or above the string's Voc,
and falls off between Vmp and Voc. The "too little voltage" warning covers
PWM as well as MPPT. Previously two panels in series counted double, and a
panel that could not charge a 48 V bank counted as fully usable.
- A Voc temperature coefficient entered without its minus sign is treated as
negative, in the math, the URL and the input, so the cold-morning check
cannot be made too generous.
- Switching Fahrenheit on or off converts the entered temperatures instead
of reinterpreting them.
- While the sunlight data downloads, the off-grid tab shows a loader rather
than asking for a location, and holds the cold-morning verdict until the
site's temperatures are known or one has been entered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: move the data attribution to the bottom of the page
The full NASA POWER acknowledgment, license and changes now sit in a small
"Data attribution" section at the end of the calculator, always visible,
instead of behind a link under the location. The source line under the
location points to it. Bumps wrolpi-help to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: drop the data source line under the location
The attribution at the bottom of the page is enough. The line under the
location now only appears to report the data's state: loading, failed to
load, or replaced by the user's own values. Bumps wrolpi-help for the
refreshed screenshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:32:26 -06:00
|
|
|
const solarButton = (pin) => <Button size='xs' icon='sun' aria-label={`Solar estimate for ${pin.label}`}
|
|
|
|
|
onClick={() => navigate(solarCalculatorPath(pin.lat, pin.lon))}/>;
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
// --- Desktop headers and row ---
|
|
|
|
|
const fullHeaders = [
|
|
|
|
|
{key: 'color', text: '', sortBy: i => i.color},
|
|
|
|
|
{key: 'label', text: 'Label', sortBy: i => i.label.toLowerCase()},
|
|
|
|
|
{key: 'coords', text: 'Coordinates', sortBy: i => i.lat},
|
|
|
|
|
{key: 'created', text: 'Created', sortBy: i => i.created},
|
|
|
|
|
{key: 'actions', text: '', sortBy: null},
|
|
|
|
|
];
|
2024-06-17 10:40:30 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const fullRowFunc = (pin) => {
|
|
|
|
|
if (editingId === pin.id) {
|
|
|
|
|
return <PinEditRow
|
|
|
|
|
key={pin.id}
|
|
|
|
|
pin={pin}
|
|
|
|
|
onSave={handleSave}
|
|
|
|
|
onCancel={() => setEditingId(null)}
|
|
|
|
|
/>;
|
|
|
|
|
}
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
return <Table.Row key={pin.id}>
|
|
|
|
|
<Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
<div style={{
|
|
|
|
|
width: 16, height: 16, borderRadius: "50%",
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
background: pin.color || "red", border: "1px solid var(--border)",
|
2026-03-29 18:58:31 -06:00
|
|
|
}}/>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{pin.label}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
<a href="#" onClick={(e) => {e.preventDefault(); handleNavigate(pin);}}>
|
|
|
|
|
{pin.lat.toFixed(4)}, {pin.lon.toFixed(4)}
|
|
|
|
|
</a>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{pin.created}</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
Add a Solar calculator (#778)
* Add a Solar calculator with offline NASA POWER data
Estimates a solar array's typical-year production from a location and the
panels; everything else has defaults under an optional "Fine-tune" section.
The model works from 12 monthly averages: Klein's average day per month, the
Erbs monthly diffuse fraction, Collares-Pereira & Rabl / Liu & Jordan hourly
split, HDKR transposition for fixed, single-axis and dual-axis arrays, then
PVWatts' ASHRAE incidence loss, SAPM cell temperature, DC power, system
losses and optional inverter. "Best for the year" and "Best for winter" sweep
the tilt.
Sunlight, diffuse, albedo and temperature come from NASA POWER's 2001-2020
climatology on a 1 degree grid, packed into app/public/data (3.1 MB, ~1 MB
gzipped) by scripts/build_solar_climatology.py and fetched only when the
calculator opens. Users can replace it with their own monthly values.
Every setting lives in the URL, with defaults left out, so the Share button
shares the whole configuration.
Against PVWatts v8 for a 1 kW fixed array: Phoenix +0.6%, Seattle +8.8%,
Anchorage +8.0% annually; these are recorded as tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Open the Solar calculator from the map, pins and current location
The map's right-click (or long-press) menu gains "Calculate Solar
Performance", and each saved pin a sun button; both open the calculator at
that location. A button beside Latitude fills in the browser's current
location. Locations are rounded to 4 decimals, and longitudes from a map
panned around the world are wrapped back to -180..180.
The map removed lat/lon/z from the URL when it closed, even after navigating
to another page, which stripped the calculator's location from its URL (and
from links shared with the Share button). It now only cleans up while the
URL is still a map page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add off-grid sizing to the Solar calculator
A new "Off-grid sizing" tab sizes a battery system for the darkest month
from a list of devices (watts x hours per day):
- Battery bank for a number of days without sun, for LiFePO4 or lead-acid,
at 12, 24 or 48 V. Outdoor lead-acid is enlarged for the cold; outdoor
lithium warns against charging below 0 C.
- Panels needed, from the worst month's DC production per kW at the chosen
angle, with a button to apply the count. A PWM controller's loss (battery
voltage over the panel's Vmp) raises the count.
- Charge controller current, and the string voltage on the coldest morning
against the controller's limit, since cold panels exceed their rated Voc.
The coldest morning defaults to 25 C below the coldest monthly average.
All inputs live in the URL like the rest of the calculator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bump wrolpi-help for the Solar calculator help page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Credit NASA POWER as it asks, and say how the data was changed
- The calculator gains a "Data attribution" link under the location with
NASA POWER's requested acknowledgment, the data reference (Climatology API
v2.10.0, downloaded 2026/10/04), the CC BY 4.0 license, and how WROLPi
modified the data (rounded to one byte per value, temperature averaged
into 1 degree cells, interpolated between cells), which CC BY 4.0 requires.
- The build script writes the same text to solar-climatology.LICENSE.txt
beside the data, with the API version taken from NASA's responses and the
date the tiles were downloaded. A test keeps the page and file in step.
- Bumps wrolpi-help for the updated attribution in the help page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: fix PWM sizing, Voc sign, unit switching and loading on review
- PWM usable power now uses the string's voltage (Vmp x panels in series),
delivers nothing when the charging voltage is at or above the string's Voc,
and falls off between Vmp and Voc. The "too little voltage" warning covers
PWM as well as MPPT. Previously two panels in series counted double, and a
panel that could not charge a 48 V bank counted as fully usable.
- A Voc temperature coefficient entered without its minus sign is treated as
negative, in the math, the URL and the input, so the cold-morning check
cannot be made too generous.
- Switching Fahrenheit on or off converts the entered temperatures instead
of reinterpreting them.
- While the sunlight data downloads, the off-grid tab shows a loader rather
than asking for a location, and holds the cold-morning verdict until the
site's temperatures are known or one has been entered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: move the data attribution to the bottom of the page
The full NASA POWER acknowledgment, license and changes now sit in a small
"Data attribution" section at the end of the calculator, always visible,
instead of behind a link under the location. The source line under the
location points to it. Bumps wrolpi-help to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: drop the data source line under the location
The attribution at the bottom of the page is enough. The line under the
location now only appears to report the data's state: loading, failed to
load, or replaced by the user's own values. Bumps wrolpi-help for the
refreshed screenshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:32:26 -06:00
|
|
|
{/* See PinEditRow: a Group so the controls line up and are spaced. */}
|
ui: the map pin buttons were three sizes for three reasons
Reported as "all different sizes", and the pin row's three actions measured
46x30, 30x30 and 54x36. Three causes.
APIButton dropped `size`. `useAPIButton` declared `size = 'medium'` as a
parameter and then never put it into the props it hands to Button, so every
APIButton in the app rendered at Mantine's default regardless of what its call
site asked for -- seventeen call sites pass one, from `xs` on the map pins to
`big` and `huge` on Settings. The delete pin was 36px tall beside two 30px
siblings because of it. Passing the parameter default through would have fixed
the bug by breaking everything else -- every APIButton naming no size would have
grown from `sm` to `md` -- so the default is undefined now and Button's own
default stands. Eight buttons on three other pages do grow as a result, which is
their call sites finally being honoured: VideoPlayer's `large`, one of Channels'
`big`, and Settings' two `big` and two `huge`.
An icon-only Button was not square. A Button is as wide as its content plus its
horizontal padding; an ActionIcon is square by construction; and the pin row
mixes the two, because AddToPlaylistButton renders an IconButton when it has no
label. Their heights already agreed -- ActionIcon's scale was remapped onto
Button's some commits ago -- and this is the other axis of the same alignment,
keyed off Mantine's own `--button-height` so the two stay in step through every
size.
They were also misaligned and touching, which is a third thing: bare inline-block
siblings align on text BASELINES, and a Button's baseline is not an ActionIcon's,
so the middle control sat 4.3px above the other two. A Group, as every other row
of buttons in the app uses.
Written test-first at Roland's request. Seven cypress cases went red on the
sizes -- widths 46 against 30, 54 against 36, 62 against 42, 70 against 50, and
"xs is shorter than lg: expected 36 to be below 32" for the dropped size -- with
both inverses green throughout: a labelled button stays as wide as its label, and
an APIButton naming no size keeps the height it had.
The alignment claim is measured in ui-layout.cy.js, including the premise that
bare siblings really are misaligned, since three controls of identical height not
lining up is not believable otherwise. The call sites are held by a source
guard, because MapPins fetches from the API and builds its rows through
SortableTable.
That guard earned itself twice over. Written for the pin rows, it found the
map-files subscribe cell putting a preview button beside a subscribe button with
the same defect. Then a first attempt at a general "any cell with two controls"
rule had to be abandoned: a cell whose buttons are the arms of a ternary renders
only one and needs no Group, and excluding ternaries to allow for that also
excluded the subscribe cell, whose `role={isSubscribed ? ... : ...}` says nothing
about how many controls it holds. Named cells with a stated scope beat a general
rule that quietly stops covering things.
Two slips of mine in that file, both caught by running it: `expect(value, message)`
is chai and throws in jest, and `onSave(pin.id, ...)` was not unique to the cell
it named -- the edit row's TextInput calls it from onKeyDown in a different cell,
so the check passed against the wrong one.
1132 jest / 64 suites, 243 in ui-layout.cy.js, clean npm run build. Confirmed
live: three 30x30 controls, vertical spread 0, 10px gaps.
2026-08-02 17:44:25 -06:00
|
|
|
<Group gap='xs' wrap='nowrap'>
|
review: name the icon-only controls, and make two guards mean what they say
Acting on the review of #626. No bugs; one suggestion and three nits.
The map's icon-only controls had no accessible name. IconButton requires a
label by construction and AddToPlaylistButton supplies one, but the plain Button
and APIButton used for edit, delete and the catalog preview reached assistive tech
as unnamed buttons -- and my own Cypress fixtures carefully passed `aria-label`
on the same pattern while production did not, which is its own kind of tell. All
four are named now, and named with the row's subject rather than the verb alone:
"Delete Water tank", not "Delete", because a table of pins otherwise offers a
screen reader a column of identical buttons.
A source guard holds that: it scans for controls that carry an icon and no label
text, and reports any without an `aria-label`. Paired with a premise that it
found some, since a scanner matching nothing reads exactly like a clean file.
The Group guard asserted only that `<Group` appeared somewhere in the cell, which
would pass on an empty Group left beside the bare siblings it was meant to wrap.
It now checks that every control in the cell is inside the Group -- and the first
version of THAT was wrong too: it sliced from `<Group` to the end of the cell
rather than to `</Group>`, so controls after the closing tag still counted as
inside, and the empty-Group plant stayed green. Slicing between the tags makes
it fail.
Coverage the review asked for: the Semantic size names the call sites actually
use (`small`, `big`, `huge`) rather than only the Mantine ones, since the
translation step was untested on the exact spellings that were broken; icon-only
buttons stay square while loading, when the glyph is replaced by a spinner sized
from the button's height; and `iconAfter`-only squares as well as `icon`-only.
On the size passthrough, which was flagged as the highest-risk change outside the
map: the buttons that grow are Settings' Shutdown and Reboot (`huge`, to 60px),
Settings' Upgrade and Save and Channels' Save (`big`, to 50px), and VideoPlayer's
Refresh (`large`, to 50px). All six read as deliberate emphasis -- the two
biggest are the two destructive ones -- so they are left honoured rather than
re-broken at the call site. `size='small'` resolves to `sm`, which is what the
accidental default already was, so the detail pages do not move.
1134 jest / 64 suites, 246 in ui-layout.cy.js, clean npm run build.
2026-08-02 17:57:27 -06:00
|
|
|
<Button size='xs' icon='edit' aria-label={`Edit ${pin.label}`}
|
|
|
|
|
onClick={() => setEditingId(pin.id)}/>
|
Add a Solar calculator (#778)
* Add a Solar calculator with offline NASA POWER data
Estimates a solar array's typical-year production from a location and the
panels; everything else has defaults under an optional "Fine-tune" section.
The model works from 12 monthly averages: Klein's average day per month, the
Erbs monthly diffuse fraction, Collares-Pereira & Rabl / Liu & Jordan hourly
split, HDKR transposition for fixed, single-axis and dual-axis arrays, then
PVWatts' ASHRAE incidence loss, SAPM cell temperature, DC power, system
losses and optional inverter. "Best for the year" and "Best for winter" sweep
the tilt.
Sunlight, diffuse, albedo and temperature come from NASA POWER's 2001-2020
climatology on a 1 degree grid, packed into app/public/data (3.1 MB, ~1 MB
gzipped) by scripts/build_solar_climatology.py and fetched only when the
calculator opens. Users can replace it with their own monthly values.
Every setting lives in the URL, with defaults left out, so the Share button
shares the whole configuration.
Against PVWatts v8 for a 1 kW fixed array: Phoenix +0.6%, Seattle +8.8%,
Anchorage +8.0% annually; these are recorded as tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Open the Solar calculator from the map, pins and current location
The map's right-click (or long-press) menu gains "Calculate Solar
Performance", and each saved pin a sun button; both open the calculator at
that location. A button beside Latitude fills in the browser's current
location. Locations are rounded to 4 decimals, and longitudes from a map
panned around the world are wrapped back to -180..180.
The map removed lat/lon/z from the URL when it closed, even after navigating
to another page, which stripped the calculator's location from its URL (and
from links shared with the Share button). It now only cleans up while the
URL is still a map page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add off-grid sizing to the Solar calculator
A new "Off-grid sizing" tab sizes a battery system for the darkest month
from a list of devices (watts x hours per day):
- Battery bank for a number of days without sun, for LiFePO4 or lead-acid,
at 12, 24 or 48 V. Outdoor lead-acid is enlarged for the cold; outdoor
lithium warns against charging below 0 C.
- Panels needed, from the worst month's DC production per kW at the chosen
angle, with a button to apply the count. A PWM controller's loss (battery
voltage over the panel's Vmp) raises the count.
- Charge controller current, and the string voltage on the coldest morning
against the controller's limit, since cold panels exceed their rated Voc.
The coldest morning defaults to 25 C below the coldest monthly average.
All inputs live in the URL like the rest of the calculator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bump wrolpi-help for the Solar calculator help page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Credit NASA POWER as it asks, and say how the data was changed
- The calculator gains a "Data attribution" link under the location with
NASA POWER's requested acknowledgment, the data reference (Climatology API
v2.10.0, downloaded 2026/10/04), the CC BY 4.0 license, and how WROLPi
modified the data (rounded to one byte per value, temperature averaged
into 1 degree cells, interpolated between cells), which CC BY 4.0 requires.
- The build script writes the same text to solar-climatology.LICENSE.txt
beside the data, with the API version taken from NASA's responses and the
date the tiles were downloaded. A test keeps the page and file in step.
- Bumps wrolpi-help for the updated attribution in the help page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: fix PWM sizing, Voc sign, unit switching and loading on review
- PWM usable power now uses the string's voltage (Vmp x panels in series),
delivers nothing when the charging voltage is at or above the string's Voc,
and falls off between Vmp and Voc. The "too little voltage" warning covers
PWM as well as MPPT. Previously two panels in series counted double, and a
panel that could not charge a 48 V bank counted as fully usable.
- A Voc temperature coefficient entered without its minus sign is treated as
negative, in the math, the URL and the input, so the cold-morning check
cannot be made too generous.
- Switching Fahrenheit on or off converts the entered temperatures instead
of reinterpreting them.
- While the sunlight data downloads, the off-grid tab shows a loader rather
than asking for a location, and holds the cold-morning verdict until the
site's temperatures are known or one has been entered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: move the data attribution to the bottom of the page
The full NASA POWER acknowledgment, license and changes now sit in a small
"Data attribution" section at the end of the calculator, always visible,
instead of behind a link under the location. The source line under the
location points to it. Bumps wrolpi-help to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: drop the data source line under the location
The attribution at the bottom of the page is enough. The line under the
location now only appears to report the data's state: loading, failed to
load, or replaced by the user's own values. Bumps wrolpi-help for the
refreshed screenshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:32:26 -06:00
|
|
|
{solarButton(pin)}
|
ui: the map pin buttons were three sizes for three reasons
Reported as "all different sizes", and the pin row's three actions measured
46x30, 30x30 and 54x36. Three causes.
APIButton dropped `size`. `useAPIButton` declared `size = 'medium'` as a
parameter and then never put it into the props it hands to Button, so every
APIButton in the app rendered at Mantine's default regardless of what its call
site asked for -- seventeen call sites pass one, from `xs` on the map pins to
`big` and `huge` on Settings. The delete pin was 36px tall beside two 30px
siblings because of it. Passing the parameter default through would have fixed
the bug by breaking everything else -- every APIButton naming no size would have
grown from `sm` to `md` -- so the default is undefined now and Button's own
default stands. Eight buttons on three other pages do grow as a result, which is
their call sites finally being honoured: VideoPlayer's `large`, one of Channels'
`big`, and Settings' two `big` and two `huge`.
An icon-only Button was not square. A Button is as wide as its content plus its
horizontal padding; an ActionIcon is square by construction; and the pin row
mixes the two, because AddToPlaylistButton renders an IconButton when it has no
label. Their heights already agreed -- ActionIcon's scale was remapped onto
Button's some commits ago -- and this is the other axis of the same alignment,
keyed off Mantine's own `--button-height` so the two stay in step through every
size.
They were also misaligned and touching, which is a third thing: bare inline-block
siblings align on text BASELINES, and a Button's baseline is not an ActionIcon's,
so the middle control sat 4.3px above the other two. A Group, as every other row
of buttons in the app uses.
Written test-first at Roland's request. Seven cypress cases went red on the
sizes -- widths 46 against 30, 54 against 36, 62 against 42, 70 against 50, and
"xs is shorter than lg: expected 36 to be below 32" for the dropped size -- with
both inverses green throughout: a labelled button stays as wide as its label, and
an APIButton naming no size keeps the height it had.
The alignment claim is measured in ui-layout.cy.js, including the premise that
bare siblings really are misaligned, since three controls of identical height not
lining up is not believable otherwise. The call sites are held by a source
guard, because MapPins fetches from the API and builds its rows through
SortableTable.
That guard earned itself twice over. Written for the pin rows, it found the
map-files subscribe cell putting a preview button beside a subscribe button with
the same defect. Then a first attempt at a general "any cell with two controls"
rule had to be abandoned: a cell whose buttons are the arms of a ternary renders
only one and needs no Group, and excluding ternaries to allow for that also
excluded the subscribe cell, whose `role={isSubscribed ? ... : ...}` says nothing
about how many controls it holds. Named cells with a stated scope beat a general
rule that quietly stops covering things.
Two slips of mine in that file, both caught by running it: `expect(value, message)`
is chai and throws in jest, and `onSave(pin.id, ...)` was not unique to the cell
it named -- the edit row's TextInput calls it from onKeyDown in a different cell,
so the check passed against the wrong one.
1132 jest / 64 suites, 243 in ui-layout.cy.js, clean npm run build. Confirmed
live: three 30x30 controls, vertical spread 0, 10px gaps.
2026-08-02 17:44:25 -06:00
|
|
|
<AddToPlaylistButton
|
|
|
|
|
size='xs'
|
|
|
|
|
icon='list'
|
|
|
|
|
content=''
|
|
|
|
|
url={{url: `/map?lat=${pin.lat}&lon=${pin.lon}&z=14`, title: pin.label}}
|
|
|
|
|
/>
|
|
|
|
|
<APIButton
|
|
|
|
|
size='xs'
|
|
|
|
|
role='danger'
|
|
|
|
|
icon='trash'
|
review: name the icon-only controls, and make two guards mean what they say
Acting on the review of #626. No bugs; one suggestion and three nits.
The map's icon-only controls had no accessible name. IconButton requires a
label by construction and AddToPlaylistButton supplies one, but the plain Button
and APIButton used for edit, delete and the catalog preview reached assistive tech
as unnamed buttons -- and my own Cypress fixtures carefully passed `aria-label`
on the same pattern while production did not, which is its own kind of tell. All
four are named now, and named with the row's subject rather than the verb alone:
"Delete Water tank", not "Delete", because a table of pins otherwise offers a
screen reader a column of identical buttons.
A source guard holds that: it scans for controls that carry an icon and no label
text, and reports any without an `aria-label`. Paired with a premise that it
found some, since a scanner matching nothing reads exactly like a clean file.
The Group guard asserted only that `<Group` appeared somewhere in the cell, which
would pass on an empty Group left beside the bare siblings it was meant to wrap.
It now checks that every control in the cell is inside the Group -- and the first
version of THAT was wrong too: it sliced from `<Group` to the end of the cell
rather than to `</Group>`, so controls after the closing tag still counted as
inside, and the empty-Group plant stayed green. Slicing between the tags makes
it fail.
Coverage the review asked for: the Semantic size names the call sites actually
use (`small`, `big`, `huge`) rather than only the Mantine ones, since the
translation step was untested on the exact spellings that were broken; icon-only
buttons stay square while loading, when the glyph is replaced by a spinner sized
from the button's height; and `iconAfter`-only squares as well as `icon`-only.
On the size passthrough, which was flagged as the highest-risk change outside the
map: the buttons that grow are Settings' Shutdown and Reboot (`huge`, to 60px),
Settings' Upgrade and Save and Channels' Save (`big`, to 50px), and VideoPlayer's
Refresh (`large`, to 50px). All six read as deliberate emphasis -- the two
biggest are the two destructive ones -- so they are left honoured rather than
re-broken at the call site. `size='small'` resolves to `sm`, which is what the
accidental default already was, so the detail pages do not move.
1134 jest / 64 suites, 246 in ui-layout.cy.js, clean npm run build.
2026-08-02 17:57:27 -06:00
|
|
|
aria-label={`Delete ${pin.label}`}
|
ui: the map pin buttons were three sizes for three reasons
Reported as "all different sizes", and the pin row's three actions measured
46x30, 30x30 and 54x36. Three causes.
APIButton dropped `size`. `useAPIButton` declared `size = 'medium'` as a
parameter and then never put it into the props it hands to Button, so every
APIButton in the app rendered at Mantine's default regardless of what its call
site asked for -- seventeen call sites pass one, from `xs` on the map pins to
`big` and `huge` on Settings. The delete pin was 36px tall beside two 30px
siblings because of it. Passing the parameter default through would have fixed
the bug by breaking everything else -- every APIButton naming no size would have
grown from `sm` to `md` -- so the default is undefined now and Button's own
default stands. Eight buttons on three other pages do grow as a result, which is
their call sites finally being honoured: VideoPlayer's `large`, one of Channels'
`big`, and Settings' two `big` and two `huge`.
An icon-only Button was not square. A Button is as wide as its content plus its
horizontal padding; an ActionIcon is square by construction; and the pin row
mixes the two, because AddToPlaylistButton renders an IconButton when it has no
label. Their heights already agreed -- ActionIcon's scale was remapped onto
Button's some commits ago -- and this is the other axis of the same alignment,
keyed off Mantine's own `--button-height` so the two stay in step through every
size.
They were also misaligned and touching, which is a third thing: bare inline-block
siblings align on text BASELINES, and a Button's baseline is not an ActionIcon's,
so the middle control sat 4.3px above the other two. A Group, as every other row
of buttons in the app uses.
Written test-first at Roland's request. Seven cypress cases went red on the
sizes -- widths 46 against 30, 54 against 36, 62 against 42, 70 against 50, and
"xs is shorter than lg: expected 36 to be below 32" for the dropped size -- with
both inverses green throughout: a labelled button stays as wide as its label, and
an APIButton naming no size keeps the height it had.
The alignment claim is measured in ui-layout.cy.js, including the premise that
bare siblings really are misaligned, since three controls of identical height not
lining up is not believable otherwise. The call sites are held by a source
guard, because MapPins fetches from the API and builds its rows through
SortableTable.
That guard earned itself twice over. Written for the pin rows, it found the
map-files subscribe cell putting a preview button beside a subscribe button with
the same defect. Then a first attempt at a general "any cell with two controls"
rule had to be abandoned: a cell whose buttons are the arms of a ternary renders
only one and needs no Group, and excluding ternaries to allow for that also
excluded the subscribe cell, whose `role={isSubscribed ? ... : ...}` says nothing
about how many controls it holds. Named cells with a stated scope beat a general
rule that quietly stops covering things.
Two slips of mine in that file, both caught by running it: `expect(value, message)`
is chai and throws in jest, and `onSave(pin.id, ...)` was not unique to the cell
it named -- the edit row's TextInput calls it from onKeyDown in a different cell,
so the check passed against the wrong one.
1132 jest / 64 suites, 243 in ui-layout.cy.js, clean npm run build. Confirmed
live: three 30x30 controls, vertical spread 0, 10px gaps.
2026-08-02 17:44:25 -06:00
|
|
|
confirmContent='Delete this pin?'
|
|
|
|
|
confirmButton='Delete'
|
|
|
|
|
onClick={() => handleDelete(pin.id)}
|
|
|
|
|
/>
|
|
|
|
|
</Group>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
2026-03-29 18:58:31 -06:00
|
|
|
};
|
2024-06-17 10:40:30 -06:00
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
// --- Mobile headers and row ---
|
|
|
|
|
const mobileHeaders = [
|
|
|
|
|
{key: 'color', text: '', sortBy: i => i.color},
|
|
|
|
|
{key: 'label', text: 'Label', sortBy: i => i.label.toLowerCase()},
|
|
|
|
|
{key: 'actions', text: '', sortBy: null},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const mobileRowFunc = (pin) => {
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
return <Table.Row key={pin.id}>
|
|
|
|
|
<Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
<div style={{
|
|
|
|
|
width: 16, height: 16, borderRadius: "50%",
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
background: pin.color || "red", border: "1px solid var(--border)",
|
2026-03-29 18:58:31 -06:00
|
|
|
}}/>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2026-03-29 18:58:31 -06:00
|
|
|
<a href="#" onClick={(e) => {e.preventDefault(); handleNavigate(pin);}}>
|
|
|
|
|
{pin.label}
|
|
|
|
|
</a>
|
ui: scale the whole interface by 10%, off the root font-size
The interface reads about 10% smaller than the pre-migration Semantic build, and the
drift is not one number. Measured on the QA Pi at 1280px, Semantic's headings were
h1 28 / h2 24 / h3 18 / h4 15 / h5 14 against our 26 / 21 / 17 / 14 / 13, and its video
card a fixed 290px with an 18px title against our 238px with a 13px one -- while our
BODY text and chrome went the other way, a 16px base against Semantic's 14 and 42px
buttons against 36. No per-component nudge reproduces what a user comparing the two
sees, which is the whole page at once.
Ten percent is not a fudge factor: our heading scale times 1.1 is 28.6 / 23.1 / 18.7 /
15.4 / 14.3, which is Semantic's scale to within a pixel at every step. Verified in
the browser -- those are the numbers it now renders.
`--ui-scale: 1.1` and `html { font-size: calc(100% * var(--ui-scale)) }`, with
everything that should grow written in rem:
- 102 lengths in ui.css, App.css and tokens.css converted, restricted by property:
font-size, padding, margin, gap, width/height, border-radius, offsets.
- Borders, outlines and shadows deliberately NOT converted. A hairline is a hairline
at any text size.
- 46 inline `fontSize` px values across 8 files. `em` values were left alone: they
already resolve against the parent.
- Ten inline-styled blocks in the library (Card's text block, Loading, Placeholder,
ColoredInput, Confirm's action row, CardGroup's gap) moved into ui.css, because an
inline px size cannot be reached by a scale or seen by a test.
- CardGroup converts its `minWidth` prop to rem, which is what returns a phone to one
card per row: as px the track ignored the scale, so a 430px screen fitted two 200px
cards where the old build fitted one 290px card.
Mantine needs nothing: its 644 size declarations are `calc(Xrem * var(--mantine-scale))`
and scale with the root. `theme.scale` must stay at 1 -- it exists to CANCEL a
customised root font-size, so setting it to 1.1 as well would leave Mantine's half of
the interface at the old size beside our larger text. A test pins that.
`zoom: 1.1` on the root was tried first and rejected. It works and it is one line, but
it scales at paint: every 1px hairline becomes 1.1px and softens on a 1x display, and
viewport units do not shrink to compensate, so `100vh` paints 110% of the screen -- a
95vw modal overflowed sideways and the CBZ viewer's fullscreen overflowed down. Rem
scales real lengths, keeps borders crisp, leaves viewport units alone, and preserves a
user's own browser font-size preference instead of overriding it.
A percentage rather than a px root size, for that last reason.
Five guards in themes/ui-scale.test.js, each planted against: the scale itself, that
every scalable declaration is rem, that borders are NOT, that no inline px font-size
survives anywhere including the gallery, and that Mantine's scale stays 1.
Also removes `.ui.modal.themed-confirm`, a dead Semantic-era rule and the source of the
one `95vw` that would have overflowed: `.ui.modal` no longer exists and nothing sets
that class.
Verified: 1141 tests / 65 suites; clean build; browser-checked at 1280px and at a 430px
phone; navbar single-row from 780 to 1800px; hairlines still 1px and no horizontal
overflow in all four themes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 14:45:08 -06:00
|
|
|
<div style={{fontSize: '0.6875rem', color: 'var(--muted)'}}>{pin.lat.toFixed(4)}, {pin.lon.toFixed(4)}</div>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
Add a Solar calculator (#778)
* Add a Solar calculator with offline NASA POWER data
Estimates a solar array's typical-year production from a location and the
panels; everything else has defaults under an optional "Fine-tune" section.
The model works from 12 monthly averages: Klein's average day per month, the
Erbs monthly diffuse fraction, Collares-Pereira & Rabl / Liu & Jordan hourly
split, HDKR transposition for fixed, single-axis and dual-axis arrays, then
PVWatts' ASHRAE incidence loss, SAPM cell temperature, DC power, system
losses and optional inverter. "Best for the year" and "Best for winter" sweep
the tilt.
Sunlight, diffuse, albedo and temperature come from NASA POWER's 2001-2020
climatology on a 1 degree grid, packed into app/public/data (3.1 MB, ~1 MB
gzipped) by scripts/build_solar_climatology.py and fetched only when the
calculator opens. Users can replace it with their own monthly values.
Every setting lives in the URL, with defaults left out, so the Share button
shares the whole configuration.
Against PVWatts v8 for a 1 kW fixed array: Phoenix +0.6%, Seattle +8.8%,
Anchorage +8.0% annually; these are recorded as tests.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Open the Solar calculator from the map, pins and current location
The map's right-click (or long-press) menu gains "Calculate Solar
Performance", and each saved pin a sun button; both open the calculator at
that location. A button beside Latitude fills in the browser's current
location. Locations are rounded to 4 decimals, and longitudes from a map
panned around the world are wrapped back to -180..180.
The map removed lat/lon/z from the URL when it closed, even after navigating
to another page, which stripped the calculator's location from its URL (and
from links shared with the Share button). It now only cleans up while the
URL is still a map page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Add off-grid sizing to the Solar calculator
A new "Off-grid sizing" tab sizes a battery system for the darkest month
from a list of devices (watts x hours per day):
- Battery bank for a number of days without sun, for LiFePO4 or lead-acid,
at 12, 24 or 48 V. Outdoor lead-acid is enlarged for the cold; outdoor
lithium warns against charging below 0 C.
- Panels needed, from the worst month's DC production per kW at the chosen
angle, with a button to apply the count. A PWM controller's loss (battery
voltage over the panel's Vmp) raises the count.
- Charge controller current, and the string voltage on the coldest morning
against the controller's limit, since cold panels exceed their rated Voc.
The coldest morning defaults to 25 C below the coldest monthly average.
All inputs live in the URL like the rest of the calculator.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bump wrolpi-help for the Solar calculator help page
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Credit NASA POWER as it asks, and say how the data was changed
- The calculator gains a "Data attribution" link under the location with
NASA POWER's requested acknowledgment, the data reference (Climatology API
v2.10.0, downloaded 2026/10/04), the CC BY 4.0 license, and how WROLPi
modified the data (rounded to one byte per value, temperature averaged
into 1 degree cells, interpolated between cells), which CC BY 4.0 requires.
- The build script writes the same text to solar-climatology.LICENSE.txt
beside the data, with the API version taken from NASA's responses and the
date the tiles were downloaded. A test keeps the page and file in step.
- Bumps wrolpi-help for the updated attribution in the help page.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: fix PWM sizing, Voc sign, unit switching and loading on review
- PWM usable power now uses the string's voltage (Vmp x panels in series),
delivers nothing when the charging voltage is at or above the string's Voc,
and falls off between Vmp and Voc. The "too little voltage" warning covers
PWM as well as MPPT. Previously two panels in series counted double, and a
panel that could not charge a 48 V bank counted as fully usable.
- A Voc temperature coefficient entered without its minus sign is treated as
negative, in the math, the URL and the input, so the cold-morning check
cannot be made too generous.
- Switching Fahrenheit on or off converts the entered temperatures instead
of reinterpreting them.
- While the sunlight data downloads, the off-grid tab shows a loader rather
than asking for a location, and holds the cold-morning verdict until the
site's temperatures are known or one has been entered.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: move the data attribution to the bottom of the page
The full NASA POWER acknowledgment, license and changes now sit in a small
"Data attribution" section at the end of the calculator, always visible,
instead of behind a link under the location. The source line under the
location points to it. Bumps wrolpi-help to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Solar: drop the data source line under the location
The attribution at the bottom of the page is enough. The line under the
location now only appears to report the data's state: loading, failed to
load, or replaced by the user's own values. Bumps wrolpi-help for the
refreshed screenshot.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 18:32:26 -06:00
|
|
|
<Group gap='xs' wrap='nowrap'>
|
|
|
|
|
{solarButton(pin)}
|
|
|
|
|
<APIButton
|
|
|
|
|
size='xs'
|
|
|
|
|
role='danger'
|
|
|
|
|
icon='trash'
|
|
|
|
|
aria-label={`Delete ${pin.label}`}
|
|
|
|
|
confirmContent='Delete this pin?'
|
|
|
|
|
confirmButton='Delete'
|
|
|
|
|
onClick={() => handleDelete(pin.id)}
|
|
|
|
|
/>
|
|
|
|
|
</Group>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
2026-03-29 18:58:31 -06:00
|
|
|
};
|
|
|
|
|
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
const emptyRow = <Table.Row>
|
|
|
|
|
<Table.Cell colSpan={5}>No pins. Right-click on the map to add one.</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
2026-03-29 18:58:31 -06:00
|
|
|
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
if (pins === undefined) {
|
|
|
|
|
return <ErrorMessage>Could not fetch map pins</ErrorMessage>;
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-29 18:58:31 -06:00
|
|
|
const lowerFilter = filter.toLowerCase();
|
app: map pins and subscriptions tables distinguish pending from empty (#732)
* app: map pins and subscriptions tables distinguish pending from empty
Both lists were initialised to [], which SortableTable renders as
"loaded and empty". The Pins tab therefore showed "No pins.
Right-click on the map to add one." until the pins arrived, and the
Manage tab's subscriptions table showed "No results" until the catalog
did. A non-OK response (the api helpers return undefined) or a thrown
request left the same messages up permanently.
Invariants now enforced and tested:
* null = pending, undefined = fetch failed, [] = confirmed empty, so
SortableTable shows its placeholder while pending and each empty
message appears only once the server confirmed the list is empty.
* A failed fetch renders an error in place of the table.
* Only the newest request for each list may write state, since edits,
deletes, subscribes and unsubscribes refetch while the mount request
may still be in flight.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* app: the regions preview waits for the catalog
"View All Regions" stayed enabled while the catalog was pending or
failed, and the modal received a fresh `catalog || []` on every
render. Its map effect depends on that array, and ManageMap
re-renders on every status poll, so an open preview tore its WebGL
map down and rebuilt it every three seconds, and a failed catalog was
previewed as zero regions over the error message.
The button is disabled until the catalog is an array, and the modal
is mounted only then, so it receives the state array itself.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-26 16:55:42 -06:00
|
|
|
// Pending (null) passes through so SortableTable shows its placeholder.
|
|
|
|
|
const filteredPins = lowerFilter && pins
|
2026-03-29 18:58:31 -06:00
|
|
|
? pins.filter(p =>
|
|
|
|
|
(p.label || '').toLowerCase().includes(lowerFilter) ||
|
|
|
|
|
`${p.lat.toFixed(4)}, ${p.lon.toFixed(4)}`.includes(lowerFilter)
|
|
|
|
|
)
|
|
|
|
|
: pins;
|
|
|
|
|
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
// A fragment for the same reason as ManageMap above. The filter carries no `marginBottom`
|
|
|
|
|
// either: it is a top-level block of the page, and the route's stack spaces it.
|
|
|
|
|
return <>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
<TextInput
|
|
|
|
|
leftSection={<Icon name='search'/>}
|
2026-03-29 18:58:31 -06:00
|
|
|
placeholder='Filter by label or coordinates...'
|
|
|
|
|
value={filter}
|
|
|
|
|
onChange={(e) => setFilter(e.target.value)}
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
style={{width: '100%'}}
|
2026-03-29 18:58:31 -06:00
|
|
|
/>
|
|
|
|
|
<Media at='mobile'>
|
|
|
|
|
<SortableTable
|
|
|
|
|
tableHeaders={mobileHeaders}
|
|
|
|
|
data={filteredPins}
|
|
|
|
|
rowFunc={mobileRowFunc}
|
|
|
|
|
rowKey='label'
|
|
|
|
|
defaultSortColumn='label'
|
|
|
|
|
emptyRow={emptyRow}
|
|
|
|
|
/>
|
|
|
|
|
</Media>
|
|
|
|
|
<Media greaterThanOrEqual='tablet'>
|
|
|
|
|
<SortableTable
|
|
|
|
|
tableHeaders={fullHeaders}
|
|
|
|
|
data={filteredPins}
|
|
|
|
|
rowFunc={fullRowFunc}
|
|
|
|
|
rowKey='label'
|
|
|
|
|
defaultSortColumn='label'
|
|
|
|
|
emptyRow={emptyRow}
|
|
|
|
|
/>
|
|
|
|
|
</Media>
|
A fallout simulator on the map: nuclear mode, targets, live winds aloft (#1007)
* A fallout model, checked against six Nevada tests
The local fallout of a surface burst lands where layered winds carry particles of every size
from the stabilized cloud. Cloud and particle sizes come from DNAF-1, WSEG-10 and DELFIC;
the air is the 1976 standard atmosphere. The six shots' wind profiles, measured contour
areas and plume bearings are in nts-shots.json with their sources, alongside HPAC's
predictions of the same contours.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A prototype fallout panel on the map
Right-click "Simulate Fallout Here" draws the dose rate at H+1 of one surface burst, in one
wind or in the winds aloft of one of the six Nevada tests. Nothing is saved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout lands where it meets the ground
A particle stops falling at the first level where it is at or below the ground under it, not
at a plane at the height of ground zero: early on a ridge in its way, later in a valley. The
map panel reads the ground from the terrain files the user has downloaded; the Nevada tests
are checked against a small elevation grid of Mapterhorn terrain, as WROLPi publishes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout falls from the cloud's cap, skirt and stem
The cloud of a surface burst holds 77.5% of its activity in the cap, 15% in a skirt below it
and 7.5% in the stem (Philippe et al.); the stem starts as narrow as the early fireball at the
ground and widens up to the cap (DNAF-1). More of the fallout lands near ground zero: a 1 Mt
burst now draws a 1000 R/hr contour.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Close-in fallout measured after three Nevada surface bursts
Jangle Sugar, Small Boy and Johnie Boy, from DNAF-1's Table 3: the area, hotline length and
azimuth of each contour from 35 to 1000 R/hr, as observed and as DNAF-1, DELFIC and WSEG-10
predicted them, with each shot's winds. The deposition grid can look closely at part of the
fallout, and measures hotlines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout rises with the cloud, and heavy particles drop out low
All of the activity starts in the early fireball and rises with the cloud, whose base and top
climb with the square root of time (SIMFIC). Each particle rises with the air less its own
settling speed, so a heavy one leaves the cloud low and early and lands near ground zero, and a
light one rides to the top. A burst above the ground puts down less, by its scaled height.
Against the close-in fallout of Jangle Sugar and Small Boy this is within 2.4x in area and 1.7x
in hotline length (it was 100x short); across the six Nevada tests, 4.2x a priori (it was 8.9x).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel offers the weapons in service today
Weapons deployed or stockpiled by each country, each with its yield quoted from the 2025-2026
Nuclear Notebook or SIPRI Yearbook, and the improvised devices FEMA plans for; no retired or
historical weapons, and none whose yield no source gives. Variable-yield weapons have one entry
for each published setting. Fission shares are not public; they are assumed as Glasstone and
Dolan plan for, and the user may change them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's dropdowns open above it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A variable-yield weapon is named once, with each setting's yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel uses the forecast winds aloft
WROLPi fetches, on request, Open-Meteo's hourly forecast of the wind at nineteen pressure levels
(about 100 m to 24 km) and the rain, for the whole degree around the burst: the place is rounded
before it is sent. The forecast is kept, so the panel can use it offline. The panel picks the
hour nearest now, gives the forecast's age, and warns of rain, which brings fallout down in places
the map does not show.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A nuclear mode on the map: targets, and fallout
A radiation button under the print button turns nuclear mode on and off. In it, targets (likely
detonation sites) are shown alongside the pins, a pin added is saved as a target, and fallout can
be simulated at a target or anywhere on the map. A pin's kind is kept in map_pins.yaml; a pin
without one is a plain pin, as every pin was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets keep their weapon, and nuclear mode shows the fallout of all of them
A target keeps the weapon chosen for it (or a yield of the user's own) and its fission share in
map_pins.yaml. Nuclear mode opens on the fallout of every saved target at once, in the forecast
winds aloft fetched most recently; a burst tried out from the map can be saved as a target.
A whole-degree latitude or longitude, which a browser sends as an integer, is a valid pin, and a
pin's label and color may be left out of an update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* An improvised device is named once, with each yield beside it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout of many targets is calculated in seconds, and shown as it goes
A particle size's settling speed is read from a table by altitude rather than solved again for
every fall of every burst (a burst: 40 ms to 6 ms). The view yields to the page only every 40 ms,
through a message channel, which a browser does not hold back in a hidden tab as it does timers;
it says how far it has got, and draws the fallout on flat ground while the terrain is read.
A target in the list shows its weapon, and is given a weapon picker when asked; one picker sets
every target's weapon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout grid covers where fallout shows, not past the poles
The faintest particles of a burst are carried thousands of km in two days; with many targets the
grid stretched past 90 degrees and the map refused the image ("Invalid LngLat latitude"). The grid
now covers the spots which can reach the faintest band drawn, the image's corners stay within
Web Mercator's 85 degrees, and so does the area whose terrain is read.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout across a continent is drawn where it lands
The map stretches an image evenly in Web Mercator between its corners, but the fallout grid's rows
are evenly apart in latitude; over tens of degrees (targets across a country) they part ways, and
the southern part of the image was drawn far from its targets. Each image row now takes the grid
row at its own latitude. A burst far from the first target keeps its plume as wide, east to west,
as at its own latitude.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Terrain across the antimeridian, and ground with no number, do not break the fallout
Targets in Alaska and Hawaii carry fallout west of 180 degrees, where the terrain's tile arithmetic
read past the tile's pixels; one sample with no number made every target's lowest ground NaN and
every spot fall off the map, and the grid's size Infinity. Longitudes wrap, a sample with no number
is left out (of the lowest ground, and of the elevation between samples), and a spot not on the map
is left out of the grid rather than breaking it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Every target's weapon is set in one change
Setting it target by target, eight at once, lost most of the changes: each request wrote the whole
pin list, undoing the others (QA: 47 of 156 changed). PUT /api/map/pins/targets/weapon gives
every target the weapon in one change of the config.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The every-target weapon picker starts empty and always applies
It showed the first target's weapon, so choosing that weapon for all of them did nothing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Fallout is carried by the winds where it is, region by region
A field of forecasts on a grid over the targets replaces the one forecast for
all of them. Each particle rises and falls through the wind at its place,
height and hour, read between the surrounding grid points, hours and heights.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The winds aloft are fetched as a Job, ninety places a minute
The free forecast service allows 600 calls a minute and a place costs six, so
a field of up to 540 points is fetched in paced batches by a Job, which the
fallout panel follows, instead of inside one request.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* A small burst's hot fallout is kept on a grid over many, and the panel says what it shows
- Each burst's narrow close-in fallout is also put on a fine grid, so the
lethal zone of a small target is not averaged away in the cells kilometers
wide of a grid over targets far apart.
- The legend says the dose rate is as at one hour, with all the fallout down,
and what R/hr is; the error quoted is the unscaled model's.
- The TNA's yield is 150 kt: its source gives only an upper bound below 300.
- Weapons show their fission share beside their yield.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout can be watched landing, hour by hour
A timeline under the legend plays, or steps through, the 48 hours after the
bursts: each hour shows only the fallout which has landed by then, at its
dose rate then (t^-1.2 from H+1), on the same cells as the whole of it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The map can show the total dose of someone outdoors, hour by hour
A "Show" picker switches from the dose rate to the total dose (R) someone
outdoors gets from when the fallout arrives: t^-1.2 added up from each spot's
arrival to the hour on the timeline, or over the first two weeks. Its bands
say what each dose does to a person.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against the Army's fallout manuals
- FM 3-3-1's worked decay and dose problems are tests.
- FM 3-11.3's cloud and Zone I nomograms, read from their images, are a
fixture; the model's cloud top is within 10% of them from 1 kt to 10 Mt,
and its Zone I within 0.7-1.7 times from 10 kt to 1 Mt, the yields of
modern weapons, which the test shots do not reach.
- The legend says real fallout may decay faster or slower than usual.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The model is checked against two megaton bursts in the Pacific
Redwing Zuni (3.5 Mt), whose winds were measured above its cloud: the hot
fallout goes where it went and about as far. Castle Bravo (15 Mt), whose
winds were measured only below its cloud: its fallout arrives when it did,
and its hot fallout reaching a third as far is kept in view as a known gap.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Winds are read from the right points at every spacing, and cover the landing
- A field's points were filed by rounding (lat + 90) / spacing but looked up
by flooring it: at 4 and 8 degrees, which do not divide 90, every point read
half its neighbor's wind. Both now count whole spacings from the equator.
- The forecast starts at midnight UTC, so two days could end before the
fallout of a burst this hour was down; three are fetched (the same call
weight), and the panel says when the last hour's winds are held.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Bravo's known gap is not its unmeasured upper winds
Reanalysis winds above the 1954 sounding turn the plume to within 10 degrees
of the measured one but do not lengthen its hot contours; the fixture's caveat
and the test's explanation said otherwise, and now say what was found.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Rain takes fallout out of the air where it falls
A falling particle in rain loses a share of its activity every step: fast
inside the rain cloud ("rainout"), slower below it, by how hard it rains
("washout"), at Glasstone and Dolan's rates (Tables 9.74a and b), and none
above it. What is taken out comes down where the particle was. The forecast
now asks for relative humidity at 14 levels, and each hour's rain cloud is
taken as HYSPLIT takes it: from the lowest level 80% humid to the first above
it less than 60%.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* With no forecast, the fallout of 30 past days of the month
- wrolpi/scripts/build_fallout_climatology.py builds, from NOAA's reanalysis,
the winds aloft of 30 days of each month (one from each year 1991-2020) over
the whole world: a gzip file a month, about 4 MB, for the release download
location.
- WROLPi fetches the months it lacks once, while there is the Internet, each
checked against a sha256 pinned in modules/map/climatology.py (none pinned
until the files are published), and serves them to the panel.
- The panel's "Past days of a month" wind runs the bursts in each day and shows
on what share of the days each place had the chosen dose rate; it is chosen
for us when there is no forecast, or it has run out.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology's months are published, and their sha256 pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The climatology worker waits for the Internet and the drive on startup
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Counting the past days says flat ground at once, not the forecast's terrain
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout reuses each yield's paths, about 10 times faster
On flat ground in a day's held winds, how each parcel rises with the cloud
and falls does not depend on the wind, so it is worked out once per yield
and kept for every burst and day. The rising cloud is carried by the winds
over ground zero (it drifts about 10 km); the fall still reads the winds
where the particle is. A field of one hour is read without its hours, and
the nearest point to a cell past the field is kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rising cloud reads the winds over ground zero from arrays, by level
Each parcel's rise is kept as the levels of the column it passes through
(steps in the same level as one) and their seconds, so a burst reads the
column once and sums.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel shows a progress bar while it calculates
At the top of the panel, filled as far as the bursts are done, or moving
without a count until there is one. A calculation stopped by removing the
last target no longer leaves the panel busy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Past days' fallout runs in Web Workers, with a Cancel button
The days are spread over workers, one for each core but one (left for the
page), at most 6, and at most 2 where the browser says it has 2 GB or less.
A worker is given the next day as it finishes one, and sends back only the
cells reached. Where workers cannot be made, or fail, the days are
calculated on the page as before.
The days are counted on cells as wide as the coarsest day's grid, so the
count does not depend on which day finishes first.
Cancel, beside the progress bar, stops a calculation (and its workers) at
once; Calculate starts it again.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's bursts are spread over Web Workers too
The workers now take any task: a past day, or a burst. The page and the
workers build each burst's winds and terrain with the same functions
(work.js), so the fallout is the same either way; the flat pass and the
terrain pass each run on their own workers, and Cancel stops them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The bursts' grid is made in parts by the Web Workers
The grid is a sum over the bursts' spots, sharpened by the most any burst
raises a cell, so it is made in a fixed number of parts (a burst's spots
in one) on one frame, and joined on the page. The page makes the same
parts when there are no workers, so the grid is the same either way.
The forecast's warnings (bursts outside the winds, rain) are no longer
worked out again on every progress update.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast's hours are labeled once an hour, not on every progress update
Writing each hour's label (toLocaleString) took most of the page's time
while the workers calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Faster forecast fallout: the nearest point outside the field, progress, and what workers are sent
- Outside the forecast's field, the nearest point is looked for only
among the points which can be nearest somewhere in the grid cell (kept
for each cell); the same point as looking through them all. Longitudes
are wrapped however far round the world a particle is carried.
- The progress is shown at most ten times a second.
- The workers are sent the forecast's arrays, not the forecast as fetched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel in steps: the targets, then the fallout hour by hour or in total
Nuclear mode opens on the targets; nothing is calculated until the user goes on.
The winds and terrain wait under Options, with what is used said beside it.
The timeline runs from the first hour to two weeks, saying how much the fallout
has weakened since H+1; the view of all the fallout as if landed at H+1 is gone.
Going back and on again with nothing changed draws what was calculated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's winds: the forecast, past days, or one wind; no test shots' winds
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is a step of its own, between the targets and the fallout
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel says it is an estimate; how it compares with the test bursts goes in the help
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Targets are tried out until saved; the saved ones are loaded first, and saved all at once
Nuclear mode starts with no targets. Targets added are tried out, and the saved
targets join them when the user loads them. Saving replaces the saved targets
with the list, in one change, and is refused until they were loaded (or there are
none), so none are lost unseen. A target can be taken out of the list. The
burst tried out from the map's menu is gone: a target tried out does the same.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Nuclear targets are kept in their own config, map_nuclear.yaml, and listed apart from the pins
The pins are plain pins again. The targets have their own endpoints, and their
own table on the Pins tab, where one can be deleted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The rest of keeping nuclear targets in map_nuclear.yaml: the config, its endpoints, and the table
The commit before this one was missing these files.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's wind is the forecast when it has the winds until the fallout is down, else one wind
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The weather is a subscription: a forecast around the saved targets, downloaded every day
The Open-Meteo fetch is a recurring Download (daily) instead of a Job the panel
starts. The Manage tab has a Weather section: turning it on or off, what it
downloads, how its downloads went, and the forecast kept. Only the newest
forecast is kept, and it covers four days. The wind step asks the user to turn
the download on, and warns, there and beside the fallout, when the forecast runs
out before the fallout is down.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The forecast service may take three minutes to answer, and a timeout says so
A batch of four days' forecasts took 43 seconds, near the old 60-second limit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* The fallout panel's targets step has an Add a target button: the next click on the map places it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:01:13 -07:00
|
|
|
<MapTargets filter={lowerFilter}/>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The saved nuclear targets (map_nuclear.yaml), apart from the pins: what each is and where, and
|
|
|
|
|
// deleting one. `filter` (lower case) matches a name or coordinates.
|
|
|
|
|
export function MapTargets({filter = ''}) {
|
|
|
|
|
// null = pending, undefined = fetch failed, [] = no targets.
|
|
|
|
|
const [targets, setTargets] = useState(null);
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const gen = useRef(0);
|
|
|
|
|
|
|
|
|
|
const fetchTargets = async () => {
|
|
|
|
|
const mine = ++gen.current;
|
|
|
|
|
const saved = await getMapTargets();
|
|
|
|
|
if (mine === gen.current) setTargets(saved);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
fetchTargets();
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const handleDelete = async (targetId) => {
|
|
|
|
|
await deleteMapTarget(targetId);
|
|
|
|
|
await fetchTargets();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const weaponOf = (target) => {
|
|
|
|
|
const chosen = targetWeapon(target);
|
|
|
|
|
return `${chosen.weapon ? chosen.weapon.name : 'A yield of my own'}, `
|
|
|
|
|
+ formatYieldAndFission(chosen.yieldKt, chosen.fissionFraction);
|
|
|
|
|
};
|
|
|
|
|
const place = (target) => {
|
|
|
|
|
const to = `/map?lat=${target.lat}&lon=${target.lon}&z=10`;
|
|
|
|
|
return <a href={to} onClick={(e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
navigate(to);
|
|
|
|
|
}}>{target.lat.toFixed(4)}, {target.lon.toFixed(4)}</a>;
|
|
|
|
|
};
|
|
|
|
|
const deleteButton = (target) => <APIButton
|
|
|
|
|
size='xs'
|
|
|
|
|
role='danger'
|
|
|
|
|
icon='trash'
|
|
|
|
|
aria-label={`Delete ${target.label}`}
|
|
|
|
|
confirmContent='Delete this target?'
|
|
|
|
|
confirmButton='Delete'
|
|
|
|
|
onClick={() => handleDelete(target.id)}
|
|
|
|
|
/>;
|
|
|
|
|
|
|
|
|
|
const fullHeaders = [
|
|
|
|
|
{key: 'label', text: 'Target', sortBy: i => i.label.toLowerCase()},
|
|
|
|
|
{key: 'weapon', text: 'Weapon', sortBy: i => targetWeapon(i).yieldKt},
|
|
|
|
|
{key: 'coords', text: 'Coordinates', sortBy: i => i.lat},
|
|
|
|
|
{key: 'created', text: 'Created', sortBy: i => i.created},
|
|
|
|
|
{key: 'actions', text: '', sortBy: null},
|
|
|
|
|
];
|
|
|
|
|
const fullRowFunc = (target) => <Table.Row key={target.id}>
|
|
|
|
|
<Table.Cell><span aria-hidden>☢ </span>{target.label}</Table.Cell>
|
|
|
|
|
<Table.Cell>{weaponOf(target)}</Table.Cell>
|
|
|
|
|
<Table.Cell>{place(target)}</Table.Cell>
|
|
|
|
|
<Table.Cell>{target.created}</Table.Cell>
|
|
|
|
|
<Table.Cell>{deleteButton(target)}</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
|
|
|
|
|
|
|
|
|
const mobileHeaders = [
|
|
|
|
|
{key: 'label', text: 'Target', sortBy: i => i.label.toLowerCase()},
|
|
|
|
|
{key: 'actions', text: '', sortBy: null},
|
|
|
|
|
];
|
|
|
|
|
const mobileRowFunc = (target) => <Table.Row key={target.id}>
|
|
|
|
|
<Table.Cell>
|
|
|
|
|
<span aria-hidden>☢ </span>{target.label}
|
|
|
|
|
<div style={{fontSize: '0.6875rem', color: 'var(--muted)'}}>{weaponOf(target)}</div>
|
|
|
|
|
<div style={{fontSize: '0.6875rem'}}>{place(target)}</div>
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{deleteButton(target)}</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
|
|
|
|
|
|
|
|
|
const emptyRow = <Table.Row>
|
|
|
|
|
<Table.Cell colSpan={5}>No targets. Turn on nuclear mode (☢) on the map to add and save some.</Table.Cell>
|
|
|
|
|
</Table.Row>;
|
|
|
|
|
|
|
|
|
|
const shown = filter && targets
|
|
|
|
|
? targets.filter(t => (t.label || '').toLowerCase().includes(filter) ||
|
|
|
|
|
`${t.lat.toFixed(4)}, ${t.lon.toFixed(4)}`.includes(filter))
|
|
|
|
|
: targets;
|
|
|
|
|
return <>
|
|
|
|
|
<Header as='h3'>Nuclear Targets</Header>
|
|
|
|
|
{targets === undefined ? <ErrorMessage>Could not fetch the nuclear targets</ErrorMessage> : <>
|
|
|
|
|
<Media at='mobile'>
|
|
|
|
|
<SortableTable tableHeaders={mobileHeaders} data={shown} rowFunc={mobileRowFunc} rowKey='id'
|
|
|
|
|
defaultSortColumn='label' emptyRow={emptyRow}/>
|
|
|
|
|
</Media>
|
|
|
|
|
<Media greaterThanOrEqual='tablet'>
|
|
|
|
|
<SortableTable tableHeaders={fullHeaders} data={shown} rowFunc={fullRowFunc} rowKey='id'
|
|
|
|
|
defaultSortColumn='label' emptyRow={emptyRow}/>
|
|
|
|
|
</Media>
|
|
|
|
|
</>}
|
review: finish the sweep the first pass claimed
The review was right that completeness was not done. Every finding held up.
Three more pages mounted a `PageContainer` inside a route that already
provides page chrome -- `ManageMap`, `MapPins`, `ManageZim` -- so they sat a
further 1em down and 1em in from the tab bar than the viewers beside them.
The same defect as ArchiveSettings, in a shape the scan could not see: it
keyed on `PageContainer` route wrappers, and Map and Zim wrap their content
in a `wrolpi-stack` div instead. It now locates routers first and asks
whether the enclosing return provides chrome either way, resolves
`element={<ErrorBoundary><Page/></ErrorBoundary>}` as well as the bare form,
and knows about `class` components -- `ManageZim` is one, and a scan that
only knew functions reported it clean.
Five top-level blocks still added their own margin to the stack's gap: the
dashboard search row (52.8px against 17.6px, on the most-looked-at page in
the app), the Playlists filter row, both Docs filter rows, and the Map pins
filter. The extension page's hint panel had the same compound against a
Mantine Stack's gap.
ControllerPage held its four panel sections in a plain wrapper, so the
admin page's stack saw one child and the panels kept sharing edges -- the
exact hole Settings had.
The dashboard was reported clean in the first pass and was not. The sweep
measured wrapper-to-wrapper gaps, and that row's margin is INSIDE a Media
wrapper, so it never appeared: the measurement, not the page, was at fault.
Cypress gap assertions now derive from the stack's own `row-gap` instead of a
12-28px range that assumed the default interface scale and would have
false-failed a correct layout at a larger one.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:09:12 -06:00
|
|
|
</>;
|
2026-03-29 18:58:31 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function MapPage() {
|
|
|
|
|
return <MapViewer/>;
|
2022-03-08 13:26:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function MapRoute() {
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle('Map');
|
|
|
|
|
|
2022-03-08 13:26:03 -07:00
|
|
|
const links = [
|
2022-08-06 05:22:07 +00:00
|
|
|
{text: 'Map', to: '/map', key: 'map', end: true},
|
2026-03-29 18:58:31 -06:00
|
|
|
{text: 'Pins', to: '/map/pins', key: 'pins'},
|
Map tiles for ATAK and iTAK (#1024)
* Map tiles for ATAK and iTAK
A new service, wrolpi-tiles (tiles/), draws WROLPi's map as 256 px raster
tiles from the map's PMTiles with MapLibre Native (mapli), so ATAK and iTAK
can use the map as a map source, and ATAK can download an area of it.
- Tiles are drawn in blocks of 4x4 (ATAK asks for tiles in quadtree order),
each block once however many requests wait on it, in render processes of
their own. Phones are served in turn.
- A tile is always a 200: blank where there is no map, or when it was not
drawn before ATAK's 5 second timeout. Five failed tiles in a row stop an
ATAK download, and a 401/403 stops the map source.
- Drawn tiles are kept in /var/cache/wrolpi-tiles, with a size cap and a
free-space floor; JPEG, about a seventh of a PNG.
- The basemap is the web map's (protomaps-themes-base, light), kept equal
to it by a Jest test. Unreadable map files and missing map fonts are
left out rather than failing every tile.
- Caddy serves it at /tiles/ over HTTPS and on port 8088 over plain HTTP
(a phone must trust WROLPi's CA for HTTPS). /tiles/wrolpi.xml is the
MOBAC map source to import.
- A separate service with lower CPU priority and a memory cap, so a phone
downloading an area cannot slow the API. Docker runs it from the api
image.
- The map page has an ATAK tab: the map source links, how to use them, and
what the tile service is doing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: bound PMTiles decompression before it happens
A few bytes of a downloaded map file could decompress to far more than the
cap, which was applied only afterwards. Decompress at most MAX_METADATA_SIZE,
as modules.map.pmtiles does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: never send a blank for a late tile; start render processes with the service
QA on a Pi 4 found the first tile after a start sent blank: starting the
render processes and the first draw took 4.5 s, past the deadline. A
downloader (ATAK's, iTAK's) keeps whatever a tile request returns, so a
blank sent for a late or failed tile is a hole in its offline map for
good. Such a tile is now a 503 (ATAK tries each tile twice; only 401 and
403 stop a map source), and the render processes start with the service.
Also:
- OOMScoreAdjust=500: Raspberry Pi OS disables the memory cgroup, so
MemoryMax does nothing there; the tile service is killed before the API.
- sanic-ext's auto extensions are off in the tile service.
- The map's ATAK tab is before Manage: Manage is the last tab.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: put backgroundColor back in the map source; iTAK requires it
iTAK refuses a MOBAC map source without <backgroundColor> ("The data couldn't
be read because it is missing"). ATAK ignores it. It is the map's own
background color.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: leave out the map files hidden on the Manage tab, as the web map does
maps.yaml's ignored_files names the map files the user hid; the web map
does not draw them, and the tiles drew them anyway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: bound the render processes' memory and the tiles-per-second times
QA on a Pi 4, a phone taking 123,000 tiles offline: each render process
grew from about 270 MB to 370 MB (MapLibre keeps what it has read and
drawn) and did not shrink when idle. A render process is now replaced
after 2,000 blocks. The serve times behind tiles-per-second were only
forgotten when the status was asked for; they are forgotten as tiles are
served.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Map ATAK tab: iTAK takes an area offline too
An iPhone downloaded 123,000 tiles with iTAK and showed them offline with
none missing; the tab said only ATAK could.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Map ATAK tab: a button to clear the tiles the tile service keeps
POST /tiles/cache/clear on the tile service (which keeps the cache's size)
removes the kept tiles; they are drawn again when next asked for. The
button asks first, and says that maps already downloaded to phones are not
changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: measure the cache as the disk does; clear it at once, delete in the background
QA on a Pi 4 after a 123,000-tile download: the cache counted 375 MB of tile
bytes while its files took 660 MB of the SD card (each small file takes a
whole 4 KiB block), so the 1 GB cap allowed about 1.7 GB. The cache is now
measured in disk blocks.
Clearing deleted 128,000 files in the request: about 40 seconds, with the
Pi's load warning on. A clear (or a new style) now renames the tiles out of
the way at once and deletes them in a lowest-priority thread, pausing every
500 files; a deletion cut short is finished at the next start. A tile drawn
again no longer counts twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Help: ATAK and iTAK
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: a page on port 8088 saying what it is
A person who finds port 8088 got a 404. / (and /tiles/) is now a short page:
WROLPi's map tile service for ATAK and iTAK, the map source to open on a
phone, and links to the WROLPi app and the map's ATAK tab, made from the
address the page was reached by (Docker publishes the app on
TILES_HTTPS_PORT). Port 8088 serves WROLPi's icon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: review fixes
- Caddy: a tile request is never redirected to the fallback page when the
tile service is down or restarting (handle_errors on 443). ATAK keeps
whatever a tile request ends with, so the page was stored as the tile;
it is now a 503 with Retry-After, which ATAK tries again.
- The cache's oldest tiles are found and deleted in a lowest-priority
thread, pausing as it goes, not in the tile request which filled it.
- ATAK tab: only the newest status request writes the status, so a slow
answer can not undo a newer one (or a clear). It says when the page was
opened on localhost and the addresses work only there, and names each
map source as the app lists it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 11:21:27 -07:00
|
|
|
// Manage (and Statistics, on pages which have one) are the last tabs.
|
|
|
|
|
{text: 'ATAK', to: '/map/atak', key: 'atak'},
|
2022-08-06 05:22:07 +00:00
|
|
|
{text: 'Manage', to: '/map/manage', key: 'manage'},
|
2022-03-08 13:26:03 -07:00
|
|
|
];
|
|
|
|
|
|
ui: pages own the space between their blocks
Panels shared edges: two 1px borders meeting, which reads as one tall
surface with a rule across it rather than a seam between two.
Done as `margin-bottom` on the panel first, which is the anti-pattern, and
it failed in both of the ways that rule is known to fail before the reading
was done. It compounded with the gap of every Stack that already held
panels -- four of them, spacing those lists at 35.2px against the app's
17.6px -- and the `:last-child` reset meant to keep trailing space off the
bottom of a container silently did nothing, because Media wrapping makes a
panel the only child of its own wrapper. On Status that separated four
pairs out of five and left the first touching.
So the space belongs to whatever stacks the blocks. `.wrolpi-stack` is on
PageContainer, which every page uses, and on the three wrappers that stack
blocks somewhere the page's own stack cannot reach: Settings' panel wrapper,
the block below the video player, and the Zim and Map route wrappers, which
hold their tab bar outside PageContainer.
A gap rather than `> * + * { margin-top }`, which was tried and is quietly
broken here: Media injects `.fresnel-container { margin: 0; padding: 0 }` at
runtime, same specificity, later source order, so every wrapped block threw
the margin away. A child cannot zero its parent's gap. It also means
Media's hidden half contributes nothing, where the owl selector spaced
around something invisible.
With the page owning the spacing, the blocks that owned some of it had to
give it up, or their margin was added to the gap: the tab bar (33px against
17.6 everywhere else), the shared search control bar and paginator on
Videos/Archives/Docs/Files, the card grid, the file browser's filter row and
the inventory search. Two margins deliberately stay -- the file browser's
4em, which reserves room for the sticky buttons (62645831), and heading
margins, which bind a heading to the content below it.
Tests plant each of the three failures: the wrapped block, a child that
zeroes its own margin, and a hidden Media half. Verified in the browser on
sixteen routes and in all four themes -- every stacked pair 17.6px, the
map's 85vh box and the video player unchanged, no horizontal overflow.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 15:40:27 -06:00
|
|
|
// `wrolpi-stack`: as in ZimRoute, this route wraps its own content instead of using
|
|
|
|
|
// PageContainer, so the spacing below the tab bar is this element's to provide.
|
|
|
|
|
return <div className='wrolpi-stack' style={{marginTop: '2em'}}>
|
2022-03-08 13:26:03 -07:00
|
|
|
<TabLinks links={links}/>
|
2022-08-06 05:22:07 +00:00
|
|
|
<Routes>
|
2023-07-21 15:14:09 -06:00
|
|
|
<Route path='/' exact element={<MapPage/>}/>
|
2026-03-29 18:58:31 -06:00
|
|
|
<Route path='pins' exact element={<MapPins/>}/>
|
Map tiles for ATAK and iTAK (#1024)
* Map tiles for ATAK and iTAK
A new service, wrolpi-tiles (tiles/), draws WROLPi's map as 256 px raster
tiles from the map's PMTiles with MapLibre Native (mapli), so ATAK and iTAK
can use the map as a map source, and ATAK can download an area of it.
- Tiles are drawn in blocks of 4x4 (ATAK asks for tiles in quadtree order),
each block once however many requests wait on it, in render processes of
their own. Phones are served in turn.
- A tile is always a 200: blank where there is no map, or when it was not
drawn before ATAK's 5 second timeout. Five failed tiles in a row stop an
ATAK download, and a 401/403 stops the map source.
- Drawn tiles are kept in /var/cache/wrolpi-tiles, with a size cap and a
free-space floor; JPEG, about a seventh of a PNG.
- The basemap is the web map's (protomaps-themes-base, light), kept equal
to it by a Jest test. Unreadable map files and missing map fonts are
left out rather than failing every tile.
- Caddy serves it at /tiles/ over HTTPS and on port 8088 over plain HTTP
(a phone must trust WROLPi's CA for HTTPS). /tiles/wrolpi.xml is the
MOBAC map source to import.
- A separate service with lower CPU priority and a memory cap, so a phone
downloading an area cannot slow the API. Docker runs it from the api
image.
- The map page has an ATAK tab: the map source links, how to use them, and
what the tile service is doing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: bound PMTiles decompression before it happens
A few bytes of a downloaded map file could decompress to far more than the
cap, which was applied only afterwards. Decompress at most MAX_METADATA_SIZE,
as modules.map.pmtiles does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: never send a blank for a late tile; start render processes with the service
QA on a Pi 4 found the first tile after a start sent blank: starting the
render processes and the first draw took 4.5 s, past the deadline. A
downloader (ATAK's, iTAK's) keeps whatever a tile request returns, so a
blank sent for a late or failed tile is a hole in its offline map for
good. Such a tile is now a 503 (ATAK tries each tile twice; only 401 and
403 stop a map source), and the render processes start with the service.
Also:
- OOMScoreAdjust=500: Raspberry Pi OS disables the memory cgroup, so
MemoryMax does nothing there; the tile service is killed before the API.
- sanic-ext's auto extensions are off in the tile service.
- The map's ATAK tab is before Manage: Manage is the last tab.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: put backgroundColor back in the map source; iTAK requires it
iTAK refuses a MOBAC map source without <backgroundColor> ("The data couldn't
be read because it is missing"). ATAK ignores it. It is the map's own
background color.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: leave out the map files hidden on the Manage tab, as the web map does
maps.yaml's ignored_files names the map files the user hid; the web map
does not draw them, and the tiles drew them anyway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: bound the render processes' memory and the tiles-per-second times
QA on a Pi 4, a phone taking 123,000 tiles offline: each render process
grew from about 270 MB to 370 MB (MapLibre keeps what it has read and
drawn) and did not shrink when idle. A render process is now replaced
after 2,000 blocks. The serve times behind tiles-per-second were only
forgotten when the status was asked for; they are forgotten as tiles are
served.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Map ATAK tab: iTAK takes an area offline too
An iPhone downloaded 123,000 tiles with iTAK and showed them offline with
none missing; the tab said only ATAK could.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Map ATAK tab: a button to clear the tiles the tile service keeps
POST /tiles/cache/clear on the tile service (which keeps the cache's size)
removes the kept tiles; they are drawn again when next asked for. The
button asks first, and says that maps already downloaded to phones are not
changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: measure the cache as the disk does; clear it at once, delete in the background
QA on a Pi 4 after a 123,000-tile download: the cache counted 375 MB of tile
bytes while its files took 660 MB of the SD card (each small file takes a
whole 4 KiB block), so the 1 GB cap allowed about 1.7 GB. The cache is now
measured in disk blocks.
Clearing deleted 128,000 files in the request: about 40 seconds, with the
Pi's load warning on. A clear (or a new style) now renames the tiles out of
the way at once and deletes them in a lowest-priority thread, pausing every
500 files; a deletion cut short is finished at the next start. A tile drawn
again no longer counts twice.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Help: ATAK and iTAK
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: a page on port 8088 saying what it is
A person who finds port 8088 got a 404. / (and /tiles/) is now a short page:
WROLPi's map tile service for ATAK and iTAK, the map source to open on a
phone, and links to the WROLPi app and the map's ATAK tab, made from the
address the page was reached by (Docker publishes the app on
TILES_HTTPS_PORT). Port 8088 serves WROLPi's icon.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Tiles: review fixes
- Caddy: a tile request is never redirected to the fallback page when the
tile service is down or restarting (handle_errors on 443). ATAK keeps
whatever a tile request ends with, so the page was stored as the tile;
it is now a 503 with Retry-After, which ATAK tries again.
- The cache's oldest tiles are found and deleted in a lowest-priority
thread, pausing as it goes, not in the tile request which filled it.
- ATAK tab: only the newest status request writes the status, so a slow
answer can not undo a newer one (or a clear). It says when the page was
opened on localhost and the addresses work only there, and names each
map source as the app lists it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 11:21:27 -07:00
|
|
|
<Route path='atak' exact element={<MapAtak/>}/>
|
2022-08-06 05:22:07 +00:00
|
|
|
<Route path='manage' exact element={<ManageMap/>}/>
|
|
|
|
|
</Routes>
|
2022-03-08 13:26:03 -07:00
|
|
|
</div>
|
ui: thirty-five files off Semantic, leaving fifteen
Phase 2, part 4. Baseline 50 -> 15.
Migrated: all eight calculators, the rest of inventory and collections, the
Map/Zim/Docs cluster, Videos, Files, Search, Archive, DashboardPage,
DatesSelector, HelpModal, Events, Tags, Flasher's neighbours, admin Settings
and Status, Download, and App.
Also the three shared modules everything imports: api.js and customHooks.js
swap the Semantic toast library for the library's shim (same call shape), and
useForm.js renders the library's Message. useForm accepts both the old
`{content, header, positive|negative}` shape and the new `{kind, title}`,
because the pages building those objects migrate separately.
Two library gaps closed, both found by call sites needing them:
ActionInput is a forwardRef now. Its ref reaches the input rather than the
wrapper, because callers use it to focus or select the field -- a ref to the
surrounding div would do neither, which is why one call site had resorted to
hand-copying the component's markup.
Header takes a `color` token name. Three separate call sites had reached for
an inline style to colour a heading that carries meaning ("3 items to add"
against "2 to remove"), which is how a hex ends up in markup.
Two files needed repair after being interrupted mid-edit: MapViewer had a
Segment left in its error branch, and VideoPlayer had lost the useContext
import its own code still used. Neither jest nor tsc noticed; only
`npm run build` did, which is the whole reason that check exists.
Fifteen files remain: Archive, BulkTagModal, Channels, Docs, FileBrowser,
FilePreview, Flasher, Nav, Playlists, Theme.tsx, Upload, VideoPlayer, Zim,
ControllerPage, admin/Downloads. Theme.tsx is deliberately last -- the
unmigrated files still import its Semantic-backed wrappers, so it can only go
once they have.
2026-07-30 12:21:30 -06:00
|
|
|
}
|