refactor(frontend): type-safe routing and decompose CreateFeedPanel - #1059
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
deriveAppViewModelinfrontend/src/appViewModel.tsto acceptroute: AppRoutedirectly, eliminating manual string-mapping in the presenter.getPanelViewStatehelper infrontend/src/appViewModel.tsto encapsulate calculated view states (isTokenPrompt,isConverting, etc.) outside components.useAppPresenter.tsto directly passroutefrom the router to the view model derivation.CreateFeedPanelinAppPanels.tsxinto three focused sub-components (UrlEntrySection,TokenGateSection, andActionFeedback).appViewModel.test.tsto cover the routing type changes and the newgetPanelViewStatehelper.Why
CreateFeedPanelis now a simple layout orchestrator rather than a complex form parser with dual rendering states.AppRouteunion directly to the view-derivation prevents runtime-mismatches and provides full typescript compiler guarantees.Risk
Review map
frontend/src/appViewModel.ts— View state derivation and puregetPanelViewStatehelper mapping.frontend/src/hooks/useAppPresenter.ts— Cleaned up hook wiring passing routes directly.frontend/src/components/AppPanels.tsx— Decomposed UI layout structure.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)