Skip to content

feat(widget): show error screen when no yields enabled for api key#552

Open
sandy-yield wants to merge 2 commits into
mainfrom
feat/no-enabled-yields-screen
Open

feat(widget): show error screen when no yields enabled for api key#552
sandy-yield wants to merge 2 commits into
mainfrom
feat/no-enabled-yields-screen

Conversation

@sandy-yield

@sandy-yield sandy-yield commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Empty screen added if api has no yields enabled

image image

Summary by CodeRabbit

  • New Features

    • Added a new “No yields enabled” screen that appears when no yield options are active.
    • Included localized messaging in English and French to guide users to enable a yield before earning.
  • Bug Fixes

    • Improved app behavior to show the appropriate fallback page instead of the standard dashboard flow when no enabled yields are available.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 328c81d4-f703-44c1-a98d-5566b3e768eb

📥 Commits

Reviewing files that changed from the base of the PR and between 3fcc84f and a133584.

📒 Files selected for processing (3)
  • packages/widget/src/pages/components/no-enabled-yields/index.tsx
  • packages/widget/src/translation/English/translations.json
  • packages/widget/src/translation/French/translations.json
✅ Files skipped from review due to trivial changes (2)
  • packages/widget/src/translation/French/translations.json
  • packages/widget/src/translation/English/translations.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/widget/src/pages/components/no-enabled-yields/index.tsx

📝 Walkthrough

Walkthrough

Introduces a new empty-state page shown when no yields are enabled. Adds a useNoEnabledYields hook backed by a refactored enabled-networks query helper, a NoEnabledYields page component with dedicated styles, App routing to render it, and English/French translations.

Changes

No Enabled Yields feature

Layer / File(s) Summary
Enabled networks query refactor
packages/widget/src/common/get-enabled-networks.ts
Extracts enabledNetworksQueryKey and getEnabledNetworksQueryFn as exported helpers, used by fetchQuery instead of an inlined queryKey/queryFn.
useNoEnabledYields hook
packages/widget/src/hooks/use-no-enabled-yields.ts
New hook queries enabled networks with infinite staleTime and returns true when the query succeeds with an empty set.
NoEnabledYields page component and styles
packages/widget/src/pages/components/no-enabled-yields/index.tsx, packages/widget/src/pages/components/no-enabled-yields/style.css.ts
New page renders a translated title/description and PoweredBy footer, with conditional styling based on dashboard variant, backed by new background, dashboardBackground, and container styles.
App routing
packages/widget/src/App.tsx
Calls useNoEnabledYields() and early-returns <NoEnabledYields /> before existing dashboard/widget routing logic.
Translation strings
packages/widget/src/translation/English/translations.json, packages/widget/src/translation/French/translations.json
Adds help_modals.no_enabled_yields title/description entries in English and French.

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
Loading

Suggested reviewers: jdomingos, Philippoes

Poem

A hop, a query, a set gone bare,
No yields enabled? We show we care.
A gentle page with words so kind,
"Enable one yield," it hints just fine.
🐇 Thump-thump — merged with delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is too brief and does not follow the required Added/Changed template sections. Add separate ## Added and ## Changed sections with a concise summary of the new empty state and the supporting UI/translation changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: showing an empty/error screen when no yields are enabled for an API key.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/no-enabled-yields-screen

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@changeset-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: a133584

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-552.d2ribjy8evqo6h.amplifyapp.com

@aws-amplify-eu-central-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-552.df4xyoi0xyeak.amplifyapp.com

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/widget/src/pages-dashboard/common/components/styles.css.ts (1)

14-16: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Redundant borderRadius in default/utila variants.

Base now sets borderRadius: "14px" (Line 15), which already matches the default (Line 20-22) and utila (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

📥 Commits

Reviewing files that changed from the base of the PR and between bc3a842 and 3fcc84f.

📒 Files selected for processing (8)
  • packages/widget/src/App.tsx
  • packages/widget/src/common/get-enabled-networks.ts
  • packages/widget/src/hooks/use-no-enabled-yields.ts
  • packages/widget/src/pages-dashboard/common/components/styles.css.ts
  • packages/widget/src/pages/components/no-enabled-yields/index.tsx
  • packages/widget/src/pages/components/no-enabled-yields/style.css.ts
  • packages/widget/src/translation/English/translations.json
  • packages/widget/src/translation/French/translations.json

borderStyle: "solid",
boxShadow: "0px 15px 40px 0px #0000000D",
width: "1000px",
borderRadius: "14px",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are correct. I have moved this to the no-enabled yield screen.

Comment on lines +558 to +561
"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."
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we move those translation also to the "help_modals" like other errors like under_maintenance?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have moved it under help modals.

@sandy-yield sandy-yield requested a review from dnehl July 1, 2026 13:55

@dnehl dnehl left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing else spotted - looks good! 👍

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.

2 participants