From daa9aff1f3a3fa6730d58a4f981b7a6afaf79e7e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Thu, 30 Oct 2025 22:11:13 -0700 Subject: [PATCH] [Backport] update subscription panel for new designs (#6397) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Backport of PR #6378 to `rh-test` branch. ## Changes - Extract credit calculations into useSubscriptionCredits composable - Extract action handlers into useSubscriptionActions composable - Add comprehensive component and unit tests - Update subscription panel layout to match Figma design exactly - Add proper design tokens for modal card surfaces - Update terminology from "API Nodes" to "Partner Nodes" - Make credit breakdown dynamic with real API data - Add proper loading states and error handling - Remove unused tailwindcss eslint dependencies ## Conflicts Resolved - Resolved merge conflicts in `packages/design-system/src/css/style.css` related to button surface CSS variables ## Test plan - Existing tests pass - New tests for subscription composables and components ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6397-Backport-update-subscription-panel-for-new-designs-29c6d73d3650812aaa12ff242fd5e078) by [Unito](https://www.unito.io) --------- Co-authored-by: Claude Co-authored-by: GitHub Action Co-authored-by: Johnpaul Chiwetelu <49923152+Myestery@users.noreply.github.com> --- 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 @@