5757 role =" progressbar"
5858 :aria-valuenow =" usage.used"
5959 :aria-valuemin =" 0"
60- :aria-valuemax =" monthlyTotalCredits ?? 0"
60+ :aria-valuemax =" creditPoolTotalCredits ?? 0"
6161 :aria-valuetext =" monthlyUsageLabel"
6262 class =" h-2 w-full overflow-hidden rounded-full bg-secondary-background-hover"
6363 >
8686 {{
8787 $t('subscription.creditsLeftOfTotal', {
8888 remaining: monthlyBonusCredits,
89- total: monthlyTotalDisplay
89+ total: creditPoolTotalDisplay
9090 })
9191 }}
9292 </span >
9393 <span class =" hidden @max-[180px]:inline" >
9494 {{
9595 $t('subscription.creditsLeftOfTotal', {
9696 remaining: monthlyRemainingCompact,
97- total: monthlyTotalCompact
97+ total: creditPoolTotalCompact
9898 })
9999 }}
100100 </span >
@@ -233,16 +233,20 @@ const tierKey = computed(() => {
233233 return TIER_TO_KEY [tier ] ?? DEFAULT_TIER_KEY
234234})
235235
236- const monthlyTotalCredits = computed <number | null >(() => {
237- const teamStop = currentTeamCreditStop .value
238- if (teamStop ) return teamStop .credits_monthly
239- return getTierCredits (tierKey .value )
236+ const creditPoolTotalCredits = computed <number | null >(() => {
237+ const monthlyCredits =
238+ currentTeamCreditStop .value ?.credits_monthly ??
239+ getTierCredits (tierKey .value )
240+ if (monthlyCredits === null ) return null
241+ return subscription .value ?.duration === ' ANNUAL'
242+ ? monthlyCredits * 12
243+ : monthlyCredits
240244})
241245
242246const usage = computed (() =>
243247 computeMonthlyUsage (
244248 monthlyBonusCreditsValue .value ,
245- monthlyTotalCredits .value ?? 0
249+ creditPoolTotalCredits .value ?? 0
246250 )
247251)
248252
@@ -270,8 +274,8 @@ const formatCreditCount = (value: number) =>
270274 numberOptions: { maximumFractionDigits: 0 }
271275 })
272276
273- const monthlyTotalDisplay = computed (() => {
274- const total = monthlyTotalCredits .value
277+ const creditPoolTotalDisplay = computed (() => {
278+ const total = creditPoolTotalCredits .value
275279 return total === null ? ' —' : formatCreditCount (total )
276280})
277281
@@ -283,8 +287,8 @@ const compactNumber = computed(
283287const monthlyRemainingCompact = computed (() =>
284288 compactNumber .value .format (monthlyBonusCreditsValue .value )
285289)
286- const monthlyTotalCompact = computed (() => {
287- const total = monthlyTotalCredits .value
290+ const creditPoolTotalCompact = computed (() => {
291+ const total = creditPoolTotalCredits .value
288292 return total === null ? ' —' : compactNumber .value .format (total )
289293})
290294
@@ -296,16 +300,16 @@ const usedBarWidth = computed(
296300const monthlyUsageLabel = computed (() =>
297301 t (' subscription.monthlyUsageProgress' , {
298302 used: usedDisplay .value ,
299- total: monthlyTotalDisplay .value
303+ total: creditPoolTotalDisplay .value
300304 })
301305)
302306
303307const showBreakdown = computed (() => isActiveSubscription .value && ! zeroState )
304308const showBar = computed (
305309 () =>
306310 showBreakdown .value &&
307- monthlyTotalCredits .value !== null &&
308- monthlyTotalCredits .value > 0
311+ creditPoolTotalCredits .value !== null &&
312+ creditPoolTotalCredits .value > 0
309313)
310314const showActionButton = computed (
311315 () => isActiveSubscription .value && ! zeroState && permissions .value .canTopUp
0 commit comments