From 903bc35bd31e0ce197282ab2cc259f40ef23ec2f Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Tue, 15 Feb 2022 08:46:15 +0100 Subject: [PATCH] Display & transitions --- index.html | 4 +- src/App.vue | 2 +- src/globals.ts | 10 ++-- src/index.css | 1 + src/store.ts | 11 ++++- src/views/GameView.vue | 106 ++++++++++++++++++++++++++++------------- tailwind.config.js | 1 + 7 files changed, 93 insertions(+), 42 deletions(-) diff --git a/index.html b/index.html index f6aabab..f40619f 100644 --- a/index.html +++ b/index.html @@ -3,9 +3,9 @@ + - - Vite App + Le compte est bon diff --git a/src/App.vue b/src/App.vue index fc25d1f..d0a86fd 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,5 +1,5 @@ diff --git a/src/globals.ts b/src/globals.ts index 91b2b33..32e77a8 100644 --- a/src/globals.ts +++ b/src/globals.ts @@ -6,9 +6,11 @@ export const pool = [ ] as const export enum GameState { - Playing, - Lost, - Won, + Undefined = 0, + Waiting = 1, + Playing = 2, + Lost = 3, + Won = 4, } -export const gameState = ref(GameState.Playing) +export const gameState = ref(GameState.Undefined) diff --git a/src/index.css b/src/index.css index 3acfeb9..ea3c8d4 100644 --- a/src/index.css +++ b/src/index.css @@ -46,6 +46,7 @@ /* Legacy iOS */ } +.slide_left-move, .slide_left-enter-active, .slide_left-leave-active { transition: all 0.5s ease; diff --git a/src/store.ts b/src/store.ts index 788a3ab..d1b9e1d 100644 --- a/src/store.ts +++ b/src/store.ts @@ -1,6 +1,15 @@ -import { reactive, ref } from 'vue' +import { computed, reactive, ref } from 'vue' +import { isOperationReady } from './algo' import { Operation, Plaquette } from './types' export const operations = reactive([]) export const plaquettes = ref([]) + +export const currentOperation = computed( + () => operations[operations.length - 1], +) + +export const isEndGame = computed( + () => operations.length === 5 && isOperationReady(currentOperation.value), +) diff --git a/src/views/GameView.vue b/src/views/GameView.vue index 785fa1c..a56014e 100644 --- a/src/views/GameView.vue +++ b/src/views/GameView.vue @@ -1,9 +1,10 @@ diff --git a/tailwind.config.js b/tailwind.config.js index e10c99a..34c631d 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,4 +1,5 @@ module.exports = { + darkMode: 'class', content: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'], theme: { extend: {},