import type { ApprovalRequestId } from "@t3tools/contracts"; import { Pressable, View } from "react-native"; import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText"; import { cn } from "../../lib/cn"; import type { PendingUserInput, PendingUserInputDraftAnswer } from "../../lib/threadActivity"; export interface PendingUserInputCardProps { readonly pendingUserInput: PendingUserInput; readonly drafts: Record; readonly answers: Record | null; readonly respondingUserInputId: ApprovalRequestId | null; readonly onSelectOption: ( requestId: ApprovalRequestId, questionId: string, label: string, ) => void; readonly onChangeCustomAnswer: ( requestId: ApprovalRequestId, questionId: string, customAnswer: string, ) => void; readonly onSubmit: () => Promise; } export function PendingUserInputCard(props: PendingUserInputCardProps) { return ( User input needed Fill in the pending answers {props.pendingUserInput.questions.map((question) => { const draft = props.drafts[question.id]; return ( {question.header} {question.question} {question.options.map((option) => { const selected = draft?.selectedOptionLabel === option.label && !draft.customAnswer?.trim().length; return ( props.onSelectOption( props.pendingUserInput.requestId, question.id, option.label, ) } > {option.label} ); })} props.onChangeCustomAnswer(props.pendingUserInput.requestId, question.id, value) } placeholder="Or type a custom answer" className="min-h-[54px] rounded-2xl border border-neutral-200 bg-white px-3.5 py-3 font-sans text-base text-neutral-950 dark:border-white/8 dark:bg-neutral-950/70 dark:text-neutral-50" /> ); })} void props.onSubmit()} > Submit answers ); }