mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(fires): caption the confidence switch and name the slider "Fire intensity (FRP)"
The switch had no visible word saying what ALL / NOMINAL+ / HIGH refer to, and "Min FRP" assumed the reader knows the acronym. The segmented row descriptor gains an optional visible `label` (a caption above the group); the fires row uses "Confidence" and "Fire intensity (FRP)", and the slider value reads "≥ N MW" so the threshold is still clear. Locales updated. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
22a87500c6
commit
1dad6b658a
9 files changed
+70
-18
No files matched your search
@@ -104,8 +104,9 @@ export function syncSliderBlock(container, slider, { before = null } = {}) {
|
||||
* Buttons carry `data-chip-id` like chips so the row's delegated click handler
|
||||
* can resolve them; the caller matches `.data-toggle-segment`.
|
||||
*
|
||||
* Descriptor: `{ id, ariaLabel, options: [{ id, label, title, active,
|
||||
* disabled, params }] }`.
|
||||
* Descriptor: `{ id, label, ariaLabel, options: [{ id, label, title, active,
|
||||
* disabled, params }] }` — `label` is an optional visible caption above the
|
||||
* buttons (the group itself is a flex item, so the caption is a sibling).
|
||||
* @param {HTMLElement} container The row's `.data-toggle-controls` node.
|
||||
* @param {?object} segmented Descriptor, or null to remove the group.
|
||||
* @param {{before?: ?Node}} [options] Insertion anchor for a new group.
|
||||
@@ -121,19 +122,38 @@ export function syncSegmentedGroup(
|
||||
const existing = [...container.children].find(
|
||||
(node) => node.dataset?.segmentedId,
|
||||
);
|
||||
const existingCaption = [...container.children].find(
|
||||
(node) => node.dataset?.segmentedCaptionFor,
|
||||
);
|
||||
if (!segmented) {
|
||||
existing?.remove();
|
||||
existingCaption?.remove();
|
||||
return null;
|
||||
}
|
||||
let group = existing;
|
||||
if (!group || group.dataset.segmentedId !== segmented.id) {
|
||||
existing?.remove();
|
||||
existingCaption?.remove();
|
||||
group = document.createElement('div');
|
||||
group.className = 'gev-segmented data-toggle-segmented';
|
||||
group.dataset.segmentedId = segmented.id;
|
||||
group.setAttribute('role', 'radiogroup');
|
||||
container.insertBefore(group, before);
|
||||
}
|
||||
let caption = [...container.children].find(
|
||||
(node) => node.dataset?.segmentedCaptionFor === segmented.id,
|
||||
);
|
||||
if (segmented.label) {
|
||||
if (!caption) {
|
||||
caption = document.createElement('span');
|
||||
caption.className = 'data-toggle-segmented-label';
|
||||
caption.dataset.segmentedCaptionFor = segmented.id;
|
||||
container.insertBefore(caption, group);
|
||||
}
|
||||
set(caption, 'textContent', segmented.label);
|
||||
} else {
|
||||
caption?.remove();
|
||||
}
|
||||
if (segmented.ariaLabel) attribute(group, 'aria-label', segmented.ariaLabel);
|
||||
const stale = new Map();
|
||||
for (const node of [...group.children])
|
||||
|
||||
Reference in new issue
Block a user