+
+
{{ op.right?.value ?? ' ' }}
- =
+
@@ -72,13 +78,14 @@ import {
isOperationResultValid,
operate,
} from '@/algo'
-import { operations, plaquettes } from '@/game-state'
-import { GameState, gameState } from '@/globals'
+import PlaquetteBox from '@/components/common/PlaquetteBox.vue'
+import { gameState, operations, plaquettes } from '@/composables/game-state'
+import { operatorIcons } from '@/composables/operators'
+import { GameState } from '@/globals'
import { Operation } from '@/types'
-import IconUndo from '~icons/bx/bx-undo'
+import IconEquals from '~icons/ph/equals-bold'
import IconSad from '~icons/ph/smiley-sad'
-
-import PlaquetteBox from './common/PlaquetteBox.vue'
+import IconUndo from '~icons/ph/x-circle-fill'
const transDelay = 100
diff --git a/src/components/OperatorsList.vue b/src/components/OperatorsList.vue
new file mode 100644
index 0000000..4c9ec31
--- /dev/null
+++ b/src/components/OperatorsList.vue
@@ -0,0 +1,23 @@
+
+
+
+
+
diff --git a/src/components/PlaquettesList.vue b/src/components/PlaquettesList.vue
new file mode 100644
index 0000000..6133bf9
--- /dev/null
+++ b/src/components/PlaquettesList.vue
@@ -0,0 +1,43 @@
+
+
+
+
+ {{ item.value }}
+
+
+
+
+
+
diff --git a/src/components/common/NumberBox.vue b/src/components/common/NumberBox.vue
deleted file mode 100644
index 8183b0e..0000000
--- a/src/components/common/NumberBox.vue
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
diff --git a/src/components/common/PlaquetteBox.vue b/src/components/common/PlaquetteBox.vue
index c394938..69c7774 100644
--- a/src/components/common/PlaquetteBox.vue
+++ b/src/components/common/PlaquetteBox.vue
@@ -1,7 +1,7 @@
([getEmptyOperation()])
export const plaquettes = ref([])
@@ -12,6 +15,7 @@ export const currentOperation = computed(
() => operations[operations.length - 1],
)
+export const gameIsRunning = computed(() => gameState.value > GameState.Loading)
export const isEndGame = computed(
() =>
(operations.length === 5 && isOperationReady(currentOperation.value)) ||
diff --git a/src/composables/operators.ts b/src/composables/operators.ts
new file mode 100644
index 0000000..57ba451
--- /dev/null
+++ b/src/composables/operators.ts
@@ -0,0 +1,11 @@
+import IconDivide from '~icons/ph/divide-bold'
+import IconMinus from '~icons/ph/minus-bold'
+import IconPlus from '~icons/ph/plus-bold'
+import IconMultiply from '~icons/ph/x-bold'
+
+export const operatorIcons = {
+ '+': IconPlus,
+ '-': IconMinus,
+ x: IconMultiply,
+ '/': IconDivide,
+} as const
diff --git a/src/globals.ts b/src/globals.ts
index 936a6d1..94ec662 100644
--- a/src/globals.ts
+++ b/src/globals.ts
@@ -1,15 +1,8 @@
-import { ref } from 'vue'
-
export const operators = ['+', '-', 'x', '/'] as const
export const pools = {
1: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25],
- 2: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 50, 75],
- 3: [
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 25, 50, 75,
- 100,
- ],
- 4: [2, 2, 3, 3, 5, 5, 7, 11, 13, 17, 19, 23],
+ 2: [2, 2, 3, 3, 5, 5, 7, 11, 13, 17, 19, 23],
} as const
export enum GameState {
@@ -18,5 +11,3 @@ export enum GameState {
Loading = 2,
Playing = 3,
}
-
-export const gameState = ref(GameState.Undefined)
diff --git a/src/index.css b/src/index.css
index 58d3e34..34addc3 100644
--- a/src/index.css
+++ b/src/index.css
@@ -75,4 +75,11 @@
.zero_height-leave-to {
height: 0;
opacity: 0;
+}
+
+@layer components {
+ .btn {
+ @apply w-fit p-2;
+ @apply rounded border border-stone-600 transition-opacity;
+ }
}
\ No newline at end of file
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 06f8680..0bc6ce3 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -6,5 +6,7 @@
"easy": "facile",
"medium": "moyen",
"hard": "difficile",
- "impossible": "☠"
+ "impossible": "☠",
+ "dailyGame": "Défi quotidien",
+ "randomGame": "Nombre au hasard"
}
diff --git a/src/router/index.ts b/src/router/index.ts
index 64440a2..b4b6f00 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -1,14 +1,24 @@
import { createRouter, createWebHistory } from 'vue-router'
-import GameView from '../views/GameView.vue'
+import HomeView from '../views/HomeView.vue'
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
routes: [
{
path: '/',
- name: 'game',
- component: GameView,
+ name: 'home',
+ component: HomeView,
+ },
+ {
+ path: '/daily',
+ name: 'daily',
+ component: () => import('../views/GameView.vue'),
+ },
+ {
+ path: '/random',
+ name: 'random',
+ component: () => import('../views/GameView.vue'),
},
],
})
diff --git a/src/views/GameView.vue b/src/views/GameView.vue
index f165668..a8a5441 100644
--- a/src/views/GameView.vue
+++ b/src/views/GameView.vue
@@ -1,120 +1,78 @@
-
-
- Le compte est bon
-
+
-
-
- {{ result }}
-
+
+
+ {{ result }}
+
-
-
-
-
-
- Combinez les nombres imposés afin de trouver le résultat ci-dessus, ou
- de vous en approcher le plus possible.
- Le compteur démarre quand vous cliquez sur le bouton. Partagez
- vos meilleurs temps !
-
-
-
- Niveau de difficulté :
- {{ difficultyLabel }}
-
-
-
-
- {{ t('startGame') }}
-
-
-
-
-
+
+
+
-
-
- {{ item.value }}
-
-
+ class="text-center"
+ v-if="gameState === GameState.Waiting">
+
+ Combinez les nombres imposés afin de trouver le résultat ci-dessus, ou
+ de vous en approcher le plus possible.
+ Le compteur démarre quand vous cliquez sur le bouton. Partagez vos
+ meilleurs temps !
+
+
+
+ {{ t('startGame') }}
+
+
-
-
-
-
+
+
-
-
+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
- {{ t('playAgain') }}
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{ t('playAgain') }}
+
+
+
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
new file mode 100644
index 0000000..82f2c7c
--- /dev/null
+++ b/src/views/HomeView.vue
@@ -0,0 +1,42 @@
+
+
+
+
+ Combinez les nombres imposés afin d'atteindre le résultat, ou de vous en
+ approcher le plus possible.
+
+
+
+
+
+
+ {{ t('dailyGame') }}
+
+
+ Un nombre à atteindre, unique pour la journée, commun à tous les
+ joueurs
+
+
+
+
+
+
+ {{ t('randomGame') }}
+
+ Un nombre au hasard, pour le plaisir
+
+
+
+
+
+