@@ -8,32 +8,16 @@ type UsageBarProps = {
8
8
current : number ;
9
9
billingLimit ?: number ;
10
10
tierLimit ?: number ;
11
- projectedUsage ?: number ;
12
11
isPaying : boolean ;
13
12
} ;
14
13
15
14
const startFactor = 4 ;
16
15
17
- export function UsageBar ( {
18
- current,
19
- billingLimit,
20
- tierLimit,
21
- projectedUsage,
22
- isPaying,
23
- } : UsageBarProps ) {
24
- const getLargestNumber = Math . max (
25
- current ,
26
- tierLimit ?? - Infinity ,
27
- projectedUsage ?? - Infinity ,
28
- billingLimit ?? - Infinity ,
29
- 5
30
- ) ;
16
+ export function UsageBar ( { current, billingLimit, tierLimit, isPaying } : UsageBarProps ) {
17
+ const getLargestNumber = Math . max ( current , tierLimit ?? - Infinity , billingLimit ?? - Infinity , 5 ) ;
31
18
//creates a maximum range for the progress bar, add 10% to the largest number so the bar doesn't reach the end
32
19
const maxRange = Math . round ( getLargestNumber * 1.1 ) ;
33
20
const tierRunLimitPercentage = tierLimit ? Math . round ( ( tierLimit / maxRange ) * 100 ) : 0 ;
34
- const projectedRunsPercentage = projectedUsage
35
- ? Math . round ( ( projectedUsage / maxRange ) * 100 )
36
- : 0 ;
37
21
const billingLimitPercentage =
38
22
billingLimit !== undefined ? Math . round ( ( billingLimit / maxRange ) * 100 ) : 0 ;
39
23
const usagePercentage = Math . round ( ( current / maxRange ) * 100 ) ;
@@ -42,7 +26,7 @@ export function UsageBar({
42
26
const usageCappedToLimitPercentage = Math . min ( usagePercentage , tierRunLimitPercentage ) ;
43
27
44
28
return (
45
- < div className = "h-fit w-full py-12 " >
29
+ < div className = "h-fit w-full py-6 " >
46
30
< div className = "relative h-3 w-full rounded-sm bg-background-bright" >
47
31
{ billingLimit !== undefined && (
48
32
< motion . div
@@ -93,23 +77,6 @@ export function UsageBar({
93
77
/>
94
78
</ motion . div >
95
79
) }
96
- { projectedUsage !== undefined && projectedUsage !== 0 && (
97
- < motion . div
98
- initial = { { width : projectedRunsPercentage / startFactor + "%" } }
99
- animate = { { width : projectedRunsPercentage + "%" } }
100
- transition = { { duration : 1.5 , type : "spring" } }
101
- style = { { width : `${ projectedRunsPercentage } %` } }
102
- className = "absolute h-3 rounded-l-sm"
103
- >
104
- < Legend
105
- text = "Projected:"
106
- value = { formatCurrency ( projectedUsage , false ) }
107
- position = "topRow2"
108
- percentage = { projectedRunsPercentage }
109
- />
110
- </ motion . div >
111
- ) }
112
-
113
80
< motion . div
114
81
initial = { { width : usageCappedToLimitPercentage / startFactor + "%" } }
115
82
animate = { { width : usageCappedToLimitPercentage + "%" } }
0 commit comments