Split frontend UI into feature modules

This commit is contained in:
2026-02-07 02:07:29 +01:00
parent b16bf8007f
commit 34d274d244
9 changed files with 1153 additions and 1093 deletions

View File

@@ -6,25 +6,12 @@ This document tracks only active work. Completed work is intentionally omitted a
Active maintainability risks (priority order):
1. Frontend module concentration and global coupling (Critical)
- `wwwroot/js/ui.js` remains the dominant hotspot and owns rendering, modal flows, admin flows, and vote logic.
- Cross-feature coupling still exists via shared mutable state usage across UI/data modules (`wwwroot/js/ui.js:180`, `wwwroot/js/ui.js:401`, `wwwroot/js/ui.js:622`, `wwwroot/js/data.js:82`).
- Impact: high regression surface and expensive refactors even after removing global `window` bridges.
2. Static analysis and frontend lint guardrails are still missing (Medium)
1. Static analysis and frontend lint guardrails are still missing (Medium)
- CI currently gates restore/build/test only (`.github/workflows/ci.yml:23`-`.github/workflows/ci.yml:29`).
- Impact: style drift and low-signal warnings can enter the codebase undetected.
## B) Active task list
[P1] Decompose frontend UI monolith by feature
- Problem: Severity `High`, Category `Architecture/Complexity`. `ui.js` still mixes rendering, form behavior, and mutation flows.
- Evidence: `wwwroot/js/ui.js:180`, `wwwroot/js/ui.js:401`, `wwwroot/js/ui.js:622`, `wwwroot/js/ui.js:903`, `wwwroot/js/data.js:82`.
- Recommendation: split by feature (`suggestions-ui`, `votes-ui`, `admin-ui`, `modals-ui`) and keep orchestration in a thin composition layer.
- Acceptance criteria (testable): UI behavior is preserved while feature modules own isolated responsibilities and no single file coordinates all vote/admin/modal/suggestion interactions.
- Effort / Risk: `L / Med`.
- Dependencies (if any): none.
[P2] Add static analysis and JS lint/format guardrails
- Problem: Severity `Medium`, Category `Tooling`. CI does not enforce analyzers or JS lint/format checks.
- Evidence: `.github/workflows/ci.yml:23`-`.github/workflows/ci.yml:29`.
@@ -43,9 +30,8 @@ Active maintainability risks (priority order):
## C) Suggested execution order
1. Decompose `ui.js` by feature and keep orchestration thin.
2. Add analyzers + JS lint gates in CI.
3. Externalize i18n/FAQ assets.
1. Add analyzers + JS lint gates in CI.
2. Externalize i18n/FAQ assets.
## D) Guardrails