import {
ScrollView,
View,
Text,
TouchableOpacity,
ActivityIndicator,
RefreshControl,
} from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { MaterialIcons } from "@expo/vector-icons";
import { useCodexUsage } from "@/hooks/useCodexUsage";
import { UsageStat } from "@/components/UsageStat";
import { ErrorMessage } from "@/components/ErrorMessage";
import { LastUpdated } from "@/components/LastUpdated";
import { ScreenErrorBoundary } from "@/components/ScreenErrorBoundary";
import { COLORS } from "@/lib/constants";
import { windowLabel } from "@/lib/timeUtils";
function CodexTabContent() {
const {
auth,
usage,
lastFetchedAt,
status,
error,
importAuthFile,
refresh,
clearAuth,
} =
useCodexUsage();
return (
}
>
{/* Header */}
Codex CLI
Rate limits & credits
{/* Configuration card */}
Configuration
{auth ? (
Connected
{auth.accountId && (
{auth.accountId.slice(0, 10)}…
)}
Clear
) : (
Import auth.json
Located at ~/.codex/auth.json
)}
{/* Usage card */}
Usage
{status === "idle" && !auth && (
Import auth.json to see your rate limits
)}
{status === "loading" && !usage && (
)}
{status === "error" && error && }
{usage && (
{/* Plan badge */}
{usage.plan_type}
{/* Credits */}
Credits
{usage.credits.unlimited ? (
Unlimited
) : usage.credits.has_credits ? (
${Number(usage.credits.balance).toFixed(2)} remaining
) : (
No credits
)}
)}
);
}
export default function CodexTab() {
return (
);
}