@devries-cameron20 / t3code-1 / commits / 564719165e
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): keep usage widget rows consistently sized (#11669)

Julius Marminge committed Sep 13, 2026 at 19:45 UTC 564719165e9131ab2aa55e9c805b860a415690da
1 file changed +29 -30
apps/mobile/src/widgets/SubscriptionUsage.tsx
+29 -30
@@ -2,12 +2,12 @@ import { HStack, ProgressView, Spacer, Text, VStack } from "@expo/ui/swift-ui";
2 import {
3 accessibilityElement,
4 accessibilityLabel,
5 + fixedSize,
6 font,
7 foregroundStyle,
8 frame,
9 layoutPriority,
10 lineLimit,
10 - minimumScaleFactor,
11 progressViewStyle,
12 tint,
13 widgetURL,
@@ -33,6 +33,8 @@ function SubscriptionUsage(
33 const accessory = family === "accessoryRectangular";
34 const compact =
35 family === "systemSmall" || accessory || environment.levelOfDetail === "simplified";
36 + // Budget short cards for two quotas per provider, including their secondary text.
37 + const dense = family === "systemSmall" || family === "systemMedium";
38 const limit = family === "systemExtraLarge" ? 6 : family === "systemLarge" ? 4 : 2;
39 const monochrome =
40 environment.widgetRenderingMode !== "fullColor" || environment.isLuminanceReduced;
@@ -77,6 +79,7 @@ function SubscriptionUsage(
79 : provider.detail;
80 const barModifiers = [
81 progressViewStyle("linear"),
82 + frame({ height: 4 }),
83 ...(monochrome ? [] : [tint(provider.name === "Claude" ? "#d97757" : "#8e8e93")]),
84 ];
85 if (accessory) {
@@ -99,7 +102,6 @@ function SubscriptionUsage(
102 modifiers={[
103 font({ textStyle: "caption", weight: "semibold" }),
104 lineLimit(1),
102 - minimumScaleFactor(0.75),
105 foregroundStyle("primary"),
106 ]}
107 >
@@ -132,35 +134,37 @@ function SubscriptionUsage(
134 <VStack
135 key={provider.name}
136 alignment="leading"
135 - spacing={compact ? 2 : 4}
136 - modifiers={[frame({ maxWidth: Infinity, alignment: "leading" })]}
137 + spacing={dense ? 1 : compact ? 2 : 4}
138 + modifiers={[
139 + frame({ maxWidth: Infinity, alignment: "leading" }),
140 + fixedSize({ horizontal: false, vertical: true }),
141 + ]}
142 >
143 <Text
144 modifiers={[
145 font({ textStyle: compact ? "caption" : "headline", weight: "bold" }),
146 lineLimit(1),
142 - minimumScaleFactor(0.75),
147 foregroundStyle("primary"),
148 ]}
149 >
150 {provider.name}
151 </Text>
148 - {(!compact || shown.length === 0) && detail !== "Subscription remaining" ? (
152 + {!compact || shown.length === 0 ? (
153 <Text
154 modifiers={[
155 font({ textStyle: "caption2" }),
156 foregroundStyle("secondary"),
153 - lineLimit(compact ? 1 : 2),
157 + lineLimit(1),
158 ]}
159 >
156 - {detail}
160 + {detail === "Subscription remaining" ? " " : detail}
161 </Text>
162 ) : null}
163 {shown.map((window) => (
164 <VStack
165 key={window.label}
166 alignment="leading"
163 - spacing={2}
167 + spacing={dense ? 1 : 2}
168 modifiers={[
169 accessibilityElement("ignore"),
170 accessibilityLabel(
@@ -171,10 +175,9 @@ function SubscriptionUsage(
175 <HStack spacing={4}>
176 <Text
177 modifiers={[
174 - font({ textStyle: compact ? "caption2" : "caption" }),
178 + font({ textStyle: compact || dense ? "caption2" : "caption" }),
179 foregroundStyle("secondary"),
180 lineLimit(1),
177 - minimumScaleFactor(0.75),
181 ]}
182 >
183 {window.label}
@@ -182,9 +185,11 @@ function SubscriptionUsage(
185 <Spacer />
186 <Text
187 modifiers={[
185 - font({ textStyle: compact ? "caption2" : "caption", weight: "semibold" }),
188 + font({
189 + textStyle: compact || dense ? "caption2" : "caption",
190 + weight: "semibold",
191 + }),
192 lineLimit(1),
187 - minimumScaleFactor(0.75),
193 layoutPriority(1),
194 foregroundStyle(
195 window.remaining <= 10 && !monochrome
@@ -200,14 +205,7 @@ function SubscriptionUsage(
205 </HStack>
206 <ProgressView value={window.remaining / 100} modifiers={barModifiers} />
207 {!compact ? (
203 - <Text
204 - modifiers={[
205 - font({ textStyle: "caption2" }),
206 - foregroundStyle("secondary"),
207 - lineLimit(1),
208 - minimumScaleFactor(0.75),
209 - ]}
210 - >
208 + <Text modifiers={[font({ size: 10 }), foregroundStyle("secondary"), lineLimit(1)]}>
209 {window.reset}
210 </Text>
211 ) : null}
@@ -216,7 +214,13 @@ function SubscriptionUsage(
214 {!compact &&
215 !stale &&
216 (period === "auto" ? (provider.totalWindows ?? windows.length) : windows.length) > limit ? (
219 - <Text modifiers={[font({ textStyle: "caption2" }), foregroundStyle("secondary")]}>
217 + <Text
218 + modifiers={[
219 + font({ textStyle: "caption2" }),
220 + foregroundStyle("secondary"),
221 + lineLimit(1),
222 + ]}
223 + >
224 {(period === "auto" ? (provider.totalWindows ?? windows.length) : windows.length) -
225 limit}{" "}
226 more in T3
@@ -228,11 +232,11 @@ function SubscriptionUsage(
232 return (
233 <VStack
234 alignment="leading"
231 - spacing={accessory ? 2 : 6}
235 + spacing={accessory || dense ? 2 : 6}
236 modifiers={props.url ? [widgetURL(props.url)] : []}
237 >
238 {compact ? (
235 - <VStack alignment="leading" spacing={accessory ? 4 : 8}>
239 + <VStack alignment="leading" spacing={accessory || dense ? 4 : 8}>
240 {columns}
241 </VStack>
242 ) : (
@@ -243,12 +247,7 @@ function SubscriptionUsage(
247 {!accessory ? <Spacer /> : null}
248 {!accessory ? (
249 <Text
246 - modifiers={[
247 - font({ textStyle: "caption2" }),
248 - foregroundStyle("secondary"),
249 - lineLimit(1),
250 - minimumScaleFactor(0.75),
251 - ]}
250 + modifiers={[font({ textStyle: "caption2" }), foregroundStyle("secondary"), lineLimit(1)]}
251 >
252 {props.checkedAt
253 ? `As of ${new Date(props.checkedAt).toLocaleString(undefined, { hour: "numeric", minute: "2-digit", month: "short", day: "numeric" })}`