feat(widget): show error screen when no yields enabled for api key#552
feat(widget): show error screen when no yields enabled for api key#552sandy-yield wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughIntroduces a new empty-state page shown when no yields are enabled. Adds a ChangesNo Enabled Yields feature
Estimated code review effort: 2 (Simple) | ~12 minutes Sequence Diagram(s)sequenceDiagram
participant App
participant useNoEnabledYields
participant ReactQuery
participant ApiClient
participant NoEnabledYields
App->>useNoEnabledYields: call hook
useNoEnabledYields->>ReactQuery: query enabledNetworksQueryKey
ReactQuery->>ApiClient: getEnabledNetworksQueryFn()
ApiClient-->>ReactQuery: Set<Networks>
ReactQuery-->>useNoEnabledYields: data, isSuccess
useNoEnabledYields-->>App: true if data.size === 0
alt no enabled yields
App->>NoEnabledYields: render empty-state page
else has enabled yields
App->>App: continue dashboard/widget routing
end
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/widget/src/pages-dashboard/common/components/styles.css.ts (1)
14-16: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant
borderRadiusindefault/utilavariants.Base now sets
borderRadius: "14px"(Line 15), which already matches thedefault(Line 20-22) andutila(Line 23-25) variant overrides, making those two variant overrides redundant.♻️ Optional cleanup
variants: { variant: { - default: { - borderRadius: "14px", - }, - utila: { - borderRadius: "14px", - }, + default: {}, + utila: {}, finery: { borderRadius: "30px", },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/widget/src/pages-dashboard/common/components/styles.css.ts` around lines 14 - 16, The `default` and `utila` variants in the styles definition are redundant because they reapply the same `borderRadius: "14px"` already set in the base `styles` object. Remove the duplicate `borderRadius` overrides from those variant entries and keep the shared value only in the base style, using the `default` and `utila` variant keys as the places to verify no other differences remain.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/widget/src/pages-dashboard/common/components/styles.css.ts`:
- Around line 14-16: The `default` and `utila` variants in the styles definition
are redundant because they reapply the same `borderRadius: "14px"` already set
in the base `styles` object. Remove the duplicate `borderRadius` overrides from
those variant entries and keep the shared value only in the base style, using
the `default` and `utila` variant keys as the places to verify no other
differences remain.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0e7c7cfb-f01e-4ccb-8a84-fd4a09ef6857
📒 Files selected for processing (8)
packages/widget/src/App.tsxpackages/widget/src/common/get-enabled-networks.tspackages/widget/src/hooks/use-no-enabled-yields.tspackages/widget/src/pages-dashboard/common/components/styles.css.tspackages/widget/src/pages/components/no-enabled-yields/index.tsxpackages/widget/src/pages/components/no-enabled-yields/style.css.tspackages/widget/src/translation/English/translations.jsonpackages/widget/src/translation/French/translations.json
| borderStyle: "solid", | ||
| boxShadow: "0px 15px 40px 0px #0000000D", | ||
| width: "1000px", | ||
| borderRadius: "14px", |
There was a problem hiding this comment.
The borderRadius: "14px" added to wrapper's base (styles.css.ts:15) applies to every consumer of the recipe, including DashboardWrapper — not just the new No-Enabled-Yields screen.
For default/utila/finery/porto it changes nothing (the variants override base), but zerion isn't a recipe variant, so combineRecipeWithVariant falls back to rec() (base only). That means the entire Zerion dashboard now gets 14px rounded corners where it was previously square
Was this intended (Zerion dashboard should have rounded corners in general)? If it was only meant for this screen, it'd be cleaner to either add zerion as an explicit variant in the recipe, or set the radius locally in the screen's own style, rather than changing the shared base.
There was a problem hiding this comment.
Yes, you are correct. I have moved this to the no-enabled yield screen.
| "no_enabled_yields": { | ||
| "title": "No yields enabled", | ||
| "description": "There are no yields enabled for this API key. Enable at least one yield to start earning." | ||
| }, |
There was a problem hiding this comment.
should we move those translation also to the "help_modals" like other errors like under_maintenance?
There was a problem hiding this comment.
Have moved it under help modals.
Empty screen added if api has no yields enabled
Summary by CodeRabbit
New Features
Bug Fixes