Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions apps/mobile/src/features/usage/UsageLimitsPooled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
collectExternalUsageLinks,
collectLimitNotices,
cursorUsageWindowDetails,
formatResetsIn,
} from "@t3tools/shared/usageLimitsCopy";
import { msg, T, useGT, useMessages, Var } from "gt-react-native";
import { Fragment, type ReactNode, useId, useState } from "react";
Expand All @@ -31,7 +32,7 @@ import { ProviderIcon } from "../../components/ProviderIcon";
import type { MessageResolver } from "../../i18n/messages";
import { SettingsScreen } from "../settings/components/SettingsScreen";
import { environmentPresentations } from "../../state/presentation";
import { refillLabel, ResetCredits, resetLabels } from "./UsageLimitsSection";
import { ResetCredits, resetLabels } from "./UsageLimitsSection";
import { usageProviderKind, useProviderColors } from "./usageProviders";

const PACE_LABEL = {
Expand Down Expand Up @@ -194,7 +195,7 @@ function PoolWindowCard({
const inlineLabels = wide && segmentWidth >= 96;
const inlineReset = wide && segmentWidth >= 150;
const inlineName = wide && segmentWidth >= 220;
const nextRefill = pool.resets.find((reset) => reset.restoresPercent > 0);
const nextReset = pool.resets[0];
const openAccount = (account: LimitAccount) =>
navigation.navigate("SettingsUsageAccount", {
accountKey: account.key,
Expand All @@ -212,23 +213,37 @@ function PoolWindowCard({
) : null}
<View className="flex-row items-baseline gap-1.5">
<Text className="text-sm text-foreground-muted">
<T>
<Text className="text-3xl font-t3-bold tabular-nums text-foreground">
<Var>{pool.remainingPercent}</Var>%
</Text>{" "}
left
</T>
{pool.members.length > 1 ? (
<T>
<Text className="text-3xl font-t3-bold tabular-nums text-foreground">
<Var>{pool.remainingPercent}</Var>%
</Text>{" "}
average left
</T>
) : (
<T>
<Text className="text-3xl font-t3-bold tabular-nums text-foreground">
<Var>{pool.remainingPercent}</Var>%
</Text>{" "}
left
</T>
)}
</Text>
</View>
{pool.members.length > 1 ? (
<Text className="text-xs text-foreground-muted">
{gt("Across {count} accounts", { count: pool.members.length })}
</Text>
) : null}
</View>
{pool.pace ? (
<Text className="text-xs text-foreground-tertiary">{m(PACE_LABEL[pool.pace])}</Text>
) : null}
</View>
{description ? <Text className="text-xs text-foreground-muted">{description}</Text> : null}
{nextRefill ? (
{nextReset ? (
<Text className="text-xs tabular-nums text-foreground-muted">
{refillLabel(nextRefill.member.window, now, nextRefill.restoresPercent, m)}
{formatResetsIn(nextReset.member.window, now, m, "account")}
</Text>
) : null}
</>
Expand Down Expand Up @@ -682,11 +697,13 @@ export function UsageLimitAccountScreen({ route }: AccountScreenProps) {
</T>
</Text>
) : null}
{reset && reset.restoresPercent > 0 ? (
{reset && reset.member.refillPercent > 0 ? (
<Text className="text-sm text-foreground-muted">
<T>
Restores <Var>{reset.restoresPercent}</Var>% of the pool
</T>
{gt("After reset: {percent}% left on this account", {
percent: Math.round(
Math.min(100, remainingPercent(window) + reset.member.refillPercent),
),
})}
</Text>
) : null}
</View>
Expand Down
23 changes: 0 additions & 23 deletions apps/mobile/src/features/usage/UsageLimitsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,26 +396,3 @@ export function resetLabels(
const duration = formatDuration(countdown.ms, resolve);
return { full: resolve(msg("resets in {duration}", { duration })), compact: duration };
}

export function refillLabel(
window: ServerProviderUsageWindow,
now: number,
percent: number,
resolve: MessageResolver,
): string | null {
const countdown = resetCountdown(window, now);
if (countdown === null) return null;
if (countdown.kind === "now") {
return resolve(msg("↻ +{percent}% now", { percent, $context: "usage limit refill" }));
}
if (countdown.kind === "momentarily") {
return resolve(msg("↻ +{percent}% Resets momentarily", { percent }));
}
return resolve(
msg("↻ +{percent}% in {duration}", {
percent,
duration: formatDuration(countdown.ms, resolve),
$context: "usage limit refill",
}),
);
}
35 changes: 22 additions & 13 deletions apps/mobile/src/i18n/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -5063,15 +5063,6 @@
},
" % sollten jetzt übrig sein"
],
"a6ae2f414eb6349a": [
"Stellt ",
{
"i": 1,
"k": "_gt_value_1",
"v": "v"
},
" % des Kontingents wieder her"
],
"427c46cf712e8cb6": "Reset-Guthaben",
"fb7be23247bbe5ec": "über dem Tempo",
"05c53f9e062392da": "im Tempo",
Expand All @@ -5084,9 +5075,6 @@
"8864ac914d8205e8": "Ein Reset-Guthaben verwenden?",
"e32c2c7e61a16f4b": "Guthaben verwenden",
"b58a90dc5356f80a": "wird jetzt zurückgesetzt",
"1d8c701d90e48e07": "↻ +{percent} % jetzt",
"949db5acc5a82add": "↻ +{percent} % Wird gleich zurückgesetzt",
"96f9e0677375a802": "↻ +{percent} % in {duration}",
"f8a9ced202b79202": "Kontobezeichnung ausblenden",
"e4b6c8eab1e48ee2": "Kontobezeichnung anzeigen",
"1f76510e608a9292": "Wird verwendet…",
Expand Down Expand Up @@ -5464,5 +5452,26 @@
"ad208e3e32c85029": "Alle ausblenden",
"3328503592789bed": "Zen",
"856812e7e1fc445e": "Tool-Aufrufe im Chat",
"8d545d54c0a9e950": "Die Befehle, Bearbeitungen und Suchen ausblenden, die Agenten ausführen. „Erfolgreiche ausblenden“ behält Fehler. „Zen“ zeigt nur endgültige Antworten. Genehmigungen, Fragen und Fehler werden immer angezeigt."
"8d545d54c0a9e950": "Die Befehle, Bearbeitungen und Suchen ausblenden, die Agenten ausführen. „Erfolgreiche ausblenden“ behält Fehler. „Zen“ zeigt nur endgültige Antworten. Genehmigungen, Fragen und Fehler werden immer angezeigt.",
"0823a39756bb74a0": "Nächste Kontozurücksetzung jetzt",
"49012e2676b17322": "Nächste Kontozurücksetzung in Kürze",
"a43d270db904770e": "Nächste Kontozurücksetzung in {duration}",
"d343b39fa4fc62f3": "Über {count} Konten",
"34def2fecab9556a": "Nach der Zurücksetzung: {percent}% auf diesem Konto übrig",
"2c1bdecdcb724828": [
{
"t": "Text",
"i": 1,
"c": [
{
"i": 2,
"k": "_gt_value_2",
"v": "v"
},
"%"
]
},
" ",
"im Durchschnitt übrig"
]
}
35 changes: 22 additions & 13 deletions apps/mobile/src/i18n/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -5065,15 +5065,6 @@
},
"% left by now"
],
"a6ae2f414eb6349a": [
"Restores ",
{
"i": 1,
"k": "_gt_value_1",
"v": "v"
},
"% of the pool"
],
"427c46cf712e8cb6": "Reset credits",
"fb7be23247bbe5ec": "ahead of pace",
"05c53f9e062392da": "on pace",
Expand All @@ -5086,9 +5077,6 @@
"8864ac914d8205e8": "Use a reset credit?",
"e32c2c7e61a16f4b": "Use credit",
"b58a90dc5356f80a": "resets now",
"1d8c701d90e48e07": "↻ +{percent}% now",
"949db5acc5a82add": "↻ +{percent}% Resets momentarily",
"96f9e0677375a802": "↻ +{percent}% in {duration}",
"f8a9ced202b79202": "Hide account label",
"e4b6c8eab1e48ee2": "Reveal account label",
"1f76510e608a9292": "Using…",
Expand Down Expand Up @@ -5466,5 +5454,26 @@
"ad208e3e32c85029": "Hide all",
"3328503592789bed": "Zen",
"856812e7e1fc445e": "Tool calls in chat",
"8d545d54c0a9e950": "Hide the commands, edits, and searches agents run. Hide successful keeps failures. Zen shows only final answers. Approvals, questions, and errors always show."
"8d545d54c0a9e950": "Hide the commands, edits, and searches agents run. Hide successful keeps failures. Zen shows only final answers. Approvals, questions, and errors always show.",
"0823a39756bb74a0": "Next account reset now",
"49012e2676b17322": "Next account reset momentarily",
"a43d270db904770e": "Next account reset in {duration}",
"d343b39fa4fc62f3": "Across {count} accounts",
"34def2fecab9556a": "After reset: {percent}% left on this account",
"2c1bdecdcb724828": [
{
"t": "Text",
"i": 1,
"c": [
{
"i": 2,
"k": "_gt_value_2",
"v": "v"
},
"%"
]
},
" ",
"average left"
]
}
35 changes: 22 additions & 13 deletions apps/mobile/src/i18n/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -5057,15 +5057,6 @@
},
"% a estas alturas"
],
"a6ae2f414eb6349a": [
"Restaura un ",
{
"i": 1,
"k": "_gt_value_1",
"v": "v"
},
"% del total"
],
"427c46cf712e8cb6": "Créditos de restablecimiento",
"fb7be23247bbe5ec": "por encima del ritmo",
"05c53f9e062392da": "al ritmo",
Expand All @@ -5078,9 +5069,6 @@
"8864ac914d8205e8": "¿Usar un crédito de restablecimiento?",
"e32c2c7e61a16f4b": "Usar crédito",
"b58a90dc5356f80a": "se restablece ahora",
"1d8c701d90e48e07": "↻ +{percent} % ahora",
"949db5acc5a82add": "↻ +{percent} % Se restablece en un momento",
"96f9e0677375a802": "↻ +{percent} % en {duration}",
"f8a9ced202b79202": "Ocultar la etiqueta de la cuenta",
"e4b6c8eab1e48ee2": "Mostrar la etiqueta de la cuenta",
"1f76510e608a9292": "Usando…",
Expand Down Expand Up @@ -5458,5 +5446,26 @@
"ad208e3e32c85029": "Ocultar todo",
"3328503592789bed": "Zen",
"856812e7e1fc445e": "Llamadas a herramientas en el chat",
"8d545d54c0a9e950": "Oculta los comandos, ediciones y búsquedas que ejecutan los agentes. Ocultar las correctas mantiene los fallos. Zen solo muestra las respuestas finales. Las aprobaciones, preguntas y errores siempre se muestran."
"8d545d54c0a9e950": "Oculta los comandos, ediciones y búsquedas que ejecutan los agentes. Ocultar las correctas mantiene los fallos. Zen solo muestra las respuestas finales. Las aprobaciones, preguntas y errores siempre se muestran.",
"0823a39756bb74a0": "Próximo restablecimiento de cuenta ahora",
"49012e2676b17322": "Próximo restablecimiento de cuenta en breve",
"a43d270db904770e": "Próximo restablecimiento de cuenta en {duration}",
"d343b39fa4fc62f3": "Entre {count} cuentas",
"34def2fecab9556a": "Tras el restablecimiento: queda un {percent}% en esta cuenta",
"2c1bdecdcb724828": [
{
"t": "Text",
"i": 1,
"c": [
{
"i": 2,
"k": "_gt_value_2",
"v": "v"
},
"%"
]
},
" ",
"disponible de media"
]
}
35 changes: 22 additions & 13 deletions apps/mobile/src/i18n/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -5057,15 +5057,6 @@
},
" % restant à ce stade"
],
"a6ae2f414eb6349a": [
"Restaure ",
{
"i": 1,
"k": "_gt_value_1",
"v": "v"
},
" % du quota"
],
"427c46cf712e8cb6": "Crédits de réinitialisation",
"fb7be23247bbe5ec": "en avance",
"05c53f9e062392da": "au rythme",
Expand All @@ -5078,9 +5069,6 @@
"8864ac914d8205e8": "Utiliser un crédit de réinitialisation ?",
"e32c2c7e61a16f4b": "Utiliser le crédit",
"b58a90dc5356f80a": "réinitialisation maintenant",
"1d8c701d90e48e07": "↻ +{percent} % maintenant",
"949db5acc5a82add": "↻ +{percent} % Réinitialisation imminente",
"96f9e0677375a802": "↻ +{percent} % dans {duration}",
"f8a9ced202b79202": "Masquer le libellé du compte",
"e4b6c8eab1e48ee2": "Afficher le libellé du compte",
"1f76510e608a9292": "Utilisation…",
Expand Down Expand Up @@ -5458,5 +5446,26 @@
"ad208e3e32c85029": "Tout masquer",
"3328503592789bed": "Zen",
"856812e7e1fc445e": "Appels d’outils dans la discussion",
"8d545d54c0a9e950": "Masque les commandes, modifications et recherches lancées par les agents. Masquer les réussis garde les échecs. Zen n’affiche que les réponses finales. Les approbations, questions et erreurs s’affichent toujours."
"8d545d54c0a9e950": "Masque les commandes, modifications et recherches lancées par les agents. Masquer les réussis garde les échecs. Zen n’affiche que les réponses finales. Les approbations, questions et erreurs s’affichent toujours.",
"0823a39756bb74a0": "Prochaine réinitialisation du compte maintenant",
"49012e2676b17322": "Prochaine réinitialisation du compte sous peu",
"a43d270db904770e": "Prochaine réinitialisation du compte dans {duration}",
"d343b39fa4fc62f3": "Sur {count} comptes",
"34def2fecab9556a": "Après la réinitialisation : il reste {percent}% sur ce compte",
"2c1bdecdcb724828": [
{
"t": "Text",
"i": 1,
"c": [
{
"i": 2,
"k": "_gt_value_2",
"v": "v"
},
"%"
]
},
" ",
"restants en moyenne"
]
}
35 changes: 22 additions & 13 deletions apps/mobile/src/i18n/translations/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -5038,15 +5038,6 @@
},
"%"
],
"a6ae2f414eb6349a": [
"プールの ",
{
"i": 1,
"k": "_gt_value_1",
"v": "v"
},
"% を回復"
],
"427c46cf712e8cb6": "リセットクレジット",
"fb7be23247bbe5ec": "ペース超過",
"05c53f9e062392da": "適正なペース",
Expand All @@ -5059,9 +5050,6 @@
"8864ac914d8205e8": "リセットクレジットを使用しますか?",
"e32c2c7e61a16f4b": "クレジットを使用",
"b58a90dc5356f80a": "今すぐリセット",
"1d8c701d90e48e07": "↻ 今すぐ +{percent}%",
"949db5acc5a82add": "↻ +{percent}% まもなくリセット",
"96f9e0677375a802": "↻ {duration}後に +{percent}%",
"f8a9ced202b79202": "アカウントのラベルを非表示",
"e4b6c8eab1e48ee2": "アカウントのラベルを表示",
"1f76510e608a9292": "使用中…",
Expand Down Expand Up @@ -5439,5 +5427,26 @@
"ad208e3e32c85029": "すべて非表示",
"3328503592789bed": "Zen",
"856812e7e1fc445e": "チャット内のツール呼び出し",
"8d545d54c0a9e950": "エージェントが実行するコマンド、編集、検索を非表示にします。「成功したものを非表示」では失敗は表示されます。Zen では最終的な回答だけを表示します。承認、質問、エラーは常に表示されます。"
"8d545d54c0a9e950": "エージェントが実行するコマンド、編集、検索を非表示にします。「成功したものを非表示」では失敗は表示されます。Zen では最終的な回答だけを表示します。承認、質問、エラーは常に表示されます。",
"0823a39756bb74a0": "次のアカウントリセット:今",
"49012e2676b17322": "次のアカウントリセット:まもなく",
"a43d270db904770e": "次のアカウントリセットまで {duration}",
"d343b39fa4fc62f3": "{count} 個のアカウント",
"34def2fecab9556a": "リセット後、このアカウントの残りは {percent}%",
"2c1bdecdcb724828": [
{
"t": "Text",
"i": 1,
"c": [
{
"i": 2,
"k": "_gt_value_2",
"v": "v"
},
"%"
]
},
" ",
"が平均で残っています"
]
}
Loading
Loading