import React, { useState } from 'react'; import { View, TextInput, TouchableOpacity, Alert } from 'react-native'; import { MyText, MyButton } from 'common-ui'; import { trpc } from '../src/trpc-client'; interface OrderNotesFormProps { orderId: number; initialNotes?: string; onSuccess?: () => void; onCancel?: () => void; } export const OrderNotesForm: React.FC = ({ orderId, initialNotes = '', onSuccess, onCancel, }) => { const [notes, setNotes] = useState(initialNotes); const updateNotesMutation = trpc.admin.order.updateNotes.useMutation(); const handleSubmit = async () => { if (!notes.trim()) { Alert.alert('Error', 'Please enter some notes'); return; } try { await updateNotesMutation.mutateAsync({ orderId, adminNotes: notes.trim(), }); Alert.alert('Success', 'Notes updated successfully'); onSuccess?.(); } catch (error) { Alert.alert('Error', 'Failed to update notes'); } }; return ( Add Order Notes ); };