fix(ui): F8-08 unified number format — mono, fixed 3-decimal, no separators #65

Merged
developer merged 2 commits from feature/issue-51-number-format into development 2026-05-27 10:14:05 +00:00
Owner

Closes part of #43 (F8-08), addresses #51.

Что поменялось

  • Новый общий util ui/frontend/src/lib/util/number-format.ts (formatFloat/formatInt/formatPercent), без toLocaleString (нет разделителей разрядов).
  • lib/active-view/report/format.ts — тонкий re-export, имена сохранены, чтобы не плодить diff по секциям отчёта.
  • Инспекторы (planet, ship-group, planet/ship-groups, ship-group/actions) — заменили inline formatNumber на formatFloat, добавили class="numeric" на числовые <dd>, размеры шрифтов 0.85/0.8rem (моно — на числовых) под calculator-tab.
  • Координаты планеты и unidentified ship-group — без круглых скобок.
  • table-races, table-sciences, table-ship-classes, designer-science — переключены на util, размеры под calculator, class="numeric" на числовых столбцах.
  • 19 секций turn-report (report/section-*) — добавлен class="numeric" на числовые <th> и <td> плюс CSS-правило font-family: var(--font-mono); text-align: right; для выравнивания по десятичной точке.
  • i18n en/ru — убрали слово «stockpile» из заголовков инспектора и bombings, убрали % из заголовков уровней технологий в races + player_status.

Багфиксы

  • п.25 (Player Status / Races) — drive/weapons/shields/cargo это уровни технологий, а не доли. Раньше прогонялись через formatPercent (×100) и показывали 451.0 вместо 4.510. Теперь — formatFloat.

Проверка

  • pnpm test — 814 passed.
  • pnpm check — 0 errors, 0 warnings.
  • pnpm build — clean.

Reviewer: @owner

Closes part of #43 (F8-08), addresses #51. ## Что поменялось - Новый общий util `ui/frontend/src/lib/util/number-format.ts` (`formatFloat`/`formatInt`/`formatPercent`), без `toLocaleString` (нет разделителей разрядов). - `lib/active-view/report/format.ts` — тонкий re-export, имена сохранены, чтобы не плодить diff по секциям отчёта. - Инспекторы (`planet`, `ship-group`, `planet/ship-groups`, `ship-group/actions`) — заменили inline `formatNumber` на `formatFloat`, добавили `class="numeric"` на числовые `<dd>`, размеры шрифтов 0.85/0.8rem (моно — на числовых) под calculator-tab. - Координаты планеты и unidentified ship-group — без круглых скобок. - `table-races`, `table-sciences`, `table-ship-classes`, `designer-science` — переключены на util, размеры под calculator, `class="numeric"` на числовых столбцах. - 19 секций turn-report (`report/section-*`) — добавлен `class="numeric"` на числовые `<th>` и `<td>` плюс CSS-правило `font-family: var(--font-mono); text-align: right;` для выравнивания по десятичной точке. - i18n en/ru — убрали слово «stockpile» из заголовков инспектора и bombings, убрали `%` из заголовков уровней технологий в races + player_status. ## Багфиксы - **п.25** (Player Status / Races) — `drive/weapons/shields/cargo` это **уровни технологий**, а не доли. Раньше прогонялись через `formatPercent` (×100) и показывали `451.0` вместо `4.510`. Теперь — `formatFloat`. ## Проверка - `pnpm test` — 814 passed. - `pnpm check` — 0 errors, 0 warnings. - `pnpm build` — clean. Reviewer: @owner
developer added 1 commit 2026-05-27 09:09:00 +00:00
fix(ui): F8-08 unified number format — mono, fixed 3-decimal, no separators
Tests · UI / test (push) Waiting to run
Tests · UI / test (pull_request) Waiting to run
b31d9f4c45
Engine emits Floats at Fixed3 quantisation; UI now renders them as 3-decimal
fixed-point strings without thousand separators, monospaced via var(--font-mono)
on .numeric cells, and right-aligned in tables so columns line up on the
decimal point. Integer counts render with 0 decimals and no separators;
science fractions render as 1-decimal percent (matches the engine's third
decimal of precision).

Bug fixes from #51 (umbrella #43):
  - Player Status drive/weapons/shields/cargo: were tech LEVELS rendered
    through formatPercent (x100) — now use formatFloat (raw level).
  - Races table: same bug, same fix.

Style/UX cleanups:
  - Inspector field labels lose "stockpile" word ($ / M suffix carries it).
  - Coordinates drop the parentheses (just "x, y").
  - Inspector + report tables unify font sizes with calculator-tab
    (values 0.85rem mono, labels 0.8rem).

Files:
  - new util: ui/frontend/src/lib/util/number-format.ts
  - report/format.ts becomes a thin re-export to keep section imports compact
  - inspector planet / ship-group / actions: drop inline formatNumber,
    mark numeric <dd> with class="numeric"
  - table-races (+ bug fix), table-sciences, table-ship-classes,
    designer-science: drop inline formatters, switch to util, add
    class="numeric" on numeric <th>/<td>
  - 17 report section files: class="numeric" on numeric th/td +
    scoped CSS rule for mono+right-align
  - i18n en/ru: drop "stockpile" word, drop "%" from tech-level column
    headers in races + player_status (the "%" was the misleading bit
    from the bug)
  - tests/inspector-planet + tests/table-races: update assertions to
    match the new format

Verification: pnpm test (814 passed), pnpm check (0 errors/warnings),
pnpm build clean.

Refs: #51 (#43 umbrella).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
developer added 1 commit 2026-05-27 09:14:31 +00:00
test(ui): F8-08 e2e — match new 1-dec percent + 3-dec float formatting
Tests · UI / test (pull_request) Waiting to run
Tests · UI / test (push) Successful in 2m50s
ed4e2f58a1
sciences.spec.ts: `sciences-cell-drive` now reads "25.0" (was "25") because
formatPercent always emits one fractional digit.

ship-classes.spec.ts: `ship-classes-cell-drive` now reads "1.000" (was "1")
because formatFloat always emits three fractional digits.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
owner approved these changes 2026-05-27 09:42:48 +00:00
developer merged commit 2901ecb21b into development 2026-05-27 10:14:05 +00:00
developer deleted branch feature/issue-51-number-format 2026-05-27 10:14:05 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: developer/galaxy-game#65