Skip to content

refactor(widget): align theme variant defaults#534

Merged
Philippoes merged 1 commit into
mainfrom
refactor/theme
Jun 11, 2026
Merged

refactor(widget): align theme variant defaults#534
Philippoes merged 1 commit into
mainfrom
refactor/theme

Conversation

@petar-omni

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

Copy link
Copy Markdown
Contributor

Move the Utila and Porto palettes into the base light and dark theme tokens.

Expose variant override resolution so theme behavior has direct coverage.

Apply dashboard variant styling branches and keep RWA yields first in sorting.

Added

preview

Changed

Description of the modifications made to existing functionality, feature, or content in this pull request. This could include changes to code, CI, documentation, etc.

Summary by CodeRabbit

  • New Features

    • Added compact button size variant for improved layout options
    • Introduced dashboard variant support affecting component layouts and styling
  • Bug Fixes

    • Improved yield type prioritization with real-world assets ranked higher
    • Enhanced color consistency across theme variants
  • Style Updates

    • Refined button, filter, and divider styling
    • Updated color tokens and theme palette consistency
    • Adjusted spacing and border radius values across components
  • Tests

    • Added coverage for yield type sorting and theme overrides

Move the Utila and Porto palettes into the base light and dark theme tokens.

Expose variant override resolution so theme behavior has direct coverage.

Apply dashboard variant styling branches and keep RWA yields first in sorting.
@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 527a60c

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 11, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR refactors the widget's theme system to support a new dashboardVariant setting that controls dashboard-specific layouts and styling. It removes hardcoded palette references across component styles, consolidates to a unified theme token system with new color tokens, updates yield sort priorities, and adds cleaner theme override logic via a new getThemeOverrides helper function.

Changes

Dashboard Variant & Theme Refactor

