import { AlertTriangle, Coins, Loader2 } from 'lucide-react'; import { Card, CardContent } from '@/components/ui/card'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { PLATFORM_OWNER_PUBKEYS } from '@/hooks/useListingRestrictions'; import { useSasquatchAiStatus } from '@/hooks/useSasquatchAiStatus'; import { cn } from '@/lib/utils'; /** * Owner-only card: the Sasquatch AI (Routstr node) balance, with a warning when * it's running low. This is the "top up before AI degrades" nudge — no webhook * needed, since the operator can see it live in Settings. */ export function SasquatchAiStatusCard() { const { user } = useCurrentUser(); const isOwner = !!user?.pubkey && PLATFORM_OWNER_PUBKEYS.includes(user.pubkey); const { data, isLoading, isError } = useSasquatchAiStatus(); if (!isOwner) return null; const low = data?.low === true; const balance = data?.balanceSats; return (

{low ? ( ) : ( )} Sasquatch AI Owner

{isLoading ? ( ) : isError || data?.configured === false ? ( 'not configured' ) : balance === null || balance === undefined ? ( 'unavailable' ) : ( `${balance.toLocaleString()} sats` )}

{low ? `Running low — top up at ${data?.provider ?? 'the node'} or AI will fall back to the keyless provider.` : 'Pay-per-request AI, funded in sats via Routstr. Tops up when low.'}

); }