(e: React.ChangeEvent<HTMLInputElement>)
| 143 | } |
| 144 | |
| 145 | const handleFileUpload = (e: React.ChangeEvent<HTMLInputElement>) => { |
| 146 | const file = e.target.files?.[0] |
| 147 | if (!file) return |
| 148 | |
| 149 | if (!file.name.endsWith(".json")) { |
| 150 | setParseError("Please upload a .json file") |
| 151 | return |
| 152 | } |
| 153 | |
| 154 | const reader = new FileReader() |
| 155 | reader.onload = (event) => { |
| 156 | const content = event.target?.result as string |
| 157 | setJsonInput(content) |
| 158 | parseJson(content) |
| 159 | } |
| 160 | reader.onerror = () => { |
| 161 | setParseError("Failed to read file") |
| 162 | } |
| 163 | reader.readAsText(file) |
| 164 | |
| 165 | if (fileInputRef.current) { |
| 166 | fileInputRef.current.value = "" |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | const handleImport = async () => { |
| 171 | if (parsedExtensions.length === 0) return |
nothing calls this directly
no test coverage detected