import React, { type ReactNode } from 'react'; import { ActivityIndicator, Pressable, Text, View } from 'react-native'; import { CheckCircle2 } from 'lucide-react-native'; import { conversationStyles } from '../../features/conversation/conversationStyles'; import { themedColor } from '../../theme'; import { toolWidgetStyles } from './toolWidgetStyles'; /** * Bordered approval surface — native analog of the web EntityApprovalCard / * batch approval container: pending-dot header, content, then Approve on the * left and Reject on the right. Button styling reuses the timeline's * ToolApprovalCard styles so every approval in the chat looks the same. */ export function ApprovalCard({ approveDisabled, approveLabel, children, error, isSubmitting, onApprove, onReject, rejectLabel, title, unavailableNote, }: { approveDisabled?: boolean; approveLabel: string; children: ReactNode; error?: string | null; isSubmitting: boolean; onApprove?: () => void; onReject?: () => void; rejectLabel: string; title: string; /** Replaces the default no-controls note (e.g. the stale-turn message). */ unavailableNote?: string; }) { const canAct = Boolean(onApprove && onReject); const disablePrimary = !canAct || isSubmitting || Boolean(approveDisabled); return ( {title} {children} {canAct ? ( {isSubmitting ? : } {isSubmitting ? 'Working...' : approveLabel} {rejectLabel} ) : ( {unavailableNote ?? 'Approval controls are not available here.'} )} {error ? {error} : null} ); }