diff --git a/.prettierrc b/.prettierrc index 8103a0b..3a5f523 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,16 +1,17 @@ { - "useTabs": true, - "singleQuote": true, - "trailingComma": "none", - "printWidth": 100, - "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], - "overrides": [ - { - "files": "*.svelte", - "options": { - "parser": "svelte" - } - } - ], - "tailwindStylesheet": "./src/app.css" + "useTabs": false, + "singleQuote": false, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], + "overrides": [ + { + "files": "*.svelte", + "options": { + "parser": "svelte" + } + } + ], + "tailwindStylesheet": "./src/app.css", + "tabWidth": 4 } diff --git a/.vscode/settings.json b/.vscode/settings.json index 4894801..71b05b6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true } diff --git a/src/app.css b/src/app.css index d4b5078..230536e 100644 --- a/src/app.css +++ b/src/app.css @@ -1 +1,34 @@ -@import 'tailwindcss'; +@import "tailwindcss"; + +@layer components { + .btn { + border: 1px solid black; + border-radius: 5px; + padding: 4px; + cursor: pointer; + height: fit-content; + } + + .btn:hover { + background-color: rgba(0, 0, 0, 0.1); + } + + .inputField { + padding: 8px; + } + + .card { + border: 1px solid black; + border-radius: 5px; + display: flex; + align-items: center; + justify-content: center; + font-size: larger; + font-weight: bold; + cursor: pointer; + } + + .card:hover { + background-color: rgba(0, 0, 0, 0.1); + } +} diff --git a/src/app.html b/src/app.html index 22165c5..d48b32c 100644 --- a/src/app.html +++ b/src/app.html @@ -1,19 +1,21 @@ - - - - - %sveltekit.head% + + + + + %sveltekit.head% + + +
%sveltekit.body%
- - -
%sveltekit.body%
+ - + document.documentElement.classList.remove("light", "dark"); + document.documentElement.classList.add("dark"); + + diff --git a/src/lib/games/games.ts b/src/lib/games/games.ts new file mode 100644 index 0000000..6e9574b --- /dev/null +++ b/src/lib/games/games.ts @@ -0,0 +1,973 @@ +const games: Games = [ + { + name: "LAN Party", + walls: [ + { + name: "Wall 1", + categories: [ + { + name: "Category 1", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 2", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 3", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 4", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 5", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + } + ] + }, + { + name: "Wall 2", + categories: [ + { + name: "Category 1", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 2", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 3", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 4", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 5", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + } + ] + } + ] + }, + { + name: "LAN Party 2", + walls: [ + { + name: "Wall 1", + categories: [ + { + name: "Category 1", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 2", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 3", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 4", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 5", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + } + ] + }, + { + name: "Wall 2", + categories: [ + { + name: "Category 1", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 2", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 3", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 4", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + }, + { + name: "Category 5", + questions: [ + { + points: 100, + type: "SIMPLE", + data: { + question: "Question 1?", + answer: "Answer 1" + } + }, + { + points: 200, + type: "SIMPLE", + data: { + question: "Question 2?", + answer: "Answer 2" + } + }, + { + points: 300, + type: "SIMPLE", + data: { + question: "Question 3?", + answer: "Answer 3" + } + }, + { + points: 400, + type: "SIMPLE", + data: { + question: "Question 4?", + answer: "Answer 4" + } + }, + { + points: 500, + type: "SIMPLE", + data: { + question: "Question 5?", + answer: "Answer 5" + } + } + ] + } + ] + } + ] + } +]; + +export type Question = { + points: number; + type: "SIMPLE" | "MULTIPLE_CHOICE"; +}; + +export type SimpleQuestion = Question & { + type: "SIMPLE"; + data: { + question: string; + answer: string; + }; +}; + +export type MultipleChoiceQuestion = Question & { + type: "MULTIPLE_CHOICE"; + data: { + question: string; + answer: number; + choices: string[]; + }; +}; + +export type Category = { + name: string; + questions: (SimpleQuestion | MultipleChoiceQuestion)[]; +}; + +export type Wall = { + name: string; + categories: Category[]; +}; + +export type Game = { + name: string; + walls: Wall[]; +}; + +export type Games = Game[]; + +export default games; diff --git a/src/lib/games/lanparty.ts b/src/lib/games/lanparty.ts deleted file mode 100644 index 1f32d7f..0000000 --- a/src/lib/games/lanparty.ts +++ /dev/null @@ -1,932 +0,0 @@ -export default [ - { - name: 'LAN Party', - walls: [ - { - name: 'Wall 1', - categories: [ - { - name: 'Category 1', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 2', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 3', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 4', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 5', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - } - ] - }, - { - name: 'Wall 2', - categories: [ - { - name: 'Category 1', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 2', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 3', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 4', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 5', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - } - ] - } - ] - }, - { - name: 'LAN Party 2', - walls: [ - { - name: 'Wall 1', - categories: [ - { - name: 'Category 1', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 2', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 3', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 4', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 5', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - } - ] - }, - { - name: 'Wall 2', - categories: [ - { - name: 'Category 1', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 2', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 3', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 4', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - }, - { - name: 'Category 5', - questions: [ - { - points: 100, - type: 'SIMPLE', - data: { - question: 'Question 1?', - answer: 'Answer 1' - } - }, - { - points: 200, - type: 'SIMPLE', - data: { - question: 'Question 2?', - answer: 'Answer 2' - } - }, - { - points: 300, - type: 'SIMPLE', - data: { - question: 'Question 3?', - answer: 'Answer 3' - } - }, - { - points: 400, - type: 'SIMPLE', - data: { - question: 'Question 4?', - answer: 'Answer 4' - } - }, - { - points: 500, - type: 'SIMPLE', - data: { - question: 'Question 5?', - answer: 'Answer 5' - } - } - ] - } - ] - } - ] - } -]; diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts new file mode 100644 index 0000000..f1264e9 --- /dev/null +++ b/src/routes/+page.server.ts @@ -0,0 +1,7 @@ +import games from '$lib/games/games'; + +export function load() { + return { + games + }; +} diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 515a023..e7e2fed 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,14 +1,14 @@

Jeopardy

- {#each games as game} + {#each data.games as game, i} {game.name}{game.name} {/each}
diff --git a/src/routes/[game]/+page.server.ts b/src/routes/[game]/+page.server.ts new file mode 100644 index 0000000..583a1b1 --- /dev/null +++ b/src/routes/[game]/+page.server.ts @@ -0,0 +1,12 @@ +import { error } from '@sveltejs/kit'; +import games from '$lib/games/games'; + +export function load({ params }) { + const index = parseInt(params.game); + if (isNaN(index)) { + error(404); + } + const game = games[index]; + if (game === undefined) error(404); + else return game; +} diff --git a/src/routes/[game]/+page.svelte b/src/routes/[game]/+page.svelte index 9dc1c2c..edccb86 100644 --- a/src/routes/[game]/+page.svelte +++ b/src/routes/[game]/+page.svelte @@ -1 +1,75 @@ -

This is Game ...

+ + +
+

{gameManager.game.name}

+ {#if gameManager.state === GameState.INIT} +
+
+

Spieler

+ +
+
+ {#each gameManager.players as player, i} +
+ + +
+ {/each} +
+ +
+ {:else} + + {/if} +
diff --git a/src/routes/[game]/GameState.ts b/src/routes/[game]/GameState.ts new file mode 100644 index 0000000..4956b39 --- /dev/null +++ b/src/routes/[game]/GameState.ts @@ -0,0 +1,4 @@ +export enum GameState { + INIT, + RUNNING +} diff --git a/src/routes/[game]/Player.ts b/src/routes/[game]/Player.ts new file mode 100644 index 0000000..af43278 --- /dev/null +++ b/src/routes/[game]/Player.ts @@ -0,0 +1,4 @@ +export interface Player { + name: string; + points: number; +} diff --git a/src/routes/[game]/Wall.svelte b/src/routes/[game]/Wall.svelte new file mode 100644 index 0000000..5605b10 --- /dev/null +++ b/src/routes/[game]/Wall.svelte @@ -0,0 +1,23 @@ + + +
+ {#each wall.categories as category} +
+
{category.name}
+
+ {#each category.questions as question} +
+
{question.points}
+
+ {/each} + {/each} +