Skip to content

feat(widget): add flat yield grouping option for dashboard#539

Merged
petar-omni merged 1 commit into
mainfrom
feat/yield-groupping-option
Jun 17, 2026
Merged

feat(widget): add flat yield grouping option for dashboard#539
petar-omni merged 1 commit into
mainfrom
feat/yield-groupping-option

Conversation

@petar-omni

@petar-omni petar-omni commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Introduce yieldGrouping setting with flat (default) and category modes. Dashboard shows a single Earn tab unless category grouping is enabled. Skip category-based yield filtering and position grouping in flat mode.

Summary by CodeRabbit

  • New Features

    • Introduced yieldGrouping setting to toggle dashboard organization between flat and category-based layouts.
    • Enhanced tab routing system with conditional rendering based on selected grouping mode.
    • Added "Earn" tab alongside existing dashboard tabs for improved navigation.
  • Tests

    • Validated flat grouping mode as default dashboard configuration.

Introduce yieldGrouping setting with flat (default) and category modes.
Dashboard shows a single Earn tab unless category grouping is enabled.
Skip category-based yield filtering and position grouping in flat mode.
@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2e71381

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

@coderabbitai

coderabbitai Bot commented Jun 17, 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: a6b40e88-51c6-45dc-84aa-103df4c9c02e

📥 Commits

Reviewing files that changed from the base of the PR and between d1a215c and 2e71381.

📒 Files selected for processing (7)
  • packages/widget/src/pages-dashboard/common/components/tabs/index.tsx
  • packages/widget/src/pages-dashboard/common/components/tabs/tab.tsx
  • packages/widget/src/pages-dashboard/overview/positions/hooks/use-grouped-positions.ts
  • packages/widget/src/pages/details/earn-page/state/earn-page-context.tsx
  • packages/widget/src/pages/details/earn-page/state/earn-page-state-context.tsx
  • packages/widget/src/providers/settings/types.ts
  • packages/widget/tests/use-cases/renders-initial-page.test.tsx

📝 Walkthrough

Walkthrough

Adds an optional yieldGrouping?: "flat" | "category" field to SettingsProps and propagates a derived dashboardYieldCategoryGroupingEnabled boolean through EarnPageStateProvider reducers, EarnPageContextProvider memos, useGroupedPositions, and the dashboard Tabs component to gate all category-grouping behavior behind the new setting.

Changes

yieldGrouping flat/category gating

Layer / File(s) Summary
yieldGrouping setting type
packages/widget/src/providers/settings/types.ts
Adds yieldGrouping?: "flat" | "category" to SettingsProps.
EarnPageStateContext grouping flag and reducer gating
packages/widget/src/pages/details/earn-page/state/earn-page-state-context.tsx
Reads yieldGrouping + dashboardVariant from settings, computes dashboardYieldCategoryGroupingEnabled and dashboardYieldCategorySelectionEnabled, gates useDashboardYieldCatalog, nulls out selectedDashboardYieldCategory in all reducer paths and derived state when grouping is off, and conditionally returns availableDashboardYieldCategories or [] from the context memo.
EarnPageContext filtering and handler gating
packages/widget/src/pages/details/earn-page/state/earn-page-context.tsx
Extracts yieldGrouping and derives dashboardYieldCategoryGroupingEnabled; updates the dashboard-groups memo filter and its deps; adds early return in onDashboardYieldCategorySelect when grouping is disabled.
useGroupedPositions flat short-circuit
packages/widget/src/pages-dashboard/overview/positions/hooks/use-grouped-positions.ts
Imports useSettings, derives the grouping flag, gates integrationIds/useQueries on it, and returns a flat row list immediately when grouping is disabled.
Tabs conditional earn/category rendering
packages/widget/src/pages-dashboard/common/components/tabs/index.tsx, packages/widget/src/pages-dashboard/common/components/tabs/tab.tsx
Adds "earn" to RouteTab, TABS_MAP, and Tab's variant union; refactors Tabs JSX to render category tabs when yieldGrouping === "category" or a single "Earn" tab otherwise; gates divider on grouping enabled + non-empty categories.
Flat grouping default test
packages/widget/tests/use-cases/renders-initial-page.test.tsx
Adds test asserting "Earn", "Manage", "Activity" are present and "Stake", "DeFi", "RWA" absent when dashboardVariant: true (flat default).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • stakekit/widget#527: Directly related — introduces category-scoped yield discovery and dashboard-category-driven token/yield selection wiring that this PR gates behind yieldGrouping === "category".

Suggested reviewers

  • Philippoes
  • 0xYoki
  • xhakti
  • dnehl

Poem

🐰 A new setting hops in, flat or by kind,
The "Earn" tab appears when grouping's unlined.
Reducers now null what should not be set,
The divider skips rows with nothing to get.
One flag guards them all — the widget's delight! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main feature being added: a flat yield grouping option for the dashboard, which aligns with the PR's primary objective.
Description check ✅ Passed The description provides sufficient context about the yieldGrouping setting, its two modes (flat/category), and the impact on dashboard rendering and filtering logic, matching the template's expectations.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/yield-groupping-option

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

@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-539.df4xyoi0xyeak.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-539.d2ribjy8evqo6h.amplifyapp.com

@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.

lgtm

@petar-omni petar-omni merged commit dcf1c01 into main Jun 17, 2026
8 checks passed
@petar-omni petar-omni deleted the feat/yield-groupping-option branch June 17, 2026 11:22
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.

3 participants