Repository navigation
feat(widget)!: route registry, Compact and Dashboard Layouts, dashboard page transitions - #606
petar-omni wants to merge 6 commits into
Conversation
|
|
Important Review skippedToo many files! This PR contains 386 files, which is 236 over the limit of 150. To get a review, reduce the PR to 150 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to Team to raise the limit. Usage-priced reviews support at most 300 files.
|
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
The dashboard swapped pages without AnimatePresence, so a leaving page vanished at once and AnimationPage's exit never ran. Wrap the dashboard routes in AnimatePresence (mode wait) keyed per page, keep the header and tabs mounted outside the routes, and apply a pressed yield category only after the leaving Earn page has exited so it does not render the new category while fading out. Give the dashboard a shorter, blur-only exit; the classic widget keeps its transition.
AnimatePresence keeps the onExitComplete callback from the render the exit started in, so a category pressed during the exit was dropped or an earlier one applied. Read the pending category from a ref instead, select it through a setter-only Earn facade so the route tree no longer re-renders on every selection change, share the tab classifier between the tabs and the page key, and give AnimationPage one transition object per variant.
…guration An invalid initial Host Configuration (e.g. borrowEnabled without dashboardVariant) made widgetConfigAtom throw while rendering. With no error boundary, the host's whole React root unmounted. Render the widget-unavailable notice instead, styled from the rejected configuration's own theme, variant and layout, each decoded separately so a bad field falls back to its default instead of throwing again.
Utila is drawn for light and Porto for dark only, so lock the theme for them. Borrow needs the dashboard variant, so disable borrowEnabled without it instead of mounting a configuration the widget rejects. Keep the widget clear of the open panel, confirm Copy link, and note that a non-production API URL needs that environment's key.
Route paths were plain strings built, matched, and parsed in many places,
"classic" meant three different things, and Features branched on the
dashboard flag at runtime.
- Add the Route Registry (services/navigation/widget-routes.ts): one
definition per route with typed params, build and match, the Layouts
that mount it, and flow groups whose owners bind their navigation
state. Navigation accepts only registry-built paths; React adapters
live in the navigation Feature.
- Rename the Classic Transaction Flow to the Yield Transaction Flow and
the non-dashboard layout to the Compact Layout.
- Move the Layout route trees to app/layouts/{compact,dashboard}.
Widget Configuration derives `layout` from `dashboardVariant`;
Features never read it, and shared screens move out of ui/compact.
- Enforce with ast-grep (raw widget paths, Layout reads in Features,
Layout names in logic and file paths) and dependency-cruiser
(ui/compact and ui/dashboard stay independent), plus a test that each
Layout mounts exactly its declared routes.
- Record the vocabulary in GLOSSARY.md and the decision in ADR 0013.
BREAKING CHANGE: `DashboardYieldCategory` is now `YieldCategory` and the
`dashboardYieldCategoryOrder` option is now `yieldCategoryOrder`.
65c8f04 to
3ae0f71
Compare
Summary
This branch carries four changes:
feat(dashboard): play page exit transitions,fix(dashboard): apply the last pressed category after the page exitfix(widget): show the unavailable notice for a rejected initial configurationfix(playground): only mount host setups the widget accepts,chore(mise): bump pinned pnpm to 12.15.0refactor(widget)!: type routes through a registry and separate LayoutsDashboard page transitions
AnimationPagegets one transition object per Layout from the app container.Rejected initial configuration
Before, an invalid initial Host Configuration made
widgetConfigAtomthrow while rendering (e.g.borrowEnabledwithoutdashboardVariant). There is no error boundary, so the host's whole React root unmounted. The widget now renders the widget-unavailable notice instead. Its theme, variant and Layout are decoded field by field from the rejected configuration, so one bad field falls back to its default instead of throwing again.Playground
borrowEnabledis turned off when the Dashboard Layout isn't selected.Route Registry and Layout separation
Route paths are now typed through one Route Registry. The Compact and Dashboard Layouts are application composition, and Features no longer branch on the Layout.
Every absolute path is defined once in the registry. Each route carries its pattern, the params inferred from it, the Layouts that mount it,
build,match, andmatchPrefix:WidgetNavigationand the React adapters accept only registry-built paths.decode*NavigationStatefunctions are gone.layoutfrom the publicdashboardVariant. Layout differences are now one of:data-sk-layoutselectsDefaultAction,showsBackButton)no-raw-widget-pathno-layout-read-in-featuresno-layout-name-in-logicno-layout-path-outside-layout-uiui/compactandui/dashboardindependent of each other.tests/app/layouts/layout-routes.test.tsxchecks that each Layout mounts exactly the routes declared for it.Evidence
mise run lint,mise run check-hygiene, andmise run testall pass locally:The ast-grep scan has zero hits. Against the old tree,
no-raw-widget-pathreported 17.Playground smoke test in Chromium:
tests/app/journeys/invalid-host-configuration.browser.test.tsxcovers the rejected-configuration notice.Merge Danger
Door: one-way for hosts, two-way internally.
Blast Radius: public API
DashboardYieldCategoryis nowYieldCategory, and thedashboardYieldCategoryOrderoption is nowyieldCategoryOrder. There are no aliases.data-sk-layouton the app container now readscompactinstead ofwidget. It isn't documented for hosts, but host CSS could target it./activityxno longer counts as Activity.