From ae01f8d51a7a0cc4de04fde1313d6a7d2b35461f 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 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 | 20 ++ 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, 857 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 33aeba75b..79444bb4d 100644 --- a/packages/design-system/src/css/style.css +++ b/packages/design-system/src/css/style.css @@ -126,6 +126,11 @@ --content-hover-bg: #adadad; --content-hover-fg: #000; + --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); @@ -168,6 +173,15 @@ .dark-theme { --accent-primary: var(--color-pure-white); --backdrop: var(--color-neutral-900); + + --button-surface: var(--color-charcoal-600); + --button-surface-contrast: var(--color-white); + --button-hover-surface: var(--color-charcoal-600); + --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); --node-component-border: var(--color-stone-200); --node-component-border-error: var(--color-danger-100); @@ -196,6 +210,12 @@ @theme inline { --color-backdrop: var(--backdrop); + --color-button-active-surface: var(--button-active-surface); + --color-button-hover-surface: var(--button-hover-surface); + --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-node-component-border: var(--node-component-border); --color-node-component-executing: var(--node-component-executing); diff --git a/src/components/topbar/TopbarBadge.vue b/src/components/topbar/TopbarBadge.vue index f3916feba..514b65d08 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 54bdc97a5..734f4bac3 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -1931,18 +1931,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 @@