Layer / File(s) Summary
Theme Contract, Token Values & Override Helper
packages/widget/src/styles/tokens/colors/contract.ts, packages/widget/src/styles/tokens/colors/values.ts, packages/widget/src/providers/theme-wrapper.tsx, packages/widget/src/styles/theme/variant-overrides/*
Color contract expanded with tokenSelectBorder and six new summaryLabel* tokens; light/dark theme values updated with explicit hex assignments; getThemeOverrides helper replaces purify-ts unsafeCoerce with explicit conditional branches; Finery palette detection uses primary color instead of background.
App Variant Configuration & Default Theme
packages/widget/src/vite-env.d.ts, packages/widget/src/main.tsx, packages/widget/src/standalone.css.ts
VITE_APP_VARIANT type expanded to "default", "utila", "finery", "porto"; standalone app default theme changed from "light" to "dark" with background color #000000; variant typing extracted to local StandaloneVariant type.
Dashboard Variant Integration in Layout Components
packages/widget/src/pages/components/page-cta.tsx, packages/widget/src/pages/components/powered-by/index.tsx, packages/widget/src/components/molecules/estimated-reward-amounts/index.tsx, packages/widget/src/pages/details/earn-page/components/select-yield-section/*, packages/widget/src/pages-dashboard/overview/earn-page/index.tsx, packages/widget/src/pages/details/earn-page/state/earn-page-context.tsx
Components now read dashboardVariant from useSettings() and conditionally adjust layout (PageCtaButton uses compact button), padding (PoweredBy), rendering (compact layout in EstimatedRewardAmounts), and divider visibility; SelectYieldSection hides title and EarnPageContent shows dividers when dashboardVariant is truthy.
Compact Button Variant & Max-Button Theme Migration
packages/widget/src/components/atoms/button/styles.css.ts, packages/widget/src/components/atoms/max-button/styles.css.ts
New size: compact variant added to buttonStyle with reduced minHeight and large border radius; max-button container/text recipes migrate from palette-based styling to smallLightButtonBackground and smallLightButtonColor theme tokens for both default and utila variants.
Divider, Tabs & Dashboard Common Styles Migration
packages/widget/src/components/atoms/divider/styles.css.ts, packages/widget/src/pages-dashboard/common/components/styles.css.ts, packages/widget/src/pages-dashboard/common/components/tabs/styles.css.ts
Divider recipe unified to use tabBorder token; tabs styling imports theme contract, updates border radius to 8px, removes palette references, applies theme-based backgrounds, and adjusts text weight/size and container padding; dashboard wrapper border radius standardized to 14px.
Summary Item & Label Styling Consolidation
packages/widget/src/components/molecules/summary-item/index.css.ts
Summary item recipes migrate from palette overrides to theme tokens; label styling expanded with vars.color.summaryLabel* tokens for staked/APY/available states; border colors, padding, and typography updated across default/utila/porto variants.
Activity Filters & Select Token Styling
packages/widget/src/pages/details/activity-page/components/activity-filters/*, packages/widget/src/pages/details/earn-page/components/select-token-section/styles.css.ts
Activity filter pills and counts migrate to theme contract vars for colors; select token section background changed to transparent with theme-driven borders and danger state colors; selected filter label/count text type changed to "base".
Earn Page & Details Styling Standardization
packages/widget/src/pages-dashboard/overview/earn-page/styles.css.ts, packages/widget/src/pages-dashboard/overview/positions/styles.css.ts, packages/widget/src/pages/details/details-page/styles.css.ts, packages/widget/src/pages/details/earn-page/components/select-yield-section/styles.css.ts
Earn page changeButton standardizes all variants to use accent color; selectTokenTitleContainer applies consistent marginBottom; positions title font size set to 16px; details-page tabBorder background changed to text token; select opportunity button default background updated to tokenSelectBackground.
Yield Sort Ranking & Domain Tests
packages/widget/src/domain/types/yields.ts, packages/widget/tests/domain/dashboard-yield-category-types.test.ts, packages/widget/src/pages/details/earn-page/state/earn-page-context.tsx
Yield types sort ranks reassigned to prioritize real_world_asset at rank 1; test suite verifies ranking; validator data context triggers special sorting when dashboardVariant is enabled.
Theme Override Helper Tests
packages/widget/tests/providers/theme-wrapper.test.ts
New test file validates getThemeOverrides helper returns correct variant-specific overrides and confirms base light/dark theme colors.

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly Related PRs

  • stakekit/widget#529: Both PRs modify packages/widget/src/domain/types/yields.ts and the yieldTypesSortRank yield sorting logic, with this PR updating sort rank values while the other refactors yield typing.
  • stakekit/widget#532: The retrieved PR introduces EstimatedRewardAmounts component, and this PR further modifies the same file to add dashboardVariant-driven rendering and a renamed compact layout component.
  • stakekit/widget#525: This PR's dashboard v2 theme refactoring (theme system, color tokens, and UI styling updates) directly overlaps with the retrieved PR's dashboard v2 theming work.

Suggested Reviewers

  • Philippoes
  • xhakti
  • 0xYoki

🐰 A dashboard variant hops into view,
Tokens replace palettes—the theme's now new,
Real-world assets rank up high,
Compact buttons fit, layouts comply,
The widget's styling migration's through!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description provides high-level objectives but lacks detailed explanations of changes across the 30+ modified files, making it incomplete against the template requirements. Expand the 'Changed' section with specific details about theme token consolidation, dashboard variant integration, and yield sorting changes affecting the numerous style and component files.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main refactoring objective of aligning theme variant defaults across the codebase.
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 refactor/theme

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-534.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-534.df4xyoi0xyeak.amplifyapp.com

@petar-omni petar-omni requested review from Philippoes and dnehl June 11, 2026 12:42

@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 (4)
packages/widget/src/pages/details/details-page/styles.css.ts (1)

39-51: Use of background: "text" for tabBorder is consistent with an active-tab underline; only rename for clarity

In packages/widget/src/pages/details/details-page/components/tab.tsx, the tabBorder element renders only when isSelected is true, so using the semantic foreground text token for the underline matches the active tab’s text styling intent. Since the underline no longer uses the tabBorder color token, consider renaming the style export/class to something like activeTabIndicator to avoid confusion.

🤖 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/details/details-page/styles.css.ts` around lines 39
- 51, The export name tabBorder is misleading since it represents the active-tab
underline rendered only when isSelected; rename the style export (e.g., to
activeTabIndicator) and update all references (notably the usage in the Tab
component in details-page/components/tab.tsx) to the new identifier so the
semantic purpose is clear—keep the style body unchanged, just change the
exported constant name and any imports/usages accordingly.
packages/widget/tests/providers/theme-wrapper.test.ts (1)

7-34: ⚡ Quick win

Add direct test coverage for the finery override branch.

Current coverage skips the only variant path with computed logic, so dark/light finery palette regressions can pass unnoticed.

Proposed test addition
 import { portoThemeOverrides } from "../../src/styles/theme/variant-overrides/porto";
 import { utilaThemeOverrides } from "../../src/styles/theme/variant-overrides/utila";
+import {
+  fineryDarkPalette,
+  fineryLightPalette,
+} from "../../src/styles/theme/variant-overrides/palettes";

 describe("getThemeOverrides", () => {
@@
   it("keeps the explicit Utila variant override", () => {
@@
   });
+
+  it("uses finery dark palette when base theme is dark-like", () => {
+    const overrides = getThemeOverrides({
+      baseTheme: darkTheme,
+      variant: "finery",
+    });
+
+    expect(overrides.color?.background).toBe(fineryDarkPalette.greyOne);
+  });
+
+  it("uses finery light palette when base theme is light-like", () => {
+    const overrides = getThemeOverrides({
+      baseTheme: lightTheme,
+      variant: "finery",
+    });
+
+    expect(overrides.color?.background).toBe(fineryLightPalette.greyOne);
+  });
 });
🤖 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/tests/providers/theme-wrapper.test.ts` around lines 7 - 34,
Add tests for the "finery" branch of getThemeOverrides by invoking
getThemeOverrides({ baseTheme: lightTheme, variant: "finery" }) and
getThemeOverrides({ baseTheme: darkTheme, variant: "finery" }) and asserting the
returned overrides match the expected finery palettes (or saved snapshots) to
cover the computed logic path; place these cases inside the existing
describe("getThemeOverrides") block and reference getThemeOverrides, "finery",
lightTheme and darkTheme so regressions in finery palette computation are
caught.
packages/widget/src/styles/tokens/colors/values.ts (2)

126-196: ⚡ Quick win

Consider extracting hardcoded hex values to primitiveColors for consistency.

Multiple new color values (e.g., "#4A60FF", "#f5f5f6", "#C9CFFF") are hardcoded in the theme objects. The file already establishes a pattern of defining primitive colors in the primitiveColors object (lines 5-46) and referencing them in theme definitions. Extracting these values would improve maintainability and make color updates easier to track.

♻️ Example refactor pattern
 const primitiveColors = {
   // ... existing colors
   blue: {
+    400: "`#4A60FF`",
   },
+  gray: {
+    50: "`#f5f5f6`",
+  },
+  lavender: {
+    300: "`#C9CFFF`",
+  },
 } as const;

Then reference via primitiveColors.blue[400] instead of "#4A60FF".

🤖 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/styles/tokens/colors/values.ts` around lines 126 - 196,
Several hardcoded hex values in the theme object (e.g., accent,
tokenSelectBackground, tokenSelectBorder, primaryButtonBackground,
tokenSelectHover, dashboardDetailsSectionBackground, etc.) should be extracted
into the existing primitiveColors palette and then referenced from values.ts;
update primitiveColors with named entries (e.g., blue.400, gray.100, lilac.200)
and replace literals in the theme keys (accent, primaryButtonBackground,
tokenSelectBackground, tokenSelectBorder, backgroundMuted,
dashboardDetailsSectionBackground, summaryItemBackground,
smallLightButtonBackground, etc.) to use primitiveColors.<name> so all colors
follow the established pattern and maintain consistency with the rest of the
file.

202-273: ⚡ Quick win

Consider extracting hardcoded hex values to primitiveColors for consistency.

Same pattern as light theme: multiple hardcoded hex values (e.g., "#171717", "#AB95FF", "#87899C", "#282828", "#333333") should be extracted to the primitiveColors object for consistency with the existing pattern and to improve maintainability.

🤖 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/styles/tokens/colors/values.ts` around lines 202 - 273,
Replace the hardcoded hex literals in this dark color values object with
references to the existing primitiveColors constants to match the light theme
pattern: replace values for keys such as primary, accent, textMuted,
tokenSelectBackground, tokenSelectHoverBackground, tokenSelectBorder,
backgroundMuted, tabBorder, skeletonLoaderBase, skeletonLoaderHighlight,
warningBoxBackground (if applicable), stakeSectionBackground,
dropdownBackground, tooltipBackground, primaryButtonBackground,
smallButtonBackground, smallLightButtonBackground, and summary*
backgrounds/colors with primitiveColors entries instead of inline hex strings;
update
connectKit.profileAction/profileActionHover/modalBackground/profileForeground to
use primitiveColors or vars.color aliases where appropriate so all hexes like
"`#171717`", "`#AB95FF`", "`#87899C`", "`#282828`", "`#333333`" are centralized in
primitiveColors and referenced here (keep keys such as primary, accent,
tokenSelect, connectKit, modalBodyBackground, etc., unchanged).
🤖 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/details/details-page/styles.css.ts`:
- Around line 39-51: The export name tabBorder is misleading since it represents
the active-tab underline rendered only when isSelected; rename the style export
(e.g., to activeTabIndicator) and update all references (notably the usage in
the Tab component in details-page/components/tab.tsx) to the new identifier so
the semantic purpose is clear—keep the style body unchanged, just change the
exported constant name and any imports/usages accordingly.

In `@packages/widget/src/styles/tokens/colors/values.ts`:
- Around line 126-196: Several hardcoded hex values in the theme object (e.g.,
accent, tokenSelectBackground, tokenSelectBorder, primaryButtonBackground,
tokenSelectHover, dashboardDetailsSectionBackground, etc.) should be extracted
into the existing primitiveColors palette and then referenced from values.ts;
update primitiveColors with named entries (e.g., blue.400, gray.100, lilac.200)
and replace literals in the theme keys (accent, primaryButtonBackground,
tokenSelectBackground, tokenSelectBorder, backgroundMuted,
dashboardDetailsSectionBackground, summaryItemBackground,
smallLightButtonBackground, etc.) to use primitiveColors.<name> so all colors
follow the established pattern and maintain consistency with the rest of the
file.
- Around line 202-273: Replace the hardcoded hex literals in this dark color
values object with references to the existing primitiveColors constants to match
the light theme pattern: replace values for keys such as primary, accent,
textMuted, tokenSelectBackground, tokenSelectHoverBackground, tokenSelectBorder,
backgroundMuted, tabBorder, skeletonLoaderBase, skeletonLoaderHighlight,
warningBoxBackground (if applicable), stakeSectionBackground,
dropdownBackground, tooltipBackground, primaryButtonBackground,
smallButtonBackground, smallLightButtonBackground, and summary*
backgrounds/colors with primitiveColors entries instead of inline hex strings;
update
connectKit.profileAction/profileActionHover/modalBackground/profileForeground to
use primitiveColors or vars.color aliases where appropriate so all hexes like
"`#171717`", "`#AB95FF`", "`#87899C`", "`#282828`", "`#333333`" are centralized in
primitiveColors and referenced here (keep keys such as primary, accent,
tokenSelect, connectKit, modalBodyBackground, etc., unchanged).

In `@packages/widget/tests/providers/theme-wrapper.test.ts`:
- Around line 7-34: Add tests for the "finery" branch of getThemeOverrides by
invoking getThemeOverrides({ baseTheme: lightTheme, variant: "finery" }) and
getThemeOverrides({ baseTheme: darkTheme, variant: "finery" }) and asserting the
returned overrides match the expected finery palettes (or saved snapshots) to
cover the computed logic path; place these cases inside the existing
describe("getThemeOverrides") block and reference getThemeOverrides, "finery",
lightTheme and darkTheme so regressions in finery palette computation are
caught.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7f2bab15-a9ba-4371-a7b8-1a604d1d2b8f

📥 Commits

Reviewing files that changed from the base of the PR and between ff7d013 and 527a60c.

📒 Files selected for processing (35)
  • packages/widget/src/components/atoms/button/styles.css.ts
  • packages/widget/src/components/atoms/divider/styles.css.ts
  • packages/widget/src/components/atoms/max-button/styles.css.ts
  • packages/widget/src/components/atoms/select-modal/styles.css.ts
  • packages/widget/src/components/molecules/chain-modal/index.tsx
  • packages/widget/src/components/molecules/estimated-reward-amounts/index.tsx
  • packages/widget/src/components/molecules/summary-item/index.css.ts
  • packages/widget/src/domain/types/yields.ts
  • packages/widget/src/main.tsx
  • packages/widget/src/pages-dashboard/common/components/styles.css.ts
  • packages/widget/src/pages-dashboard/common/components/tabs/styles.css.ts
  • packages/widget/src/pages-dashboard/overview/earn-page/index.tsx
  • packages/widget/src/pages-dashboard/overview/earn-page/styles.css.ts
  • packages/widget/src/pages-dashboard/overview/positions/styles.css.ts
  • packages/widget/src/pages/components/page-cta.tsx
  • packages/widget/src/pages/components/powered-by/index.tsx
  • packages/widget/src/pages/details/activity-page/components/activity-filters/index.tsx
  • packages/widget/src/pages/details/activity-page/components/activity-filters/styles.css.ts
  • packages/widget/src/pages/details/details-page/styles.css.ts
  • packages/widget/src/pages/details/earn-page/components/select-token-section/styles.css.ts
  • packages/widget/src/pages/details/earn-page/components/select-yield-section/index.tsx
  • packages/widget/src/pages/details/earn-page/components/select-yield-section/select-yield-reward-details.tsx
  • packages/widget/src/pages/details/earn-page/components/select-yield-section/styles.css.ts
  • packages/widget/src/pages/details/earn-page/state/earn-page-context.tsx
  • packages/widget/src/pages/position-details/components/amount-block.tsx
  • packages/widget/src/providers/theme-wrapper.tsx
  • packages/widget/src/standalone.css.ts
  • packages/widget/src/styles/theme/variant-overrides/finery.ts
  • packages/widget/src/styles/theme/variant-overrides/porto.ts
  • packages/widget/src/styles/theme/variant-overrides/utila.ts
  • packages/widget/src/styles/tokens/colors/contract.ts
  • packages/widget/src/styles/tokens/colors/values.ts
  • packages/widget/src/vite-env.d.ts
  • packages/widget/tests/domain/dashboard-yield-category-types.test.ts
  • packages/widget/tests/providers/theme-wrapper.test.ts

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

its only possible to connect the wallet in the "manage" tab

Image

if u are in the activity tab, we show the connect message, but no button to connect

Image

Can be done in a follow up

@Philippoes Philippoes merged commit 27e5f07 into main Jun 11, 2026
8 checks passed
@Philippoes Philippoes deleted the refactor/theme branch June 11, 2026 14:30
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