From 527a60c7cac74ac2e4e5b698a2e2b6e4b89fa9ac Mon Sep 17 00:00:00 2001 From: Petar Todorovic Date: Thu, 11 Jun 2026 14:28:00 +0200 Subject: [PATCH] refactor(widget): align theme variant defaults 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. --- .../src/components/atoms/button/styles.css.ts | 6 ++ .../components/atoms/divider/styles.css.ts | 5 +- .../components/atoms/max-button/styles.css.ts | 17 ++-- .../atoms/select-modal/styles.css.ts | 17 +--- .../molecules/chain-modal/index.tsx | 5 +- .../estimated-reward-amounts/index.tsx | 8 +- .../molecules/summary-item/index.css.ts | 78 ++++++++++--------- packages/widget/src/domain/types/yields.ts | 16 ++-- packages/widget/src/main.tsx | 12 ++- .../common/components/styles.css.ts | 11 ++- .../common/components/tabs/styles.css.ts | 29 +++---- .../overview/earn-page/index.tsx | 6 +- .../overview/earn-page/styles.css.ts | 12 +-- .../overview/positions/styles.css.ts | 6 +- .../widget/src/pages/components/page-cta.tsx | 6 +- .../src/pages/components/powered-by/index.tsx | 3 + .../components/activity-filters/index.tsx | 4 +- .../components/activity-filters/styles.css.ts | 13 +++- .../pages/details/details-page/styles.css.ts | 2 +- .../select-token-section/styles.css.ts | 31 +++++--- .../components/select-yield-section/index.tsx | 17 ++-- .../select-yield-reward-details.tsx | 4 +- .../select-yield-section/styles.css.ts | 2 +- .../earn-page/state/earn-page-context.tsx | 14 +++- .../components/amount-block.tsx | 2 +- .../widget/src/providers/theme-wrapper.tsx | 47 ++++++----- packages/widget/src/standalone.css.ts | 2 +- .../styles/theme/variant-overrides/finery.ts | 2 +- .../styles/theme/variant-overrides/porto.ts | 12 +++ .../styles/theme/variant-overrides/utila.ts | 11 +++ .../src/styles/tokens/colors/contract.ts | 7 ++ .../widget/src/styles/tokens/colors/values.ts | 78 +++++++++++-------- packages/widget/src/vite-env.d.ts | 7 +- .../dashboard-yield-category-types.test.ts | 24 ++++++ .../tests/providers/theme-wrapper.test.ts | 48 ++++++++++++ 35 files changed, 368 insertions(+), 196 deletions(-) create mode 100644 packages/widget/tests/providers/theme-wrapper.test.ts diff --git a/packages/widget/src/components/atoms/button/styles.css.ts b/packages/widget/src/components/atoms/button/styles.css.ts index e5a4e3b3..d718b467 100644 --- a/packages/widget/src/components/atoms/button/styles.css.ts +++ b/packages/widget/src/components/atoms/button/styles.css.ts @@ -147,6 +147,12 @@ export const buttonStyle = recipe({ }, size: { regular: atoms({ minHeight: "buttonMinHeight" }), + compact: [ + atoms({ minHeight: "10" }), + { + borderRadius: vars.borderRadius.baseContract.lg, + }, + ], small: [ style({ padding: "9.8px 13.1px", diff --git a/packages/widget/src/components/atoms/divider/styles.css.ts b/packages/widget/src/components/atoms/divider/styles.css.ts index 8750164f..1da03a88 100644 --- a/packages/widget/src/components/atoms/divider/styles.css.ts +++ b/packages/widget/src/components/atoms/divider/styles.css.ts @@ -1,6 +1,5 @@ import { recipe } from "@vanilla-extract/recipes"; import { atoms } from "../../../styles/theme/atoms.css"; -import { utilaPalette } from "../../../styles/theme/variant-overrides/palettes"; export const divider = recipe({ base: atoms({ @@ -9,8 +8,8 @@ export const divider = recipe({ }), variants: { variant: { - default: atoms({ background: "backgroundMuted" }), - utila: { background: utilaPalette.tabPageDivider }, + default: atoms({ background: "tabBorder" }), + utila: atoms({ background: "tabBorder" }), }, }, defaultVariants: { diff --git a/packages/widget/src/components/atoms/max-button/styles.css.ts b/packages/widget/src/components/atoms/max-button/styles.css.ts index 1c044c3f..30eb950c 100644 --- a/packages/widget/src/components/atoms/max-button/styles.css.ts +++ b/packages/widget/src/components/atoms/max-button/styles.css.ts @@ -1,6 +1,5 @@ import { recipe } from "@vanilla-extract/recipes"; import { atoms } from "../../../styles/theme/atoms.css"; -import { utilaPalette } from "../../../styles/theme/variant-overrides/palettes"; export const container = recipe({ base: [ @@ -12,10 +11,13 @@ export const container = recipe({ ], variants: { variant: { - default: atoms({ background: "background", borderRadius: "xl" }), + default: atoms({ + background: "smallLightButtonBackground", + borderRadius: "base", + }), utila: [ { borderRadius: "4px" }, - { background: utilaPalette.maxButtonBackground }, + atoms({ background: "smallLightButtonBackground" }), ], }, }, @@ -27,11 +29,12 @@ export const container = recipe({ export const text = recipe({ variants: { variant: { - default: atoms({ color: "text", fontWeight: "semibold" }), + default: atoms({ + color: "smallLightButtonColor", + fontWeight: "normal", + }), utila: [ - { - color: utilaPalette.maxButtonText, - }, + atoms({ color: "smallLightButtonColor" }), atoms({ fontWeight: "normal", }), diff --git a/packages/widget/src/components/atoms/select-modal/styles.css.ts b/packages/widget/src/components/atoms/select-modal/styles.css.ts index 4b648868..9d26c0fb 100644 --- a/packages/widget/src/components/atoms/select-modal/styles.css.ts +++ b/packages/widget/src/components/atoms/select-modal/styles.css.ts @@ -2,7 +2,6 @@ import { keyframes, style } from "@vanilla-extract/css"; import { recipe } from "@vanilla-extract/recipes"; import { atoms } from "../../../styles/theme/atoms.css"; import { vars } from "../../../styles/theme/contract.css"; -import { utilaPalette } from "../../../styles/theme/variant-overrides/palettes"; import { breakpoints, minMediaQuery } from "../../../styles/tokens/breakpoints"; const slideUp = keyframes({ @@ -88,14 +87,12 @@ export const selectModalGroupLabel = style({ export const selectedListItem = recipe({ base: [ - atoms({ - background: "tokenSelectHoverBackground", - }), { + background: `color-mix(in srgb, ${vars.color.accent} 8%, transparent)`, border: `1px solid ${vars.color.accent}`, selectors: { "&:hover": { - background: vars.color.tokenSelectHoverBackground, + background: `color-mix(in srgb, ${vars.color.accent} 8%, transparent)`, }, }, }, @@ -103,15 +100,7 @@ export const selectedListItem = recipe({ variants: { variant: { default: {}, - utila: { - background: `${utilaPalette.primaryBlue}14`, - border: `1px solid ${utilaPalette.primaryBlue}`, - selectors: { - "&:hover": { - background: `${utilaPalette.primaryBlue}14`, - }, - }, - }, + utila: {}, }, }, defaultVariants: { diff --git a/packages/widget/src/components/molecules/chain-modal/index.tsx b/packages/widget/src/components/molecules/chain-modal/index.tsx index 8e8d703d..fa277f83 100644 --- a/packages/widget/src/components/molecules/chain-modal/index.tsx +++ b/packages/widget/src/components/molecules/chain-modal/index.tsx @@ -34,7 +34,10 @@ export const ChainModal = () => { display="flex" justifyContent="space-between" alignItems="center" - className={combineRecipeWithVariant({ variant, rec: container })} + className={combineRecipeWithVariant({ + variant, + rec: container, + })} onClick={() => { trackEvent("chainModalOpened"); openChainModal(); diff --git a/packages/widget/src/components/molecules/estimated-reward-amounts/index.tsx b/packages/widget/src/components/molecules/estimated-reward-amounts/index.tsx index 7d494eb5..1ea31e72 100644 --- a/packages/widget/src/components/molecules/estimated-reward-amounts/index.tsx +++ b/packages/widget/src/components/molecules/estimated-reward-amounts/index.tsx @@ -16,11 +16,11 @@ export const EstimatedRewardAmounts = ({ earnYearly, earnMonthly, }: EstimatedRewardAmountsProps) => { - const { variant } = useSettings(); + const { dashboardVariant, variant } = useSettings(); - if (variant === "utila" || variant === "porto") { + if (dashboardVariant || variant === "utila" || variant === "porto") { return ( - @@ -111,7 +111,7 @@ const DefaultEarnYearlyOrMonthly = ({ ); }; -const UtilaEarnYearlyOrMonthly = ({ +const CompactEarnYearlyOrMonthly = ({ earnMonthly, earnYearly, }: EstimatedRewardAmountsProps) => { diff --git a/packages/widget/src/components/molecules/summary-item/index.css.ts b/packages/widget/src/components/molecules/summary-item/index.css.ts index c5bb3764..ccd4a82c 100644 --- a/packages/widget/src/components/molecules/summary-item/index.css.ts +++ b/packages/widget/src/components/molecules/summary-item/index.css.ts @@ -1,11 +1,7 @@ import { type RecipeVariants, recipe } from "@vanilla-extract/recipes"; import { atoms } from "../../../styles/theme/atoms.css"; import { vars } from "../../../styles/theme/contract.css"; -import { - fineryLightPalette, - portoPalette, - utilaPalette, -} from "../../../styles/theme/variant-overrides/palettes"; +import { fineryLightPalette } from "../../../styles/theme/variant-overrides/palettes"; export const summaryContainer = recipe({ base: atoms({ @@ -15,11 +11,9 @@ export const summaryContainer = recipe({ }), variants: { variant: { - default: [ - atoms({ - gap: "8", - }), - ], + default: { + gap: "24px", + }, utila: { gap: "24px", }, @@ -53,18 +47,20 @@ export const summaryItem = recipe({ default: [ atoms({ background: "summaryItemBackground", + borderColor: "tabBorder", }), { - boxShadow: "0px 15px 30px 0px #0000000D", + borderRadius: "8px", + borderWidth: "1px", + borderStyle: "solid", }, ], utila: [ atoms({ background: "summaryItemBackground", - borderColor: "transparent", + borderColor: "tabBorder", }), { - borderColor: utilaPalette.border, borderRadius: "8px", borderWidth: "1px", borderStyle: "solid", @@ -99,9 +95,14 @@ export const summaryItem = recipe({ export const summaryNumber = recipe({ variants: { variant: { - default: { - fontSize: "28px", - }, + default: [ + atoms({ + fontWeight: "medium", + }), + { + fontSize: "18px", + }, + ], utila: [ atoms({ fontWeight: "medium", @@ -132,8 +133,8 @@ export const summaryLabelContainer = recipe({ variants: { variant: { default: { - borderRadius: "9px", - padding: "12px 10px", + borderRadius: "4px", + padding: "2px 6px", }, utila: { borderRadius: "4px", @@ -150,16 +151,16 @@ export const summaryLabelContainer = recipe({ }, type: { staked: { - background: "#F0EDFA", - color: "#5A36C0", + background: vars.color.summaryLabelStakedBackground, + color: vars.color.summaryLabelStakedColor, }, apy: { - background: "#EDF1F5", - color: "#0059AB", + background: vars.color.summaryLabelApyBackground, + color: vars.color.summaryLabelApyColor, }, available: { - background: "#EDF6F3", - color: "#00794E", + background: vars.color.summaryLabelAvailableBackground, + color: vars.color.summaryLabelAvailableColor, }, }, }, @@ -170,8 +171,8 @@ export const summaryLabelContainer = recipe({ type: "staked", }, style: { - background: "#F6F0FF", - color: "#5A36C0", + background: vars.color.summaryLabelStakedBackground, + color: vars.color.summaryLabelStakedColor, }, }, { @@ -180,8 +181,8 @@ export const summaryLabelContainer = recipe({ type: "apy", }, style: { - background: "#F7ECFA", - color: "#CA6CBD", + background: vars.color.summaryLabelApyBackground, + color: vars.color.summaryLabelApyColor, }, }, { @@ -190,8 +191,8 @@ export const summaryLabelContainer = recipe({ type: "available", }, style: { - background: "#EEF7F3", - color: "#327C5F", + background: vars.color.summaryLabelAvailableBackground, + color: vars.color.summaryLabelAvailableColor, }, }, { @@ -231,8 +232,8 @@ export const summaryLabelContainer = recipe({ }, style: [ { - color: "white", - background: portoPalette.greyThree, + color: vars.color.summaryLabelStakedColor, + background: vars.color.summaryLabelStakedBackground, }, ], }, @@ -243,8 +244,8 @@ export const summaryLabelContainer = recipe({ }, style: [ { - color: "white", - background: portoPalette.greyThree, + color: vars.color.summaryLabelApyColor, + background: vars.color.summaryLabelApyBackground, }, ], }, @@ -255,8 +256,8 @@ export const summaryLabelContainer = recipe({ }, style: [ { - color: "white", - background: portoPalette.greyThree, + color: vars.color.summaryLabelAvailableColor, + background: vars.color.summaryLabelAvailableBackground, }, ], }, @@ -266,7 +267,10 @@ export const summaryLabelContainer = recipe({ export const summaryLabel = recipe({ variants: { variant: { - default: {}, + default: { + color: "inherit", + fontSize: "12px", + }, utila: { color: "inherit", fontSize: "12px", diff --git a/packages/widget/src/domain/types/yields.ts b/packages/widget/src/domain/types/yields.ts index 52855af7..d34df06d 100644 --- a/packages/widget/src/domain/types/yields.ts +++ b/packages/widget/src/domain/types/yields.ts @@ -412,14 +412,14 @@ export const getYieldTypeLabels = ( }; const yieldTypesSortRank: { [Key in ExtendedYieldType]: number } = { - staking: 1, - native_staking: 2, - pooled_staking: 3, - restaking: 4, - lending: 5, - vault: 6, - fixed_yield: 7, - real_world_asset: 8, + real_world_asset: 1, + staking: 2, + native_staking: 3, + pooled_staking: 4, + restaking: 5, + lending: 6, + vault: 7, + fixed_yield: 8, liquidity_pool: 9, concentrated_liquidity_pool: 10, }; diff --git a/packages/widget/src/main.tsx b/packages/widget/src/main.tsx index 34b7287f..264da889 100644 --- a/packages/widget/src/main.tsx +++ b/packages/widget/src/main.tsx @@ -1,5 +1,6 @@ import ReactDOM from "react-dom/client"; import { SKApp, type SKAppProps } from "./App"; +import type { VariantProps } from "./providers/settings/types"; import { rootClassName, toggleThemeButtonClassName, @@ -9,17 +10,22 @@ import "./standalone.css"; import { useLayoutEffect, useState } from "react"; import { darkTheme, lightTheme } from "./styles/theme/themes"; -const variant: SKAppProps["variant"] = +type StandaloneVariant = Exclude; + +const variant: StandaloneVariant = import.meta.env.VITE_APP_VARIANT ?? "default"; const dashboardVariant: SKAppProps["dashboardVariant"] = import.meta.env.VITE_FORCE_DASHBOARD === "true"; const StandaloneApp = () => { - const [themeVariant, setThemeVariant] = useState<"dark" | "light">("light"); + const [themeVariant, setThemeVariant] = useState<"dark" | "light">("dark"); useLayoutEffect(() => { - document.body.className = rootClassName({ theme: themeVariant, variant }); + document.body.className = rootClassName({ + theme: themeVariant, + variant, + }); }, [themeVariant]); const toggleTheme = () => diff --git a/packages/widget/src/pages-dashboard/common/components/styles.css.ts b/packages/widget/src/pages-dashboard/common/components/styles.css.ts index 81898f29..bf83fa85 100644 --- a/packages/widget/src/pages-dashboard/common/components/styles.css.ts +++ b/packages/widget/src/pages-dashboard/common/components/styles.css.ts @@ -1,6 +1,5 @@ import { recipe } from "@vanilla-extract/recipes"; import { atoms } from "../../../styles/theme/atoms.css"; -import { utilaPalette } from "../../../styles/theme/variant-overrides/palettes"; export const wrapper = recipe({ base: [ @@ -18,7 +17,7 @@ export const wrapper = recipe({ variants: { variant: { default: { - borderRadius: "30px", + borderRadius: "14px", }, utila: { borderRadius: "14px", @@ -80,13 +79,13 @@ export const tabPageDivider = recipe({ variant: { default: [ atoms({ - background: "backgroundMuted", + background: "tabBorder", }), ], utila: [ - { - background: utilaPalette.tabPageDivider, - }, + atoms({ + background: "tabBorder", + }), ], }, }, diff --git a/packages/widget/src/pages-dashboard/common/components/tabs/styles.css.ts b/packages/widget/src/pages-dashboard/common/components/tabs/styles.css.ts index e6a0e68a..7be421e5 100644 --- a/packages/widget/src/pages-dashboard/common/components/tabs/styles.css.ts +++ b/packages/widget/src/pages-dashboard/common/components/tabs/styles.css.ts @@ -1,10 +1,7 @@ import { style } from "@vanilla-extract/css"; import { recipe } from "@vanilla-extract/recipes"; import { atoms } from "../../../../styles/theme/atoms.css"; -import { - portoPalette, - utilaPalette, -} from "../../../../styles/theme/variant-overrides/palettes"; +import { vars } from "../../../../styles/theme/contract.css"; export const divider = style({ position: "absolute", @@ -36,7 +33,7 @@ export const tab = recipe({ variant: { default: [ { - borderRadius: "9999px", + borderRadius: "8px", padding: "8px 16px", }, ], @@ -70,7 +67,7 @@ export const tab = recipe({ state: "active", variant: "utila", }, - style: [{ background: utilaPalette.greyOne }], + style: [atoms({ background: "stakeSectionBackground" })], }, { variants: { @@ -104,9 +101,7 @@ export const tabContainer = recipe({ }, variants: { variant: { - default: { - minWidth: "74px", - }, + default: {}, utila: {}, porto: {}, finery: { @@ -131,7 +126,12 @@ export const tabText = recipe({ selected: {}, }, variant: { - default: {}, + default: [ + atoms({ fontWeight: "semibold" }), + { + fontSize: "14px", + }, + ], utila: [ atoms({ fontWeight: "semibold" }), { @@ -139,9 +139,8 @@ export const tabText = recipe({ }, ], porto: [ - atoms({ fontWeight: "semibold" }), + atoms({ color: "textMuted", fontWeight: "semibold" }), { - color: portoPalette.greyFour, fontSize: "14px", }, ], @@ -154,7 +153,7 @@ export const tabText = recipe({ state: "selected", }, style: { - color: portoPalette.greyOne, + color: vars.color.background, }, }, ], @@ -177,7 +176,9 @@ export const tabsContainer = recipe({ variant: { default: { gap: "4px", - padding: "16px 24px", + padding: "8px", + paddingLeft: "24px", + paddingRight: "24px", }, utila: { gap: "4px", diff --git a/packages/widget/src/pages-dashboard/overview/earn-page/index.tsx b/packages/widget/src/pages-dashboard/overview/earn-page/index.tsx index aa803d9d..baf87f55 100644 --- a/packages/widget/src/pages-dashboard/overview/earn-page/index.tsx +++ b/packages/widget/src/pages-dashboard/overview/earn-page/index.tsx @@ -31,7 +31,7 @@ const EarnKycGateSection = () => { }; export const EarnPageContent = () => { - const { variant } = useSettings(); + const { dashboardVariant, variant } = useSettings(); const { cta } = useEarnPageContext(); return ( @@ -55,7 +55,9 @@ export const EarnPageContent = () => { - {(variant === "utila" || variant === "porto") && } + {(dashboardVariant || variant === "utila" || variant === "porto") && ( + + )}