Public Access
feat: remove import URL functionality from Overview component
This commit is contained in:
1 parent
76dc09901a
commit
26041cba1e
1 file changed
-47
@@ -46,28 +46,6 @@ export default function Overview({ examCount, resultCount, recentResults, onLoad
|
||||
}
|
||||
}
|
||||
|
||||
const [importUrl, setImportUrl] = useState('')
|
||||
const [importing, setImporting] = useState(false)
|
||||
|
||||
const handleImportUrl = async () => {
|
||||
if (!importUrl.trim()) return
|
||||
setUploadErr(null)
|
||||
setImporting(true)
|
||||
try {
|
||||
const res = await fetch(importUrl.trim())
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`)
|
||||
const data = await res.json() as unknown
|
||||
const msg = validateExam(data)
|
||||
if (msg) throw new Error(msg)
|
||||
onLoadExam(parseExam(data), true)
|
||||
setImportUrl('')
|
||||
} catch (e) {
|
||||
setUploadErr(t('landing.loadError', { message: (e as Error).message }))
|
||||
} finally {
|
||||
setImporting(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleRetakeWeakest = async (examId: number) => {
|
||||
try {
|
||||
const exam = await examApi.getExam(examId)
|
||||
@@ -166,31 +144,6 @@ export default function Overview({ examCount, resultCount, recentResults, onLoad
|
||||
/>
|
||||
</button>
|
||||
|
||||
{/* <div
|
||||
className="workspace-card"
|
||||
style={{ flex: 1, minWidth: 220, padding: 16, display: 'flex', flexDirection: 'column', gap: 8 }}
|
||||
>
|
||||
<div style={{ fontSize: 13, fontWeight: 500 }}>{t('workspace.importFromUrl')}</div>
|
||||
<div style={{ display: 'flex', gap: 8 }}>
|
||||
<input
|
||||
type="text"
|
||||
className="input"
|
||||
placeholder={t('workspace.importUrlPlaceholder')}
|
||||
value={importUrl}
|
||||
onChange={(e) => setImportUrl(e.target.value)}
|
||||
style={{ fontSize: 12, padding: '4px 8px', flex: 1 }}
|
||||
/>
|
||||
<button
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={() => void handleImportUrl()}
|
||||
disabled={importing || !importUrl.trim()}
|
||||
style={{ fontSize: 12 }}
|
||||
>
|
||||
{importing ? t('workspace.importing') : t('workspace.import')}
|
||||
</button>
|
||||
</div>
|
||||
</div> */}
|
||||
|
||||
<button
|
||||
className="workspace-card"
|
||||
style={{ flex: 1, minWidth: 220, padding: 16, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', cursor: 'pointer', background: 'var(--paper-2)' }}
|
||||
|
||||
Reference in new issue
Block a user