import { RefreshCw } from "lucide-react-native"; import { useMemo } from "react"; import { Text, View } from "react-native"; import { StyleSheet } from "react-native-unistyles"; import { Alert } from "@/components/ui/alert"; import { Button } from "@/components/ui/button"; import { settingsStyles } from "@/styles/settings"; import { SettingsSection } from "@/components/settings/headings/settings-section"; import { usageCopy } from "./copy"; import { UsageList } from "./list"; import type { UsageView } from "./types"; export function UsageSection({ serverId, title, view, onRefresh, testID, }: { serverId: string; title: string; view: UsageView; onRefresh: () => void; testID?: string; }) { const busy = view.kind === "loading" || (view.kind === "ready" && view.isRefreshing); const refreshButton = useMemo( () => view.kind === "unavailable" ? null : ( ), [busy, onRefresh, view.kind], ); return ( ); } function UsageBody({ serverId, view, onRefresh, }: { serverId: string; view: UsageView; onRefresh: () => void; }) { if (view.kind === "unavailable") { return ; } if (view.kind === "loading") { return ; } if (view.kind === "error") { return ( ); } if (view.reports.length === 0) { return ; } return ; } export function UsageMessage({ text }: { text: string }) { return ( {text} ); } const styles = StyleSheet.create((theme) => ({ emptyCard: { padding: theme.spacing[4], alignItems: "center", }, emptyText: { color: theme.colors.foregroundMuted, fontSize: theme.fontSize.base, }, }));