import type { EnvironmentId, UsageLimitsReport } from "@t3tools/contracts"; import { Pressable, ScrollView, useWindowDimensions, View } from "react-native"; import { SymbolView } from "../../components/AppSymbol"; import { AppText as Text } from "../../components/AppText"; import { AccountLimits, ResetCredits } from "../usage/UsageLimitsSection"; const DRIVER_LABEL: Partial> = { codex: "Codex", claudeAgent: "Claude" }; /** * The /usage-limits result, docked above the composer. It is the Usage → Limits * card one size down, so the two read as the same thing. The surface is opaque * because nothing blurs the feed behind it. */ export function ComposerUsageLimits({ report, environmentId, onClose, }: { readonly report: UsageLimitsReport; readonly environmentId: EnvironmentId; readonly onClose: () => void; }) { const now = Date.parse(report.createdAt); const { height } = useWindowDimensions(); const close = ( ); return ( {report.accounts.map((account, index) => { const resetCreditInput = account.resetCreditInput ?? (account.instanceId ? { instanceId: account.instanceId } : undefined); const driverLabel = DRIVER_LABEL[account.driver] ?? String(account.driver); return ( ) : undefined } /> ); })} {report.accounts.length === 0 ? ( // Nothing but notices, so the close control needs a row of its own. Usage limits {close} ) : null} {report.notices.map((notice) => ( {notice} ))} ); }