Skip to content

Commit 12e7c01

Browse files
committed
Update /usage and subscription banner labels/ui
1 parent a124b3e commit 12e7c01

File tree

3 files changed

+41
-40
lines changed

3 files changed

+41
-40
lines changed

cli/src/components/progress-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const ProgressBar: React.FC<ProgressBarProps> = ({
7272
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 0 }}>
7373
{label && <text style={{ fg: theme.muted }}>{label} </text>}
7474
<text style={{ fg: barColor }}>{filled}</text>
75-
<text style={{ fg: theme.muted }}>{empty}</text>
75+
{emptyWidth > 0 && <text style={{ fg: theme.muted }}>{empty}</text>}
7676
{showPercentage && (
7777
<text style={{ fg: textColor }}> {Math.round(clampedValue)}%</text>
7878
)}

cli/src/components/usage-banner.tsx

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ const formatRenewalDate = (dateStr: string | null): string => {
3232
const isToday = resetDate.toDateString() === today.toDateString()
3333
return isToday
3434
? resetDate.toLocaleString('en-US', {
35-
hour: 'numeric',
36-
minute: '2-digit',
37-
})
35+
hour: 'numeric',
36+
minute: '2-digit',
37+
})
3838
: resetDate.toLocaleDateString('en-US', {
39-
month: 'short',
40-
day: 'numeric',
41-
})
39+
month: 'short',
40+
day: 'numeric',
41+
})
4242
}
4343

4444
export const UsageBanner = ({ showTime }: { showTime: number }) => {
@@ -120,7 +120,7 @@ export const UsageBanner = ({ showTime }: { showTime: number }) => {
120120
<box style={{ flexDirection: 'column', marginBottom: 1 }}>
121121
<box style={{ flexDirection: 'row', gap: 1 }}>
122122
<text style={{ fg: theme.foreground }}>
123-
{subscriptionData.displayName ?? 'Strong'} subscription
123+
💪 {subscriptionData.displayName ?? 'Strong'} subscription
124124
</text>
125125
{subscriptionInfo?.tier && (
126126
<text style={{ fg: theme.muted }}>${subscriptionInfo.tier}/mo</text>
@@ -130,37 +130,38 @@ export const UsageBanner = ({ showTime }: { showTime: number }) => {
130130
<text style={{ fg: theme.muted }}>Loading subscription data...</text>
131131
) : rateLimit ? (
132132
<box style={{ flexDirection: 'column', gap: 0 }}>
133-
{/* Block progress - show if there's an active block */}
134-
{rateLimit.blockLimit != null && rateLimit.blockUsed != null && (
135-
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>
136-
<text style={{ fg: theme.muted }}>5h limit: </text>
137-
<ProgressBar
138-
value={Math.max(0, 100 - Math.round((rateLimit.blockUsed / rateLimit.blockLimit) * 100))}
139-
width={12}
140-
showPercentage={false}
141-
/>
142-
<text style={{ fg: theme.muted }}>
143-
{Math.max(0, 100 - Math.round((rateLimit.blockUsed / rateLimit.blockLimit) * 100))}% remaining
144-
</text>
145-
{rateLimit.blockResetsAt && (
133+
{/* Block progress - always show for Strong subscription */}
134+
{(() => {
135+
const blockPercent = rateLimit.blockLimit != null && rateLimit.blockUsed != null
136+
? Math.max(0, 100 - Math.round((rateLimit.blockUsed / rateLimit.blockLimit) * 100))
137+
: 100
138+
return (
139+
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 0 }}>
140+
<text style={{ fg: theme.muted }}>5-hour limit </text>
141+
<text style={{ fg: theme.muted }}>{`${blockPercent}%`.padStart(4)} </text>
142+
<ProgressBar value={blockPercent} width={12} showPercentage={false} />
146143
<text style={{ fg: theme.muted }}>
147-
· resets in {formatResetTime(new Date(rateLimit.blockResetsAt))}
144+
{rateLimit.blockResetsAt
145+
? ` resets in ${formatResetTime(new Date(rateLimit.blockResetsAt))}`
146+
: ''}
148147
</text>
149-
)}
150-
</box>
151-
)}
148+
</box>
149+
)
150+
})()}
152151
{/* Weekly progress */}
153-
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 1 }}>
154-
<text style={{ fg: theme.muted }}>Weekly limit:</text>
155-
<ProgressBar
156-
value={100 - rateLimit.weeklyPercentUsed}
157-
width={12}
158-
showPercentage={false}
159-
/>
160-
<text style={{ fg: theme.muted }}>
161-
{100 - rateLimit.weeklyPercentUsed}% remaining · resets in {formatResetTimeLong(rateLimit.weeklyResetsAt)}
162-
</text>
163-
</box>
152+
{(() => {
153+
const weeklyPercent = 100 - rateLimit.weeklyPercentUsed
154+
return (
155+
<box style={{ flexDirection: 'row', alignItems: 'center', gap: 0 }}>
156+
<text style={{ fg: theme.muted }}>Weekly limit </text>
157+
<text style={{ fg: theme.muted }}>{`${weeklyPercent}%`.padStart(4)} </text>
158+
<ProgressBar value={weeklyPercent} width={12} showPercentage={false} />
159+
<text style={{ fg: theme.muted }}>
160+
{' '}resets in {formatResetTimeLong(rateLimit.weeklyResetsAt)}
161+
</text>
162+
</box>
163+
)
164+
})()}
164165
</box>
165166
) : null}
166167
</box>

web/src/app/profile/components/subscription-section.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function SubscriptionActive({
148148
<div className="space-y-2">
149149
<div className="flex items-center justify-between text-sm">
150150
<span className="font-medium">
151-
Session
151+
5-hour limit
152152
{rateLimit.blockResetsAt && (
153153
<span className="font-normal text-muted-foreground ml-1.5">
154154
resets in {formatDaysHours(rateLimit.blockResetsAt)}
@@ -158,7 +158,7 @@ function SubscriptionActive({
158158
<span className="text-muted-foreground">
159159
{rateLimit.blockLimit != null && rateLimit.blockUsed != null && rateLimit.blockLimit > 0
160160
? `${Math.round(100 - (rateLimit.blockUsed / rateLimit.blockLimit) * 100)}%`
161-
: '100%'}
161+
: '100%'} remaining
162162
</span>
163163
</div>
164164
<ProgressBar
@@ -175,13 +175,13 @@ function SubscriptionActive({
175175
<div className="space-y-2">
176176
<div className="flex items-center justify-between text-sm">
177177
<span className="font-medium">
178-
Weekly
178+
Weekly limit
179179
<span className="font-normal text-muted-foreground ml-1.5">
180180
resets in {formatDaysHours(rateLimit.weeklyResetsAt)}
181181
</span>
182182
</span>
183183
<span className="text-muted-foreground">
184-
{100 - rateLimit.weeklyPercentUsed}%
184+
{100 - rateLimit.weeklyPercentUsed}% remaining
185185
</span>
186186
</div>
187187
<ProgressBar

0 commit comments

Comments
 (0)