From 5e9a9923e4198ffe3f5e8b0f5ef41a46f3bd9d22 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Wed, 29 Oct 2025 20:15:30 -0700 Subject: [PATCH] update subscription panel for new designs (#6378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Refactoring of subscription panel to improve maintainability and match Figma design exactly. Extracted business logic into `useSubscriptionCredits` and `useSubscriptionActions` composables, added comprehensive testing, and enhanced the design system with proper semantic tokens. - Extract credit calculations and action handlers into reusable composables - Add component and unit tests with proper mocking patterns - Update terminology from "API Nodes" to "Partner Nodes" - Make credit breakdown dynamic using real API data instead of hardcoded values - Add semantic design tokens for modal card surfaces with light/dark theme support - Reduce component complexity from ~100 lines to ~25 lines of logic - Improve layout spacing, typography, and responsive behavior to match Figma specs Selection_2220 Selection_2219 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6378-update-subscription-panel-for-new-designs-29b6d73d3650815c9ce2c5977ac7f893) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude --- packages/design-system/src/css/style.css | 5 + src/components/topbar/TopbarBadge.vue | 6 +- src/locales/en/main.json | 12 +- .../components/SubscriptionBenefits.vue | 23 +- .../components/SubscriptionPanel.vue | 329 ++++++++++-------- .../composables/useSubscriptionActions.ts | 66 ++++ .../composables/useSubscriptionCredits.ts | 61 ++++ src/services/dialogService.ts | 1 + .../components/SubscriptionPanel.test.ts | 213 ++++++++++++ .../useSubscriptionActions.test.ts | 137 ++++++++ .../useSubscriptionCredits.test.ts | 146 ++++++++ 11 files changed, 842 insertions(+), 157 deletions(-) create mode 100644 src/platform/cloud/subscription/composables/useSubscriptionActions.ts create mode 100644 src/platform/cloud/subscription/composables/useSubscriptionCredits.ts create mode 100644 tests-ui/tests/platform/cloud/subscription/components/SubscriptionPanel.test.ts create mode 100644 tests-ui/tests/platform/cloud/subscription/composables/useSubscriptionActions.test.ts create mode 100644 tests-ui/tests/platform/cloud/subscription/composables/useSubscriptionCredits.test.ts diff --git a/packages/design-system/src/css/style.css b/packages/design-system/src/css/style.css index f5b3877be..05aca6b16 100644 --- a/packages/design-system/src/css/style.css +++ b/packages/design-system/src/css/style.css @@ -157,6 +157,8 @@ --button-surface: var(--color-white); --button-surface-contrast: var(--color-black); + --modal-card-button-surface: var(--color-smoke-300); + /* Code styling colors for help menu*/ --code-text-color: rgb(0 122 255 / 1); --code-bg-color: rgb(96 165 250 / 0.2); @@ -256,6 +258,8 @@ --button-active-surface: var(--color-charcoal-600); --button-icon: var(--color-smoke-800); + --modal-card-button-surface: var(--color-charcoal-300); + --dialog-surface: var(--color-neutral-700); --interface-menu-component-surface-hovered: var(--color-charcoal-400); @@ -328,6 +332,7 @@ --color-button-icon: var(--button-icon); --color-button-surface: var(--button-surface); --color-button-surface-contrast: var(--button-surface-contrast); + --color-modal-card-button-surface: var(--modal-card-button-surface); --color-dialog-surface: var(--dialog-surface); --color-interface-menu-component-surface-hovered: var( --interface-menu-component-surface-hovered diff --git a/src/components/topbar/TopbarBadge.vue b/src/components/topbar/TopbarBadge.vue index bbae35ba0..83dd43527 100644 --- a/src/components/topbar/TopbarBadge.vue +++ b/src/components/topbar/TopbarBadge.vue @@ -37,7 +37,7 @@ > {{ badge.label }} -
{{ badge.text }}
+
{{ badge.text }}
{{ badge.tooltip }}
@@ -90,7 +90,7 @@ > {{ badge.label }} -
{{ badge.text }}
+
{{ badge.text }}
{{ badge.tooltip }}
@@ -117,7 +117,7 @@ > {{ badge.label }} -
+
{{ badge.text }}
diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 567919d2b..51037d036 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -1654,18 +1654,24 @@ "renewsDate": "Renews {date}", "expiresDate": "Expires {date}", "manageSubscription": "Manage subscription", - "apiNodesBalance": "\"API Nodes\" Credit Balance", - "apiNodesDescription": "For running commercial/proprietary models", + "partnerNodesBalance": "\"Partner Nodes\" Credit Balance", + "partnerNodesDescription": "For running commercial/proprietary models", "totalCredits": "Total credits", "viewUsageHistory": "View usage history", "addApiCredits": "Add API credits", + "addCredits": "Add credits", + "monthlyCreditsRollover": "These credits will rollover to the next month", + "monthlyBonusDescription": "Monthly credit bonus", + "prepaidDescription": "Pre-paid credits", + "prepaidCreditsInfo": "Credits purchased separately that don't expire", + "nextBillingCycle": "next billing cycle", "yourPlanIncludes": "Your plan includes:", "viewMoreDetails": "View more details", "learnMore": "Learn more", "messageSupport": "Message support", "invoiceHistory": "Invoice history", "benefits": { - "benefit1": "$10 in monthly credits for API models — top up when needed", + "benefit1": "Monthly credits for Partner Nodes — top up when needed", "benefit2": "Up to 30 min runtime per job" }, "required": { diff --git a/src/platform/cloud/subscription/components/SubscriptionBenefits.vue b/src/platform/cloud/subscription/components/SubscriptionBenefits.vue index 101a399f6..177a4afb2 100644 --- a/src/platform/cloud/subscription/components/SubscriptionBenefits.vue +++ b/src/platform/cloud/subscription/components/SubscriptionBenefits.vue @@ -1,15 +1,15 @@