(i: number)
| 249 | } |
| 250 | |
| 251 | const pickPreset = (i: number) => { |
| 252 | // Prefer the raw (numeric) preset for the amount; fall back to stripping $. |
| 253 | const raw = (rawPresets[i] ?? presets[i] ?? '').replace(/^\$/, '').trim() |
| 254 | const v = ctx.validate(raw) |
| 255 | |
| 256 | if (v.error || !v.amount) { |
| 257 | setError(v.error ?? 'Invalid preset.') |
| 258 | |
| 259 | return |
| 260 | } |
| 261 | |
| 262 | toConfirm(v.amount) |
| 263 | } |
| 264 | |
| 265 | const submitCustom = (raw: string) => { |
| 266 | const v = ctx.validate(raw) |