Open History to see the last commit
1import { useAtomValue } from "@effect/atom-react";
2import { useNavigation, type StaticScreenProps } from "@react-navigation/native";
3import { EnvironmentId } from "@t3tools/contracts";
4import { providerClients } from "@t3tools/client-runtime/provider-clients";
5import { normalizeProviderAccentColor } from "@t3tools/client-runtime/state/provider-instance-display";
6import {
7 collectLimitAccounts,
8 collectLimitPools,
9 displayLimitWindows,
10 paceRemainingPercent,
11 remainingPercent,
12 type LimitAccount,
13 type LimitPoolWindow,
14} from "@t3tools/shared/usageLimits";
15import {
16 collectExternalUsageLinks,
17 collectLimitNotices,
18 cursorUsageWindowDetails,
19} from "@t3tools/shared/usageLimitsCopy";
20import { msg, T, useGT, useMessages, Var } from "gt-react-native";
21import { Fragment, type ReactNode, useId, useState } from "react";
22import { Linking, Pressable, View } from "react-native";
23import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
24import { Defs, Path, Pattern, Rect, Svg } from "react-native-svg";
25import { useSafeAreaInsets } from "react-native-safe-area-context";
26
27import { SymbolView } from "../../components/ui/AppSymbol";
28import { AppText as Text } from "../../components/ui/AppText";
29import { ProviderIcon } from "../../components/ProviderIcon";
30import type { MessageResolver } from "../../i18n/messages";
31import { SettingsScreen } from "../settings/components/SettingsScreen";
32import { environmentPresentations } from "../../state/presentation";
33import { refillLabel, ResetCredits, resetLabels } from "./UsageLimitsSection";
34import { usageProviderKind, useProviderColors } from "./usageProviders";
35
36const PACE_LABEL = {
37 ahead: msg("Ahead of pace"),
38 on: msg("On pace"),
39 under: msg("Under pace"),
40} as const;
41
42function accountName(account: LimitAccount, resolve: MessageResolver) {
43 if (account.displayName) return account.displayName;
44 if (!account.email) return providerClients.get(account.driver)?.label ?? account.driver;
45 return (
46 emailInitials(account.email) || resolve(msg("Account", { $context: "fallback account name" }))
47 );
48}
49
50function emailInitials(email: string) {
51 const [local = "", domain = ""] = email.split("@");
52 return `${local[0] ?? ""}${domain[0] ?? ""}`.toUpperCase();
53}
54
55function accountHue(email: string) {
56 let hash = 0;
57 for (let index = 0; index < email.length; index += 1) {
58 hash = (hash * 31 + email.charCodeAt(index)) | 0;
59 }
60 return Math.abs(hash) % 360;
61}
62
63// Same hashed hue as the web account chip, so an account keeps its color across clients.
64function AccountChip({ email }: { readonly email: string }) {
65 const hue = accountHue(email);
66 return (
67 <View
68 className="size-5 items-center justify-center rounded-full"
69 style={{ backgroundColor: `hsl(${hue}, 45%, 82%)` }}
70 >
71 <Text className="text-[9px] font-t3-bold" style={{ color: `hsl(${hue}, 45%, 28%)` }}>
72 {emailInitials(email)}
73 </Text>
74 </View>
75 );
76}
77
78// Same gap-and-tick as the Limits rows: two clipped copies of the segment leave a see-through gap.
79function PaceGap({
80 timeLeft,
81 children,
82}: {
83 readonly timeLeft: number | null;
84 readonly children: ReactNode;
85}) {
86 const [width, setWidth] = useState(0);
87 const tickX =
88 timeLeft === null || width < 6
89 ? null
90 : Math.min(Math.max((width * timeLeft) / 100, 3), width - 3);
91 return (
92 <View
93 pointerEvents="none"
94 className="absolute inset-0"
95 onLayout={(event) => setWidth(event.nativeEvent.layout.width)}
96 >
97 {tickX === null
98 ? children
99 : (
100 [
101 [0, tickX - 3],
102 [tickX + 3, width],
103 ] as const
104 ).map(([start, end]) => (
105 <View
106 key={start}
107 className="absolute top-0 bottom-0 overflow-hidden"
108 style={{ left: start, width: end - start }}
109 >
110 <View className="absolute top-0 bottom-0" style={{ left: -start, width }}>
111 {children}
112 </View>
113 </View>
114 ))}
115 {tickX !== null ? (
116 <View
117 className="absolute top-0.5 bottom-0.5 w-0.5 rounded-full bg-foreground"
118 style={{ left: tickX - 1 }}
119 />
120 ) : null}
121 </View>
122 );
123}
124
125function AccountSegment({
126 remaining,
127 color,
128 refillPercent,
129}: {
130 readonly remaining: number;
131 readonly color: string;
132 readonly refillPercent: number;
133}) {
134 const patternId = useId().replace(/:/g, "");
135 const [size, setSize] = useState({ width: 0, height: 0 });
136 return (
137 <View
138 pointerEvents="none"
139 className="absolute inset-0"
140 onLayout={(event) => {
141 const { width, height } = event.nativeEvent.layout;
142 setSize((previous) =>
143 previous.width === width && previous.height === height ? previous : { width, height },
144 );
145 }}
146 >
147 {size.width > 0 && size.height > 0 ? (
148 // Numeric canvas dimensions clear Android SVG geometry cached before a segment resized.
149 <Svg width={size.width} height={size.height} accessible={false}>
150 <Defs>
151 <Pattern id={patternId} width={6} height={6} patternUnits="userSpaceOnUse">
152 <Path d="M-1 1L1 -1M0 6L6 0M5 7L7 5" stroke={color} strokeWidth={1} opacity={0.22} />
153 </Pattern>
154 </Defs>
155 {refillPercent > 0 ? (
156 <Rect
157 x={`${100 - Math.min(100 - remaining, refillPercent)}%`}
158 width={`${Math.min(100 - remaining, refillPercent)}%`}
159 height="100%"
160 fill={`url(#${patternId})`}
161 />
162 ) : null}
163 <Rect width={`${remaining}%`} height="100%" fill={color} opacity={0.35} />
164 </Svg>
165 ) : null}
166 </View>
167 );
168}
169
170function PoolWindowCard({
171 pool,
172 color,
173 now,
174 environmentIds,
175 label,
176 description,
177 wide,
178}: {
179 readonly pool: LimitPoolWindow;
180 readonly color: string;
181 readonly now: number;
182 readonly environmentIds: readonly string[] | null;
183 readonly label?: string | null;
184 readonly description?: string;
185 readonly wide: boolean;
186}) {
187 const navigation = useNavigation();
188 const gt = useGT();
189 const m = useMessages();
190 const [barWidth, setBarWidth] = useState(0);
191 // Each segment needs room for its account, percent and reset to label itself.
192 const segmentWidth = barWidth / Math.max(pool.columns.length, 1);
193 const inlineLabels = wide && segmentWidth >= 96;
194 const inlineReset = wide && segmentWidth >= 150;
195 const inlineName = wide && segmentWidth >= 220;
196 const nextRefill = pool.resets.find((reset) => reset.restoresPercent > 0);
197 const openAccount = (account: LimitAccount) =>
198 navigation.navigate("SettingsUsageAccount", {
199 accountKey: account.key,
200 windowId: pool.id,
201 windowKind: pool.kind,
202 environmentIds,
203 now,
204 });
205 const summary = (
206 <>
207 <View className={wide ? "gap-1" : "flex-row items-start justify-between gap-3"}>
208 <View className="gap-1">
209 {label !== null ? (
210 <Text className="text-sm font-t3-medium text-foreground">{label ?? pool.label}</Text>
211 ) : null}
212 <View className="flex-row items-baseline gap-1.5">
213 <Text className="text-sm text-foreground-muted">
214 <T>
215 <Text className="text-3xl font-t3-bold tabular-nums text-foreground">
216 <Var>{pool.remainingPercent}</Var>%
217 </Text>{" "}
218 left
219 </T>
220 </Text>
221 </View>
222 </View>
223 {pool.pace ? (
224 <Text className="text-xs text-foreground-tertiary">{m(PACE_LABEL[pool.pace])}</Text>
225 ) : null}
226 </View>
227 {description ? <Text className="text-xs text-foreground-muted">{description}</Text> : null}
228 {nextRefill ? (
229 <Text className="text-xs tabular-nums text-foreground-muted">
230 {refillLabel(nextRefill.member.window, now, nextRefill.restoresPercent, m)}
231 </Text>
232 ) : null}
233 </>
234 );
235 const bar = (
236 <View
237 className="flex-row gap-1"
238 onLayout={(event) => setBarWidth(event.nativeEvent.layout.width)}
239 >
240 {pool.columns.map((member, index) => {
241 if (!member.window)
242 return (
243 <View
244 key={member.account.key}
245 className={wide ? "h-9 min-w-0 flex-1" : "h-7 min-w-0 flex-1"}
246 />
247 );
248 const { account, window } = member;
249 const timeLeft = paceRemainingPercent(window, now);
250 const credits = account.limits.resetCredits?.availableCount ?? 0;
251 const resetsIn = resetLabels(window, now, m)?.compact;
252 return (
253 <Pressable
254 key={account.key}
255 accessibilityRole="button"
256 accessibilityLabel={
257 timeLeft === null
258 ? gt("Segment {index}, {account}, {remaining}% left", {
259 index: index + 1,
260 account: accountName(account, m),
261 remaining: remainingPercent(window),
262 })
263 : gt(
264 "Segment {index}, {account}, {remaining}% left, {timeLeft}% of the window left",
265 {
266 index: index + 1,
267 account: accountName(account, m),
268 remaining: remainingPercent(window),
269 timeLeft,
270 },
271 )
272 }
273 accessibilityHint={gt("Show account details")}
274 onPress={() => openAccount(account)}
275 className={wide ? "h-9 min-w-0 flex-1 rounded-md" : "h-7 min-w-0 flex-1 rounded-md"}
276 >
277 <PaceGap timeLeft={timeLeft}>
278 <View className="absolute inset-0 rounded-md bg-subtle" />
279 <View className="absolute inset-0 overflow-hidden rounded-md">
280 <AccountSegment
281 remaining={remainingPercent(window)}
282 color={normalizeProviderAccentColor(account.accentColor) ?? color}
283 refillPercent={window.resetsAt ? member.refillPercent : 0}
284 />
285 </View>
286 </PaceGap>
287 {inlineLabels ? (
288 <View
289 pointerEvents="none"
290 className="absolute inset-0 flex-row items-center justify-between gap-2 overflow-hidden rounded-md px-2"
291 >
292 <View className="min-w-0 shrink flex-row items-center gap-1.5">
293 {account.email ? <AccountChip email={account.email} /> : null}
294 {account.email && !(account.displayName && inlineName) ? null : (
295 <Text
296 numberOfLines={1}
297 className="min-w-0 shrink text-xs font-t3-medium text-foreground"
298 >
299 {accountName(account, m)}
300 </Text>
301 )}
302 <Text className="text-sm font-t3-bold tabular-nums text-foreground">
303 {remainingPercent(window)}%
304 </Text>
305 </View>
306 {inlineReset && (resetsIn || credits) ? (
307 <View className="shrink-0 flex-row items-center gap-1 rounded bg-grouped-card/85 px-1.5 py-0.5">
308 {resetsIn ? (
309 <>
310 <SymbolView
311 name="arrow.clockwise"
312 size={11}
313 tintColorClassName="accent-foreground-muted"
314 />
315 <Text className="text-xs tabular-nums text-foreground-muted">
316 {resetsIn}
317 </Text>
318 </>
319 ) : null}
320 {credits ? (
321 <>
322 <SymbolView name="ticket" size={12} tintColorClassName="accent-icon" />
323 <Text className="text-xs font-t3-medium tabular-nums text-foreground">
324 {credits}
325 </Text>
326 </>
327 ) : null}
328 </View>
329 ) : null}
330 </View>
331 ) : (
332 <View
333 pointerEvents="none"
334 className="absolute inset-0 items-center justify-center overflow-hidden rounded-md"
335 >
336 <Text
337 numberOfLines={1}
338 className="max-w-full shrink text-xs font-t3-medium tabular-nums text-foreground"
339 >
340 {index + 1}
341 </Text>
342 </View>
343 )}
344 </Pressable>
345 );
346 })}
347 </View>
348 );
349 const legend = (
350 <View>
351 {pool.columns.map(({ account, window }, index) => {
352 if (!window) return null;
353 const segmentColor = normalizeProviderAccentColor(account.accentColor) ?? color;
354 const credits = account.limits.resetCredits?.availableCount ?? 0;
355 const reset = resetLabels(window, now, m);
356 const resetsIn = reset?.full;
357 return (
358 <Pressable
359 key={account.key}
360 accessibilityRole="button"
361 accessibilityLabel={
362 resetsIn && credits
363 ? gt(
364 "Segment {index}, {account}, {remaining}% left, {resetsIn}, {credits, plural, other {{credits} reset credits banked}}",
365 {
366 index: index + 1,
367 account: accountName(account, m),
368 remaining: remainingPercent(window),
369 resetsIn,
370 credits,
371 },
372 )
373 : resetsIn
374 ? gt("Segment {index}, {account}, {remaining}% left, {resetsIn}", {
375 index: index + 1,
376 account: accountName(account, m),
377 remaining: remainingPercent(window),
378 resetsIn,
379 })
380 : credits
381 ? gt(
382 "Segment {index}, {account}, {remaining}% left, {credits, plural, other {{credits} reset credits banked}}",
383 {
384 index: index + 1,
385 account: accountName(account, m),
386 remaining: remainingPercent(window),
387 credits,
388 },
389 )
390 : gt("Segment {index}, {account}, {remaining}% left", {
391 index: index + 1,
392 account: accountName(account, m),
393 remaining: remainingPercent(window),
394 })
395 }
396 accessibilityHint={gt("Show account details")}
397 onPress={() => openAccount(account)}
398 className="min-h-[44px] flex-row items-center gap-2 active:opacity-60"
399 >
400 <View className="relative size-5 items-center justify-center overflow-hidden rounded-md bg-subtle-strong">
401 <View
402 pointerEvents="none"
403 className="absolute inset-0"
404 style={{ backgroundColor: segmentColor, opacity: 0.35 }}
405 />
406 <Text className="text-xs font-t3-medium tabular-nums text-foreground">
407 {index + 1}
408 </Text>
409 </View>
410 <Text
411 numberOfLines={1}
412 className="min-w-0 flex-1 text-sm font-t3-medium text-foreground"
413 >
414 {accountName(account, m)}
415 </Text>
416 <Text className="text-sm font-t3-medium tabular-nums text-foreground">
417 {remainingPercent(window)}%
418 </Text>
419 <View className="flex-row items-center gap-1">
420 {resetsIn ? (
421 <>
422 <SymbolView
423 name="arrow.clockwise"
424 size={12}
425 tintColorClassName="accent-foreground-muted"
426 />
427 <Text className="text-xs tabular-nums text-foreground-muted">
428 {reset?.compact}
429 </Text>
430 </>
431 ) : null}
432 {credits ? (
433 <>
434 {resetsIn ? <Text className="text-xs text-foreground-tertiary">·</Text> : null}
435 <SymbolView name="ticket" size={13} tintColorClassName="accent-icon" />
436 <Text className="text-xs font-t3-medium tabular-nums text-foreground">
437 {credits}
438 </Text>
439 </>
440 ) : null}
441 </View>
442 </Pressable>
443 );
444 })}
445 </View>
446 );
447 if (wide) {
448 return (
449 <View className="flex-row items-center gap-6 rounded-[24px] border-continuous bg-grouped-card p-4">
450 <View className="w-44 gap-1">{summary}</View>
451 <View className="min-w-0 flex-1 gap-1">
452 {bar}
453 {inlineLabels ? null : legend}
454 </View>
455 </View>
456 );
457 }
458 return (
459 <View className="gap-3 rounded-[24px] border-continuous bg-grouped-card p-4">
460 {summary}
461 {bar}
462 {legend}
463 </View>
464 );
465}
466
467export function UsageLimitsSection({
468 now,
469 failedLabels,
470 selectedEnvironmentIds,
471 wide = false,
472}: {
473 readonly now: number;
474 readonly failedLabels: readonly string[];
475 readonly selectedEnvironmentIds: ReadonlySet<EnvironmentId> | null;
476 readonly wide?: boolean;
477}) {
478 const presentations = useAtomValue(environmentPresentations.presentationsWithProvidersAtom);
479 const selected =
480 selectedEnvironmentIds === null
481 ? presentations
482 : new Map([...presentations].filter(([id]) => selectedEnvironmentIds.has(id)));
483 const pools = collectLimitPools(collectLimitAccounts(selected), now);
484 const m = useMessages();
485 const notices = collectLimitNotices(selected, m);
486 const externalLinks = collectExternalUsageLinks(selected, m);
487 const colors = useProviderColors();
488 const gt = useGT();
489 return (
490 <View className="gap-6">
491 {pools.length === 0 &&
492 notices.length === 0 &&
493 failedLabels.length === 0 &&
494 externalLinks.length === 0 ? (
495 <Text className="py-12 text-center text-base text-foreground-muted">
496 {selected.size === 0
497 ? gt("Select an environment to see limits.")
498 : gt("No provider on the selected environments reports subscription limits.")}
499 </Text>
500 ) : null}
501 {pools.map((pool) => {
502 const windows = displayLimitWindows(pool);
503 return (
504 <Fragment key={pool.driver}>
505 <View className="gap-3">
506 <View className="flex-row items-center gap-2 px-1">
507 <ProviderIcon provider={pool.driver} size={18} />
508 <Text className="text-base font-t3-medium text-foreground">
509 {providerClients.get(pool.driver)?.label ?? pool.driver}
510 </Text>
511 </View>
512 {windows.map((window) => {
513 const details =
514 pool.driver === "cursor"
515 ? cursorUsageWindowDetails(window.id, pool, m)
516 : undefined;
517 return (
518 <PoolWindowCard
519 key={`${window.kind}:${window.id}`}
520 pool={window}
521 color={colors[usageProviderKind(pool.driver) ?? "codex"]}
522 now={now}
523 environmentIds={
524 selectedEnvironmentIds === null ? null : [...selectedEnvironmentIds]
525 }
526 label={details?.label}
527 description={details?.description}
528 wide={wide}
529 />
530 );
531 })}
532 </View>
533 </Fragment>
534 );
535 })}
536 {externalLinks.map((link) => (
537 <View key={link.url} className="gap-3 rounded-xl border border-border-subtle p-4">
538 <Text className="text-base font-t3-medium text-foreground">{link.label}</Text>
539 <Text className="text-xs text-foreground-muted">{link.accounts.join(", ")}</Text>
540 {link.message ? (
541 <Text className="text-sm text-foreground-muted">{link.message}</Text>
542 ) : null}
543 <Pressable
544 accessibilityRole="link"
545 className="min-h-11 justify-center"
546 onPress={() => void Linking.openURL(link.url).catch(() => undefined)}
547 >
548 <Text className="text-sm font-t3-medium text-primary">
549 <T>Manage usage</T>
550 </Text>
551 </Pressable>
552 </View>
553 ))}
554 {notices.length > 0 || failedLabels.length > 0 ? (
555 <View
556 accessible
557 accessibilityRole="alert"
558 accessibilityLiveRegion="polite"
559 className="flex-row items-start gap-2 rounded-xl border border-warning-border bg-warning px-3.5 py-3"
560 >
561 <SymbolView
562 name="exclamationmark.triangle"
563 size={16}
564 tintColorClassName="accent-warning-foreground"
565 />
566 <View className="min-w-0 flex-1 gap-0.5">
567 {notices.map((notice) => (
568 <Text key={notice} className="text-sm font-t3-medium text-warning-foreground">
569 {notice}
570 </Text>
571 ))}
572 {failedLabels.length > 0 ? (
573 <Text className="text-sm font-t3-medium text-warning-foreground">
574 <T>
575 <Var>{failedLabels.join(", ")}</Var> could not refresh limits. Showing the last
576 known values.
577 </T>
578 </Text>
579 ) : null}
580 </View>
581 </View>
582 ) : null}
583 </View>
584 );
585}
586
587type AccountScreenProps = StaticScreenProps<{
588 accountKey: string;
589 windowId: string;
590 windowKind: LimitPoolWindow["kind"];
591 environmentIds: readonly string[] | null;
592 now: number;
593}>;
594
595export function UsageLimitAccountScreen({ route }: AccountScreenProps) {
596 const insets = useSafeAreaInsets();
597 const presentations = useAtomValue(environmentPresentations.presentationsWithProvidersAtom);
598 const { accountKey, windowId, windowKind, environmentIds, now } = route.params;
599 const selectedIds =
600 environmentIds === null ? null : new Set(environmentIds.map((id) => EnvironmentId.make(id)));
601 const selected =
602 selectedIds === null
603 ? presentations
604 : new Map([...presentations].filter(([id]) => selectedIds.has(id)));
605 const accounts = collectLimitAccounts(selected);
606 const account = accounts.find((candidate) => candidate.key === accountKey);
607 const pool = collectLimitPools(accounts, now)
608 .find((candidate) => candidate.driver === account?.driver)
609 ?.windows.find((candidate) => candidate.id === windowId && candidate.kind === windowKind);
610 const window = pool?.members.find((member) => member.account.key === accountKey)?.window;
611 const evenPace = window ? paceRemainingPercent(window, now) : null;
612 const reset = pool?.resets.find((candidate) => candidate.member.account.key === accountKey);
613 const [revealed, setRevealed] = useState(false);
614 const gt = useGT();
615 return (
616 <SettingsScreen title={gt("Account", { $context: "screen title" })}>
617 <ScrollView
618 contentInsetAdjustmentBehavior="automatic"
619 contentContainerClassName="gap-5 p-5"
620 contentContainerStyle={{ paddingBottom: insets.bottom + 24 }}
621 >
622 {!account || !window ? (
623 <Text className="text-base text-foreground-muted">
624 <T>This account is no longer reporting limits on the selected environments.</T>
625 </Text>
626 ) : (
627 <>
628 <View className="gap-2">
629 <View className="flex-row items-center gap-2">
630 <ProviderIcon provider={account.driver} size={24} />
631 <Text className="flex-1 text-xl font-t3-bold text-foreground">
632 {account.displayName ??
633 providerClients.get(account.driver)?.label ??
634 account.driver}
635 </Text>
636 </View>
637 {account.email ? (
638 <Pressable
639 accessibilityRole="button"
640 accessibilityLabel={
641 revealed ? gt("Hide account email") : gt("Reveal account email")
642 }
643 onPress={() => setRevealed((value) => !value)}
644 className="min-h-[44px] justify-center"
645 >
646 <Text className="text-sm text-foreground-muted">
647 {revealed ? account.email : "••••••@••••••"}
648 </Text>
649 </Pressable>
650 ) : null}
651 {account.plan ? (
652 <Text selectable className="text-sm text-foreground-muted">
653 {account.plan}
654 </Text>
655 ) : null}
656 </View>
657 <View className="gap-3 rounded-[24px] border-continuous bg-grouped-card p-4">
658 <Text className="text-sm font-t3-medium text-foreground">{window.label}</Text>
659 <Text className="text-3xl font-t3-bold tabular-nums text-foreground">
660 <T>
661 <Var>{remainingPercent(window)}</Var>% left
662 </T>
663 </Text>
664 {window.resetsAt ? (
665 <Text selectable className="text-sm text-foreground-muted">
666 <T>
667 Resets{" "}
668 <Var>
669 {new Date(window.resetsAt).toLocaleString(undefined, {
670 dateStyle: "medium",
671 timeStyle: "short",
672 })}
673 </Var>
674 </T>
675 </Text>
676 ) : null}
677 {evenPace !== null ? (
678 <Text className="text-sm text-foreground-muted">
679 <T>
680 Even pace: <Var>{evenPace}</Var>% left by now
681 </T>
682 </Text>
683 ) : null}
684 {reset && reset.restoresPercent > 0 ? (
685 <Text className="text-sm text-foreground-muted">
686 <T>
687 Restores <Var>{reset.restoresPercent}</Var>% of the pool
688 </T>
689 </Text>
690 ) : null}
691 </View>
692 <View className="gap-2 rounded-[24px] border-continuous bg-grouped-card p-4">
693 <Text className="text-sm font-t3-medium text-foreground">
694 {account.environments.length
695 ? gt("Signed in", {
696 $context: "heading for environments signed in to the account",
697 })
698 : gt("Source", { $context: "heading for where account limits come from" })}
699 </Text>
700 {account.environments.length ? (
701 account.environments.map((environment) => (
702 <Text key={environment.environmentId} className="text-sm text-foreground-muted">
703 {environment.label}
704 </Text>
705 ))
706 ) : (
707 <Text className="text-sm text-foreground-muted">{account.sourceLabel}</Text>
708 )}
709 </View>
710 {account.redeem && account.limits.resetCredits ? (
711 <View className="gap-3 rounded-[24px] border-continuous bg-grouped-card p-4">
712 <Text className="text-sm font-t3-medium text-foreground">
713 <T>Reset credits</T>
714 </Text>
715 <ResetCredits
716 key={account.key}
717 environmentId={account.redeem.environmentId}
718 input={account.redeem.input}
719 credits={account.limits.resetCredits}
720 now={now}
721 />
722 </View>
723 ) : null}
724 </>
725 )}
726 </ScrollView>
727 </SettingsScreen>
728 );
729}