From 1bf5b5397dd1fdc177bd8a801500e66a9cc549a7 Mon Sep 17 00:00:00 2001 From: Simula_r <18093452+simula-r@users.noreply.github.com> Date: Thu, 8 Jan 2026 19:22:50 -0800 Subject: [PATCH] Feat(cloud)/new top up dialog (#7899) ## Summary - Implement the new add credits (top up) dialog. - Refactor the subscription dialog to make different credit types easier to understand ## Changes - **What**: TopUpCreditsDialogContent.vue, SubscriptionPanel.vue, /en/main.json - **Breaking**: - **Dependencies**: ## Review Focus https://github.com/user-attachments/assets/a6454651-e195-4430-bfcc-0f2a8c1dc80b Relevant notion links: https://www.notion.so/comfy-org/Implement-New-Top-Up-Dialog-with-Custom-Amount-Input-2df6d73d36508142b901fc0edb0d1fc1?source=copy_link https://www.notion.so/comfy-org/Implement-Update-confusing-credits-remaining-this-month-message-2df6d73d36508168b7e5ed46754cec60?source=copy_link --- .../content/TopUpCreditsDialogContent.vue | 327 +++++++++++------- .../ui/stepper/FormattedNumberStepper.vue | 176 ++++++++++ src/locales/en/main.json | 27 +- .../components/SubscriptionPanel.test.ts | 3 + .../components/SubscriptionPanel.vue | 157 +++++---- src/services/dialogService.ts | 3 +- 6 files changed, 496 insertions(+), 197 deletions(-) create mode 100644 src/components/ui/stepper/FormattedNumberStepper.vue diff --git a/src/components/dialog/content/TopUpCreditsDialogContent.vue b/src/components/dialog/content/TopUpCreditsDialogContent.vue index ce061300a..0a2884daf 100644 --- a/src/components/dialog/content/TopUpCreditsDialogContent.vue +++ b/src/components/dialog/content/TopUpCreditsDialogContent.vue @@ -1,180 +1,259 @@ diff --git a/src/locales/en/main.json b/src/locales/en/main.json index babf0113c..e804414ab 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -10,8 +10,10 @@ "downloadVideo": "Download video", "editOrMaskImage": "Edit or mask image", "editImage": "Edit image", + "decrement": "Decrement", "deleteImage": "Delete image", "deleteAudioFile": "Delete audio file", + "increment": "Increment", "removeImage": "Remove image", "removeVideo": "Remove video", "chart": "Chart", @@ -1918,12 +1920,25 @@ "insufficientWorkflowMessage": "You don't have enough credits to run this workflow.", "creditsDescription": "Credits are used to run workflows or partner nodes.", "howManyCredits": "How many credits would you like to add?", - "videosEstimate": "~{count} videos", + "usdAmount": "${amount}", + "videosEstimate": "~{count} videos*", "templateNote": "*Generated with Wan Fun Control template", "buy": "Buy", "purchaseError": "Purchase Failed", "purchaseErrorDetail": "Failed to purchase credits: {error}", - "unknownError": "An unknown error occurred" + "unknownError": "An unknown error occurred", + "viewPricing": "View pricing details", + "youPay": "Amount (USD)", + "youGet": "Credits", + "buyCredits": "Continue to payment", + "minimumPurchase": "${amount} minimum ({credits} credits)", + "maximumAmount": "${amount} max.", + "creditsPerDollar": "credits per dollar", + "amountToPayLabel": "Amount to pay in dollars", + "creditsToReceiveLabel": "Credits to receive", + "selectAmount": "Select amount", + "needMore": "Need more?", + "contactUs": "Contact us" }, "creditsAvailable": "Credits available", "refreshes": "Refreshes {date}", @@ -1960,9 +1975,9 @@ "monthlyBonusDescription": "Monthly credit bonus", "prepaidDescription": "Pre-paid credits", "prepaidCreditsInfo": "Pre-paid credits expire after 1 year from purchase date.", - "creditsRemainingThisMonth": "Credits remaining this month", - "creditsRemainingThisYear": "Credits remaining this year", - "creditsYouveAdded": "Credits you've added", + "creditsRemainingThisMonth": "Included (Refills {date})", + "creditsRemainingThisYear": "Included (Refills {date})", + "creditsYouveAdded": "Additional", "monthlyCreditsInfo": "These credits refresh monthly and don't roll over", "viewMoreDetailsPlans": "View more details about plans & pricing", "nextBillingCycle": "next billing cycle", @@ -2017,7 +2032,7 @@ "subscribeTo": "Subscribe to {plan}", "monthlyCreditsLabel": "Monthly credits", "yearlyCreditsLabel": "Total yearly credits", - "maxDurationLabel": "Max duration of each workflow run", + "maxDurationLabel": "Max run duration", "gpuLabel": "RTX 6000 Pro (96GB VRAM)", "addCreditsLabel": "Add more credits whenever", "customLoRAsLabel": "Import your own LoRAs", diff --git a/src/platform/cloud/subscription/components/SubscriptionPanel.test.ts b/src/platform/cloud/subscription/components/SubscriptionPanel.test.ts index 364622446..04cbbbbed 100644 --- a/src/platform/cloud/subscription/components/SubscriptionPanel.test.ts +++ b/src/platform/cloud/subscription/components/SubscriptionPanel.test.ts @@ -33,6 +33,9 @@ const mockSubscriptionData = { const baseName = TIER_TO_NAME[mockSubscriptionTier.value] return mockIsYearlySubscription.value ? `${baseName} Yearly` : baseName }), + subscriptionStatus: computed(() => ({ + renewal_date: '2024-12-31T00:00:00Z' + })), isYearlySubscription: computed(() => mockIsYearlySubscription.value), handleInvoiceHistory: vi.fn() } diff --git a/src/platform/cloud/subscription/components/SubscriptionPanel.vue b/src/platform/cloud/subscription/components/SubscriptionPanel.vue index a2d246a19..9017dee39 100644 --- a/src/platform/cloud/subscription/components/SubscriptionPanel.vue +++ b/src/platform/cloud/subscription/components/SubscriptionPanel.vue @@ -84,8 +84,8 @@ -
-
+
+
- +
@@ -120,60 +120,39 @@
-
-
- -
- {{ monthlyBonusCredits }} -
-
-
+ + + + + + + + + + +
+ + {{ includedCreditsDisplay }} + {{ creditsRemainingLabel }} - - - -
- -
- {{ prepaidCredits }} -
-
-
+
+ + {{ prepaidCredits }} + {{ $t('subscription.creditsYouveAdded') }} - - - - - +
-
+
{{ $t('subscription.yourPlanIncludes') }}
@@ -288,7 +267,7 @@