(e: React.ChangeEvent<HTMLInputElement>)
| 271 | } |
| 272 | |
| 273 | const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => { |
| 274 | const file = e.target.files?.[0] |
| 275 | if (!file) return |
| 276 | |
| 277 | if (!file.name.endsWith(".json")) { |
| 278 | setJsonError("Please upload a .json file") |
| 279 | return |
| 280 | } |
| 281 | |
| 282 | const reader = new FileReader() |
| 283 | reader.onload = (event) => { |
| 284 | const content = event.target?.result as string |
| 285 | setJsonInput(content) |
| 286 | parseAndApplyJson(content) |
| 287 | } |
| 288 | reader.onerror = () => { |
| 289 | setJsonError("Failed to read file") |
| 290 | } |
| 291 | reader.readAsText(file) |
| 292 | |
| 293 | // Reset file input |
| 294 | if (fileInputRef.current) { |
| 295 | fileInputRef.current.value = "" |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => { |
| 300 | e.preventDefault() |
nothing calls this directly
no test coverage detected