diff --git a/ui/PLAN.md b/ui/PLAN.md index 1344ef5..2b6536a 100644 --- a/ui/PLAN.md +++ b/ui/PLAN.md @@ -2391,44 +2391,84 @@ Targeted tests: via the Research sub-row, delete it (`tests/e2e/sciences.spec.ts`). -## Phase 22. Races View — War/Peace Toggle and Votes +## ~~Phase 22. Races View — War/Peace Toggle and Votes~~ -Status: pending. +Status: done. -Goal: list other races with their visible stats, expose war/peace -toggle and the voting UI. +Goal: list other races with their visible stats, expose the war/peace +toggle, and the voting UI. Artifacts: -- `ui/frontend/src/routes/games/[id]/table/races/+page.svelte` table - with one row per race, including name, tech levels, total - population, total production, planet count, war-or-peace from this - race's perspective, votes received. The race list itself is read - from `GameReport.otherRaces` (introduced in Phase 20 for the - ship-group transfer-to-race picker); the table view widens the - per-race shape (tech / population / production / planet count / - votes / relation) by walking `report.player[]` directly when those - fields are needed -- per-row toggle for declaring war or peace (adds - `SetDiplomaticStance` command) -- voting control: a single slot for `give my votes to ` (adds - `SetVoteRecipient` command) -- alliance summary panel showing the current vote graph and any - alliance reaching ≥ 2/3 of total votes +- `ui/frontend/src/lib/active-view/table-races.svelte` table mounted + by the dispatcher in + `ui/frontend/src/lib/active-view/table.svelte` (same pattern as + Phase 21's sciences table). One row per non-extinct other race + carrying name, tech levels (drive / weapons / shields / cargo as + percent), total population, total production (engine `industry`), + planet count, votes received, and the local player's stance + toward that race. The richer per-race projection + (`GameReport.races: ReportOtherRace[]`) is decoded in + `ui/frontend/src/api/game-state.ts` by walking `report.player[]` + once and surfacing the row alongside the existing `otherRaces: + string[]` (which keeps backing the ship-group transfer picker from + Phase 20) +- per-row segmented `WAR | PEACE` control. The active stance is + highlighted (`aria-pressed=true` + contrast colour); the inactive + button queues `setDiplomaticStance` (engine `CommandRaceRelation`). + The displayed stance is the local player's relation toward the + named race (`rules.txt` "(R) Ваше отношение к указанной расе, но + не наоборот") — not the other way round +- voting control: a single ` + + {#each races as r (r.name)} + + {/each} + + + +

+ {i18n.t("game.table.races.note.alliance_server_side")} +

+
+ +
+ + + {#if !reportLoaded} +

+ {i18n.t("game.table.races.loading")} +

+ {:else if races.length === 0} +

+ {i18n.t("game.table.races.empty")} +

+ {:else} + + + + {#each COLUMNS as column (column)} + + {/each} + + + + + {#each sorted as r (r.name)} + + + + + + + + + + + + + {/each} + +
+ + {i18n.t("game.table.races.column.relation")}
{r.name}{formatPercent(r.drive)} + {formatPercent(r.weapons)} + + {formatPercent(r.shields)} + {formatPercent(r.cargo)} + {formatCount(r.population)} + + {formatCount(r.industry)} + {formatCount(r.planets)} + {formatVotes(r.votesReceived)} + +
+ + +
+
+ {/if} + + + diff --git a/ui/frontend/src/lib/active-view/table.svelte b/ui/frontend/src/lib/active-view/table.svelte index b728565..827c622 100644 --- a/ui/frontend/src/lib/active-view/table.svelte +++ b/ui/frontend/src/lib/active-view/table.svelte @@ -1,17 +1,18 @@