Fix Codex auth import and reset credit details
# Conflicts: # app/(tabs)/codex.tsx # app/(tabs)/index.tsx # app/(tabs)/settings.tsx # hooks/useCodexUsage.ts # lib/api/codexApi.ts # package-lock.json # package.json
This commit is contained in:
+34
-18
@@ -159,17 +159,17 @@ function DashboardTabContent() {
|
||||
</Text>
|
||||
</View>
|
||||
<View className="flex-row items-center gap-x-2">
|
||||
{codex.usage?.plan_type && (
|
||||
{codex.usage?.planType && (
|
||||
<View className="px-2.5 py-1 rounded-full bg-green-100 dark:bg-green-900/30">
|
||||
<Text className="text-xs font-semibold text-green-700 dark:text-green-300 capitalize">
|
||||
{codex.usage.plan_type}
|
||||
{codex.usage.planType}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
{codex.auth && codex.status === "error" && (
|
||||
<View className="w-2 h-2 rounded-full bg-red-500" />
|
||||
)}
|
||||
{codex.status === "success" && !codex.usage?.plan_type && (
|
||||
{codex.status === "success" && !codex.usage?.planType && (
|
||||
<View className="w-2 h-2 rounded-full bg-green-500" />
|
||||
)}
|
||||
</View>
|
||||
@@ -189,22 +189,22 @@ function DashboardTabContent() {
|
||||
)}
|
||||
{codex.usage && (
|
||||
<View>
|
||||
<UsageRow
|
||||
label={`${windowLabel(codex.usage.rate_limit.primary_window.limit_window_seconds)} window`}
|
||||
percent={codex.usage.rate_limit.primary_window.used_percent}
|
||||
resetAtSeconds={codex.usage.rate_limit.primary_window.reset_at}
|
||||
/>
|
||||
<UsageRow
|
||||
label={`${windowLabel(codex.usage.rate_limit.secondary_window.limit_window_seconds)} window`}
|
||||
percent={
|
||||
codex.usage.rate_limit.secondary_window.used_percent
|
||||
}
|
||||
resetAtSeconds={
|
||||
codex.usage.rate_limit.secondary_window.reset_at
|
||||
}
|
||||
/>
|
||||
{codex.usage.primary && (
|
||||
<UsageRow
|
||||
label={`${windowLabel(codex.usage.primary.windowSeconds)} window`}
|
||||
percent={codex.usage.primary.usedPercent}
|
||||
resetAtSeconds={codex.usage.primary.resetsAt}
|
||||
/>
|
||||
)}
|
||||
{codex.usage.secondary && (
|
||||
<UsageRow
|
||||
label={`${windowLabel(codex.usage.secondary.windowSeconds)} window`}
|
||||
percent={codex.usage.secondary.usedPercent}
|
||||
resetAtSeconds={codex.usage.secondary.resetsAt}
|
||||
/>
|
||||
)}
|
||||
{!codex.usage.credits.unlimited &&
|
||||
codex.usage.credits.has_credits && (
|
||||
codex.usage.credits.hasCredits && (
|
||||
<View className="pt-3 border-t border-neutral-100 dark:border-neutral-800 flex-row items-center gap-x-2">
|
||||
<MaterialIcons name="toll" size={14} color="#a3a3a3" />
|
||||
<Text className="text-xs text-neutral-500 dark:text-neutral-400">
|
||||
@@ -226,6 +226,22 @@ function DashboardTabContent() {
|
||||
</View>
|
||||
)}
|
||||
<View className="mt-3 border-t border-neutral-100 pt-3 dark:border-neutral-800">
|
||||
{!!codex.usage.resetCoupons && (
|
||||
<View className="mb-3">
|
||||
<View className="flex-row items-center gap-x-2">
|
||||
<MaterialIcons name="restart-alt" size={14} color={COLORS.codex} />
|
||||
<Text className="text-xs text-neutral-500 dark:text-neutral-400">
|
||||
{codex.usage.resetCoupons.availableCount ?? 0} reset credits
|
||||
available
|
||||
</Text>
|
||||
</View>
|
||||
{!!codex.usage.resetCoupons.nextExpiringCredit?.timeUntilExpiry && (
|
||||
<Text className="text-xs text-neutral-400 dark:text-neutral-500 mt-1">
|
||||
Next expires in {codex.usage.resetCoupons.nextExpiringCredit.timeUntilExpiry}
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
)}
|
||||
<LastUpdated timestamp={codex.lastFetchedAt} />
|
||||
</View>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user