fix: show Cursor plan limit progress
Calculates plan limit usage from remaining balance Restores the Cursor plan limit progress bar
This commit is contained in:
@@ -230,8 +230,12 @@ const buildWindows = (usage, plan) => {
|
|||||||
|
|
||||||
const planLimit = centsLabel(planUsage.limit);
|
const planLimit = centsLabel(planUsage.limit);
|
||||||
if (planLimit) {
|
if (planLimit) {
|
||||||
|
const limit = toNumber(planUsage.limit);
|
||||||
|
const remaining = toNumber(planUsage.remaining);
|
||||||
windows.plan_limit = toUsageWindow({
|
windows.plan_limit = toUsageWindow({
|
||||||
usedPercent: null,
|
usedPercent: limit && remaining !== null
|
||||||
|
? Math.min(100, Math.max(0, ((limit - remaining) / limit) * 100))
|
||||||
|
: null,
|
||||||
windowSeconds,
|
windowSeconds,
|
||||||
resetAt,
|
resetAt,
|
||||||
valueLabel: `${centsLabel(planUsage.remaining) ?? '$0.00'} remaining of ${planLimit}`
|
valueLabel: `${centsLabel(planUsage.remaining) ?? '$0.00'} remaining of ${planLimit}`
|
||||||
|
|||||||
Reference in New Issue
Block a user