Skip to content

Commit 2ffae2d

Browse files
committed
Refine sidebar flow for sites, radio, and results
1 parent c508416 commit 2ffae2d

2 files changed

Lines changed: 25 additions & 78 deletions

File tree

src/components/Sidebar.tsx

Lines changed: 21 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ import {
3434
} from "../lib/meshtasticMqtt";
3535
import { deriveDynamicPropagationEnvironment } from "../lib/propagationEnvironment";
3636
import { analyzeLink } from "../lib/propagation";
37-
import { simulationAreaBoundsForSites } from "../lib/simulationArea";
3837
import { sampleSrtmElevation } from "../lib/srtm";
3938
import { PRIMARY_ATTRIBUTION, REMOTE_SRTM_ENDPOINTS } from "../lib/terrainCatalog";
4039
import { getUiErrorMessage } from "../lib/uiError";
41-
import { tilesForBounds } from "../lib/ve2dbeTerrainClient";
4240
import { useAppStore } from "../store/appStore";
4341
import type { CoverageMode, PropagationModel, RadioClimate } from "../types/radio";
4442
import { AuthSyncPanel } from "./AuthSyncPanel";
@@ -438,16 +436,6 @@ export function Sidebar() {
438436
siteSnapshots: getSnapshotCount(SITE_LIBRARY_KEY),
439437
simulationSnapshots: getSnapshotCount(SIM_PRESETS_KEY),
440438
}));
441-
const hasTwoSites = sites.length >= 2;
442-
const hasPathEndpoints = Boolean(fromSite && toSite && fromSite.id !== toSite.id);
443-
const hasTerrain = srtmTiles.length > 0;
444-
const terrainBounds = simulationAreaBoundsForSites(sites);
445-
const requiredTerrainTileKeys = terrainBounds
446-
? tilesForBounds(terrainBounds.minLat, terrainBounds.maxLat, terrainBounds.minLon, terrainBounds.maxLon)
447-
: [];
448-
const loadedTileKeys = new Set(srtmTiles.map((tile) => tile.key));
449-
const missingTerrainTileKeys = requiredTerrainTileKeys.filter((key) => !loadedTileKeys.has(key));
450-
const terrainIsStaleForCurrentArea = requiredTerrainTileKeys.length > 0 && missingTerrainTileKeys.length > 0;
451439
const hasLocalLibraryData = siteLibrary.length > 0 || simulationPresets.length > 0;
452440
const filteredSiteLibrary = useMemo(() => {
453441
const q = siteLibraryQuery.trim().toLowerCase();
@@ -1224,30 +1212,6 @@ export function Sidebar() {
12241212
</label>
12251213
</section>
12261214

1227-
<section className="panel-section section-scenario-status">
1228-
<details className="compact-details">
1229-
<summary>Scenario Status</summary>
1230-
<div className="asset-list">
1231-
<p className="field-help">{hasTwoSites ? `Sites: ${sites.length} configured` : "Sites: add at least 2"}</p>
1232-
<p className="field-help">
1233-
{hasPathEndpoints
1234-
? `Path: ${fromSite?.name ?? "?"}${toSite?.name ?? "?"}`
1235-
: "Path: choose different From/To nodes"}
1236-
</p>
1237-
<p className="field-help">
1238-
{terrainIsStaleForCurrentArea
1239-
? `Terrain: out of date (${missingTerrainTileKeys.length}/${requiredTerrainTileKeys.length} tiles missing for current area)`
1240-
: hasTerrain
1241-
? `Terrain: up to date (${srtmTiles.length} tile(s) loaded)`
1242-
: "Terrain: not loaded yet"}
1243-
</p>
1244-
{terrainBounds?.isCapped ? (
1245-
<p className="field-help">Area window capped to 5° span for performance.</p>
1246-
) : null}
1247-
</div>
1248-
</details>
1249-
</section>
1250-
12511215
<section className="panel-section section-sites">
12521216
<div className="section-heading">
12531217
<h2>Sites</h2>
@@ -1265,6 +1229,27 @@ export function Sidebar() {
12651229
) : null}
12661230
</div>
12671231
{!siteLibrary.length ? <p className="field-help">No saved library sites yet.</p> : null}
1232+
<p className="field-help">Current sites in this simulation:</p>
1233+
<div className="chip-group">
1234+
{sites.map((site) => (
1235+
<button
1236+
className={clsx("chip-button", selectedSiteId === site.id && "is-selected")}
1237+
key={site.id}
1238+
onClick={() => setSelectedSiteId(site.id)}
1239+
type="button"
1240+
>
1241+
{site.name}
1242+
</button>
1243+
))}
1244+
</div>
1245+
<button
1246+
className="inline-action"
1247+
disabled={sites.length <= 1}
1248+
onClick={() => deleteSite(selectedSite.id)}
1249+
type="button"
1250+
>
1251+
Remove Selected From Simulation
1252+
</button>
12681253
</section>
12691254

12701255
<section className="panel-section section-radio">
@@ -1603,32 +1588,6 @@ export function Sidebar() {
16031588
</ModalOverlay>
16041589
) : null}
16051590

1606-
<section className="panel-section section-sites-selected">
1607-
<details className="compact-details">
1608-
<summary>Site quick actions</summary>
1609-
<div className="chip-group">
1610-
{sites.map((site) => (
1611-
<button
1612-
className={clsx("chip-button", selectedSiteId === site.id && "is-selected")}
1613-
key={site.id}
1614-
onClick={() => setSelectedSiteId(site.id)}
1615-
type="button"
1616-
>
1617-
{site.name}
1618-
</button>
1619-
))}
1620-
</div>
1621-
<button
1622-
className="inline-action"
1623-
disabled={sites.length <= 1}
1624-
onClick={() => deleteSite(selectedSite.id)}
1625-
type="button"
1626-
>
1627-
Remove Selected From Simulation
1628-
</button>
1629-
</details>
1630-
</section>
1631-
16321591
<section className="panel-section section-data">
16331592
<details className="compact-details">
16341593
<summary>Terrain & Sources (Advanced)</summary>

src/index.css

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -224,32 +224,20 @@ input {
224224
order: 3;
225225
}
226226

227-
.sidebar-panel .section-results {
227+
.sidebar-panel .section-radio {
228228
order: 4;
229229
}
230230

231-
.sidebar-panel .section-scenario-status {
231+
.sidebar-panel .section-results {
232232
order: 5;
233233
}
234234

235-
.sidebar-panel .section-sites-selected {
236-
order: 6;
237-
}
238-
239-
.sidebar-panel .section-radio {
240-
order: 7;
241-
}
242-
243235
.sidebar-panel .section-data {
244-
order: 8;
236+
order: 6;
245237
}
246238

247239
.sidebar-panel .section-more {
248-
order: 9;
249-
}
250-
251-
.sidebar-panel .section-intro {
252-
order: 10;
240+
order: 7;
253241
}
254242

255243
.section-heading {

0 commit comments

Comments
 (0)