From b597acbc35984967fb2f857b057c96ea869d9f1f Mon Sep 17 00:00:00 2001 From: Florian Sylvain Date: Wed, 8 Mar 2023 17:43:19 +0100 Subject: [PATCH] Implemented style, better game flow, learning mode --- src/routers/paintings.ts | 2 +- web/public/background.svg | 12 ++++ web/src/App.vue | 10 ++- web/src/assets/base.css | 46 ++++++++++++ web/src/components/Learn.vue | 0 web/src/components/Quizz.vue | 47 +++++------- web/src/router/index.ts | 12 +++- web/src/utils/apiFetch.ts | 32 +++++++++ web/src/views/HomeView.vue | 99 ++++---------------------- web/src/views/LearnGame.vue | 126 ++++++++++++++++++++++++++++++++ web/src/views/NormalGame.vue | 134 +++++++++++++++++++++++++++++++++++ 11 files changed, 401 insertions(+), 119 deletions(-) create mode 100644 web/public/background.svg create mode 100644 web/src/components/Learn.vue create mode 100644 web/src/utils/apiFetch.ts create mode 100644 web/src/views/LearnGame.vue create mode 100644 web/src/views/NormalGame.vue diff --git a/src/routers/paintings.ts b/src/routers/paintings.ts index b68c001..b6f3470 100644 --- a/src/routers/paintings.ts +++ b/src/routers/paintings.ts @@ -175,7 +175,7 @@ async function getPainting(id?: number, name?: string): Promise return await prisma.painting.findUnique({ where: id ? { id } : { name }, - include: { PaintingAuthor: { select: { author: true } } }, + include: { PaintingAuthor: { select: { author: true } }, Musuem: true }, }) } diff --git a/web/public/background.svg b/web/public/background.svg new file mode 100644 index 0000000..3ad079f --- /dev/null +++ b/web/public/background.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/web/src/App.vue b/web/src/App.vue index db74953..c300752 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -3,7 +3,13 @@ import { RouterView } from "vue-router" - + diff --git a/web/src/assets/base.css b/web/src/assets/base.css index c5fbb94..290f47e 100644 --- a/web/src/assets/base.css +++ b/web/src/assets/base.css @@ -1,3 +1,49 @@ +:root { + --color-primary: #15245A; + --color-secondary: #4B68D7; + --color-tertiary: #E6E6E6; + --color-success: #0AA607; + --color-fail: #A52853; + + --color-text: #1e1e1e; +} + * { box-sizing: border-box; + font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif; +} + +body { + margin: 0; + + background-image: url(/background.svg); + background-size: cover; + background-repeat: no-repeat; +} + +button { + border: none; + border-radius: 0; + outline: none; + + padding: 6px 12px; + + background-color: var(--color-tertiary); + + cursor: pointer; +} + +.button-neutral { + color: var(--color-text); + border: solid 2px var(--color-text); +} + +.button-success { + color: var(--color-success); + border: solid 2px var(--color-success); +} + +.button-fail { + color: var(--color-fail); + border: solid 2px var(--color-fail); } \ No newline at end of file diff --git a/web/src/components/Learn.vue b/web/src/components/Learn.vue new file mode 100644 index 0000000..e69de29 diff --git a/web/src/components/Quizz.vue b/web/src/components/Quizz.vue index 1ea7993..b6dcd91 100644 --- a/web/src/components/Quizz.vue +++ b/web/src/components/Quizz.vue @@ -1,23 +1,6 @@ @@ -70,32 +16,17 @@ function resetGame(): void { .container { display: flex; flex-direction: column; - gap: 16px; - - width: 100%; - max-width: 350px; -} - -.container > p, -.container > h2 { - margin: 0; -} - -.container > p { - text-align: center; -} - -.quizz-footer { - display: flex; - justify-content: space-between; align-items: center; -} - -.game-over { - display: flex; - flex-direction: column; - gap: 16px; justify-content: center; - align-items: center; + gap: 16px; +} + +.container h1 { + color: #fff; +} + +.container button { + width: 100%; + max-width: 200px; } diff --git a/web/src/views/LearnGame.vue b/web/src/views/LearnGame.vue new file mode 100644 index 0000000..520283c --- /dev/null +++ b/web/src/views/LearnGame.vue @@ -0,0 +1,126 @@ + + + + + diff --git a/web/src/views/NormalGame.vue b/web/src/views/NormalGame.vue new file mode 100644 index 0000000..2d6825d --- /dev/null +++ b/web/src/views/NormalGame.vue @@ -0,0 +1,134 @@ + + + + +