Skip to content

refactor(frontend): type-safe routing and decompose CreateFeedPanel - #1059

Merged
gildesmarais merged 1 commit into
mainfrom
refactor/frontend-slims
Aug 7, 2026
Merged

refactor(frontend): type-safe routing and decompose CreateFeedPanel#1059
gildesmarais merged 1 commit into
mainfrom
refactor/frontend-slims

Conversation

@gildesmarais

Copy link
Copy Markdown
Member

What changed

  • Refactored deriveAppViewModel in frontend/src/appViewModel.ts to accept route: AppRoute directly, eliminating manual string-mapping in the presenter.
  • Added getPanelViewState helper in frontend/src/appViewModel.ts to encapsulate calculated view states (isTokenPrompt, isConverting, etc.) outside components.
  • Updated useAppPresenter.ts to directly pass route from the router to the view model derivation.
  • Decomposed the monolithic CreateFeedPanel in AppPanels.tsx into three focused sub-components (UrlEntrySection, TokenGateSection, and ActionFeedback).
  • Updated unit tests in appViewModel.test.ts to cover the routing type changes and the new getPanelViewState helper.

Why

  • Locality: Routing and panel presentation logic is no longer scattered or synchronized manually.
  • Interface Shrinkage: CreateFeedPanel is now a simple layout orchestrator rather than a complex form parser with dual rendering states.
  • Type Safety: Propagating the AppRoute union directly to the view-derivation prevents runtime-mismatches and provides full typescript compiler guarantees.

Risk

  • Low. All behaviors and form interactions are preserved, and comprehensive unit tests cover the new structures.

Review map

  1. frontend/src/appViewModel.ts — View state derivation and pure getPanelViewState helper mapping.
  2. frontend/src/hooks/useAppPresenter.ts — Cleaned up hook wiring passing routes directly.
  3. frontend/src/components/AppPanels.tsx — Decomposed UI layout structure.
  4. frontend/src/__tests__/appViewModel.test.ts — Validating test coverage.

Validation

  • make test-frontend-unit (Exit code: 0)
  • make lint-js (Exit code: 0)
  • make ready (Exit code: 0)

Unifies route state propagation by passing the typed AppRoute object directly to deriveAppViewModel, removing manual string mappings in useAppPresenter. Consolidates CreateFeedPanel by decomposing it into UrlEntrySection, TokenGateSection, and ActionFeedback sub-components, and isolates computed view state via getPanelViewState.
@gildesmarais
gildesmarais enabled auto-merge (squash) August 7, 2026 07:16
@gildesmarais
gildesmarais merged commit 660f70d into main Aug 7, 2026
14 of 15 checks passed
@gildesmarais
gildesmarais deleted the refactor/frontend-slims branch August 7, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant