feat: exercise cards webapp with AI workflow and editor
This commit is contained in:
42
public/import.html
Normal file
42
public/import.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Exercise Cards Import</title>
|
||||
<style>
|
||||
body{font-family:Arial,sans-serif;max-width:900px;margin:24px auto;padding:0 16px}
|
||||
textarea{width:100%;height:320px;font-family:monospace}
|
||||
.row{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
|
||||
button{padding:8px 12px}
|
||||
pre{background:#f6f6f6;padding:10px;overflow:auto}
|
||||
</style></head><body>
|
||||
<h2>JSON-Import für Übungskarten</h2>
|
||||
<p>Erwartetes Format: <code>[{"output": {...}}, ...]</code></p>
|
||||
<div class="row">
|
||||
<input type="file" id="file" accept="application/json,.json,text/plain" />
|
||||
<label><input type="checkbox" id="replace" checked /> Alte Datensätze vorher löschen</label>
|
||||
<button id="importBtn">Importieren</button>
|
||||
<a href="/">Zur Kartenansicht</a>
|
||||
</div>
|
||||
<p>Oder JSON direkt einfügen:</p>
|
||||
<textarea id="json"></textarea>
|
||||
<h3>Ergebnis</h3>
|
||||
<pre id="out">-</pre>
|
||||
<script>
|
||||
const jsonEl=document.getElementById('json');
|
||||
const out=document.getElementById('out');
|
||||
|
||||
document.getElementById('file').addEventListener('change', async (e)=>{
|
||||
const f=e.target.files?.[0]; if(!f) return;
|
||||
jsonEl.value=await f.text();
|
||||
});
|
||||
|
||||
document.getElementById('importBtn').onclick=async()=>{
|
||||
try{
|
||||
const payload={ items: JSON.parse(jsonEl.value), replace: document.getElementById('replace').checked };
|
||||
const r=await fetch('/api/import',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(payload)});
|
||||
const j=await r.json();
|
||||
out.textContent=JSON.stringify(j,null,2);
|
||||
}catch(e){
|
||||
out.textContent='Fehler: '+e.message;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
</body></html>
|
||||
Reference in New Issue
Block a user