({ utaId, mode, onClose, subAccounts, defaultSubAccountId, onPushComplete }: Props)
| 38 | * position |
| 39 | */ |
| 40 | export function OrderEntryDialog({ utaId, mode, onClose, subAccounts, defaultSubAccountId, onPushComplete }: Props) { |
| 41 | const [submitting, setSubmitting] = useState(false) |
| 42 | const [error, setError] = useState<{ message: string; phase?: string } | null>(null) |
| 43 | const [result, setResult] = useState<WalletPushResult | null>(null) |
| 44 | |
| 45 | // Whether the result panel has shown — once it has, parent should |
| 46 | // refresh on close. We notify via onPushComplete after a successful |
| 47 | // push so parent can refresh immediately AND on close. |
| 48 | const handleClose = () => { |
| 49 | if (result && onPushComplete) onPushComplete(result) |
| 50 | onClose() |
| 51 | } |
| 52 | |
| 53 | return ( |
| 54 | <Dialog onClose={handleClose} width="w-[560px]"> |
| 55 | <Header mode={mode} onClose={handleClose} /> |
| 56 | |
| 57 | <div className="flex-1 overflow-y-auto px-6 py-6"> |
| 58 | {result |
| 59 | ? <PushResultPanel result={result} /> |
| 60 | : mode.kind === 'place' |
| 61 | ? <PlaceForm utaId={utaId} initialAliceId={mode.aliceId} subAccounts={subAccounts} defaultSubAccountId={defaultSubAccountId} submitting={submitting} error={error} setError={setError} setSubmitting={setSubmitting} setResult={setResult} onPushComplete={onPushComplete} /> |
| 62 | : <CloseForm utaId={utaId} aliceId={mode.aliceId} initialQty={mode.quantity} symbol={mode.symbol} subAccounts={subAccounts} defaultSubAccountId={defaultSubAccountId} submitting={submitting} error={error} setError={setError} setSubmitting={setSubmitting} setResult={setResult} onPushComplete={onPushComplete} /> |
| 63 | } |
| 64 | </div> |
| 65 | |
| 66 | <div className="shrink-0 flex items-center justify-end px-6 py-4 border-t border-border"> |
| 67 | <button onClick={handleClose} className="btn-secondary"> |
| 68 | {result ? 'Done' : 'Cancel'} |
| 69 | </button> |
| 70 | </div> |
| 71 | </Dialog> |
| 72 | ) |
| 73 | } |
| 74 | |
| 75 | // ==================== Header ==================== |
| 76 |
nothing calls this directly
no outgoing calls
no test coverage detected