diff --git a/src/routes/CreateDeck.svelte b/src/routes/CreateDeck.svelte index db5efe5..f6219ba 100644 --- a/src/routes/CreateDeck.svelte +++ b/src/routes/CreateDeck.svelte @@ -130,6 +130,25 @@ function cancel() { push('/'); } + + let copied = false; + function copyJson() { + const payload = { + title, + description, + config, + questions: questions.map((q) => ({ + prompt: q.prompt, + explanation: q.explanation, + answers: q.answers, + correct_answer_indices: q.correct_answer_indices, + })), + }; + navigator.clipboard.writeText(JSON.stringify(payload, null, 2)).then(() => { + copied = true; + setTimeout(() => { copied = false; }, 2000); + }); + }