diff --git a/package.json b/package.json index 42d38d1..7b25e2b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "0.0.1", "type": "module", "scripts": { - "dev": "vite dev --host", + "dev": "vite dev", "build": "vite build", "preview": "vite preview", "prepare": "svelte-kit sync || echo ''", diff --git a/src/lib/config.js b/src/lib/config.js new file mode 100644 index 0000000..45391e8 --- /dev/null +++ b/src/lib/config.js @@ -0,0 +1,133 @@ +export let AnswersSymbolAndColorScheme = [ + { + color: "#6E0000", + selectedColor: "#AA2222", + hoverBorderColor: "#FF5D5D", + selectedBorderColor: "#FF0000", + symbol: "nf-md-triangle", + }, + { + color: "#00316E", + selectedColor: "#2255AA", + hoverBorderColor: "#5D9CFF", + selectedBorderColor: "#0000FF", + symbol: "nf-fa-square", + }, + { + color: "#6E6E00", + selectedColor: "#AAAA22", + hoverBorderColor: "#FFFF5D", + selectedBorderColor: "#DDFF00", + symbol: "nf-fa-circle", + }, + { + color: "#006E00", + selectedColor: "#22AA22", + hoverBorderColor: "#5DFF5D", + selectedBorderColor: "#00FF00", + symbol: "nf-fa-diamond", + }, + { + color: "#4B0082", + selectedColor: "#7F33B5", + hoverBorderColor: "#B066FF", + selectedBorderColor: "#9932CC", + symbol: "nf-md-star", + }, + { + color: "#FF8C00", + selectedColor: "#FFB347", + hoverBorderColor: "#FFD580", + selectedBorderColor: "#FFA500", + symbol: "nf-md-hexagon", + }, + { + color: "#008B8B", + selectedColor: "#33CCCC", + hoverBorderColor: "#66FFFF", + selectedBorderColor: "#00CED1", + symbol: "nf-md-octagon", + }, + { + color: "#8B4513", + selectedColor: "#CD853F", + hoverBorderColor: "#DEB887", + selectedBorderColor: "#A0522D", + symbol: "nf-md-heart", + }, +]; + +export let DefaultQuestions = [ + { + name: "What should you do when you're free?", + answers: ["Do something in real life!", "Play video games", "Code!", "Touch grass!"], + correctAnswer: 2, + }, + { + name: "Is RezHackXYZ the best programmer in the world?", + answers: ["Yes :)", "No :("], + correctAnswer: 0, + }, + { + name: "Best place in the world?", + answers: [ + "Google", + "Microsoft", + "Apple", + "Samsung", + "Hack Club!! :D", + "Amazon", + "Facebook", + "Twitter", + ], + correctAnswer: 4, + }, +]; + +export let AiPrompts = { + GenerateQuestionsUsingAI: ` +You are the AI of a quiz game. +Generate a list of quiz questions with possible answers and the correct answer index. +Each question must have: +- A "name" (question text) +- An "answers" array (minimum 2, maximum 8 options) +- A "correctAnswer" (index starting from 0) +Ensure the questions are diverse. +Example format: +{ +"name": "What is the capital of France?", +"answers": [ + "Paris", + "London", + "Berlin", + "Madrid" +], +"correctAnswer": 0 +} +JUST PROVIDE THE JSON AND NOTHING ELSE. + +The user's topic of interest is: +[topic]`, +GenerateOptionsUsingAI: ` +You are the AI of a quiz game. +Generate a list of answers relevant to the Question the correct answer index. +generate 2 things for the question: +- An "answers" array (minimum 2, maximum 8 options) +- A "correctAnswer" (index starting from 0) +Ensure the questions are diverse. +Example format if the question is "What is the capital of France?": +{ +"answers": [ + "Paris", + "London", + "Berlin", + "Madrid" +], +"correctAnswer": 0 +} +JUST PROVIDE THE JSON AND NOTHING ELSE. + +The user's Question that they want to generate options for is: +[question] +` +}; \ No newline at end of file diff --git a/src/lib/config.json b/src/lib/config.json deleted file mode 100644 index a08017a..0000000 --- a/src/lib/config.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "AnswersSymbolAndColor": [ - { - "Color": "#6E0000", - "SelectedColor": "#AA2222", - "HoverBorderColor": "#FF5D5D", - "SelectedBorderColor": "#FF0000", - "Symbol": "nf-md-triangle" - }, - { - "Color": "#00316E", - "SelectedColor": "#2255AA", - "HoverBorderColor": "#5D9CFF", - "SelectedBorderColor": "#0000FF", - "Symbol": "nf-fa-square" - }, - { - "Color": "#6E6E00", - "SelectedColor": "#AAAA22", - "HoverBorderColor": "#FFFF5D", - "SelectedBorderColor": "#DDFF00", - "Symbol": "nf-fa-circle" - }, - { - "Color": "#006E00", - "SelectedColor": "#22AA22", - "HoverBorderColor": "#5DFF5D", - "SelectedBorderColor": "#00ff00", - "Symbol": "nf-fa-diamond" - }, - { - "Color": "#4B0082", - "SelectedColor": "#7F33B5", - "HoverBorderColor": "#B066FF", - "SelectedBorderColor": "#9932CC", - "Symbol": "nf-md-star" - }, - { - "Color": "#FF8C00", - "SelectedColor": "#FFB347", - "HoverBorderColor": "#FFD580", - "SelectedBorderColor": "#FFA500", - "Symbol": "nf-md-hexagon" - }, - { - "Color": "#008B8B", - "SelectedColor": "#33CCCC", - "HoverBorderColor": "#66FFFF", - "SelectedBorderColor": "#00CED1", - "Symbol": "nf-md-octagon" - }, - { - "Color": "#8B4513", - "SelectedColor": "#CD853F", - "HoverBorderColor": "#DEB887", - "SelectedBorderColor": "#A0522D", - "Symbol": "nf-md-heart" - } - ] -} diff --git a/src/routes/create/+page.svelte b/src/routes/create/+page.svelte index 88aaf5c..06798db 100644 --- a/src/routes/create/+page.svelte +++ b/src/routes/create/+page.svelte @@ -1,22 +1,28 @@
-
- +
+
{#each questions.v as question, index} {/each}
- + {#if Wait.v == false} + + {:else} + + {/if}
diff --git a/src/routes/create/components/Questions/question.svelte b/src/routes/create/components/Questions/question.svelte index 272977d..b622e72 100644 --- a/src/routes/create/components/Questions/question.svelte +++ b/src/routes/create/components/Questions/question.svelte @@ -1,5 +1,6 @@ + +{#if questions.v[index].answers.every((answer) => answer === "")} + +{/if} diff --git a/src/routes/create/components/buttons/GenerateQuetionsUsingAI.svelte b/src/routes/create/components/buttons/GenerateQuetionsUsingAI.svelte new file mode 100644 index 0000000..8932152 --- /dev/null +++ b/src/routes/create/components/buttons/GenerateQuetionsUsingAI.svelte @@ -0,0 +1,14 @@ + + +{#if questions.v.length === 0 || (questions.v.length === 1 && questions.v[0].name === "" && questions.v[0].answers.every((answer) => answer === "") && questions.v[0].correctAnswer === undefined)} + +{/if} diff --git a/src/routes/create/components/buttons/WaitStartGame.svelte b/src/routes/create/components/buttons/WaitStartGame.svelte index 863d359..0102b86 100644 --- a/src/routes/create/components/buttons/WaitStartGame.svelte +++ b/src/routes/create/components/buttons/WaitStartGame.svelte @@ -1,10 +1,10 @@