diff --git a/README.md b/README.md index 5d5f01e..67e3f6c 100644 --- a/README.md +++ b/README.md @@ -7,4 +7,11 @@ Live version: https://maldestor95.github.io/score ## How to publish execute in CLI, on a master branch * `npm run build` -* `deploy.bat` \ No newline at end of file +* `deploy.bat` + + +## link to libraries +* chartjs + * https://vue-chartjs.org/guide/ + * https://www.chartjs.org/docs/latest/ +* \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 2c54ebc..14f0203 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,20 @@ { - "name": "dorfcount", - "version": "0.0.1", + "name": "score", + "version": "0.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "dorfcount", - "version": "0.0.1", + "name": "score", + "version": "0.1.1", + "license": "MIT", "dependencies": { + "chart.js": "^4.4.1", + "chartjs-plugin-zoom": "^2.0.1", "markdown-it": "^13.0.1", "pinia": "^2.1.7", - "vue": "^3.3.4", + "vue": "^3.4.5", + "vue-chartjs": "^5.3.0", "yaml": "^2.3.1" }, "devDependencies": { @@ -452,6 +456,11 @@ "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", "dev": true }, + "node_modules/@kurkle/color": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -830,9 +839,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001517", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz", - "integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==", + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", "dev": true, "funding": [ { @@ -849,6 +858,28 @@ } ] }, + "node_modules/chart.js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.1.tgz", + "integrity": "sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==", + "dependencies": { + "@kurkle/color": "^0.3.0" + }, + "engines": { + "pnpm": ">=7" + } + }, + "node_modules/chartjs-plugin-zoom": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/chartjs-plugin-zoom/-/chartjs-plugin-zoom-2.0.1.tgz", + "integrity": "sha512-ogOmLu6e+Q7E1XWOCOz9YwybMslz9qNfGV2a+qjfmqJYpsw5ZMoRHZBUyW+NGhkpQ5PwwPA/+rikHpBZb7PZuA==", + "dependencies": { + "hammerjs": "^2.0.8" + }, + "peerDependencies": { + "chart.js": ">=3.2.0" + } + }, "node_modules/chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -1148,6 +1179,14 @@ "node": "*" } }, + "node_modules/hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==", + "engines": { + "node": ">=0.8.0" + } + }, "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -2035,6 +2074,15 @@ } } }, + "node_modules/vue-chartjs": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.3.0.tgz", + "integrity": "sha512-8XqX0JU8vFZ+WA2/knz4z3ThClduni2Nm0BMe2u0mXgTfd9pXrmJ07QBI+WAij5P/aPmPMX54HCE1seWL37ZdQ==", + "peerDependencies": { + "chart.js": "^4.1.1", + "vue": "^3.0.0-0 || ^2.7.0" + } + }, "node_modules/vue-template-compiler": { "version": "2.7.14", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", @@ -2295,6 +2343,11 @@ } } }, + "@kurkle/color": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@kurkle/color/-/color-0.3.2.tgz", + "integrity": "sha512-fuscdXJ9G1qb7W8VdHi+IwRqij3lBkosAm4ydQtEmbY58OzHXqQhvlxqEkoz0yssNVn38bcpRWgA9PP+OGoisw==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -2592,11 +2645,27 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001517", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz", - "integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==", + "version": "1.0.30001578", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001578.tgz", + "integrity": "sha512-J/jkFgsQ3NEl4w2lCoM9ZPxrD+FoBNJ7uJUpGVjIg/j0OwJosWM36EPDv+Yyi0V4twBk9pPmlFS+PLykgEvUmg==", "dev": true }, + "chart.js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/chart.js/-/chart.js-4.4.1.tgz", + "integrity": "sha512-C74QN1bxwV1v2PEujhmKjOZ7iUM4w6BWs23Md/6aOZZSlwMzeCIDGuZay++rBgChYru7/+QFeoQW0fQoP534Dg==", + "requires": { + "@kurkle/color": "^0.3.0" + } + }, + "chartjs-plugin-zoom": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/chartjs-plugin-zoom/-/chartjs-plugin-zoom-2.0.1.tgz", + "integrity": "sha512-ogOmLu6e+Q7E1XWOCOz9YwybMslz9qNfGV2a+qjfmqJYpsw5ZMoRHZBUyW+NGhkpQ5PwwPA/+rikHpBZb7PZuA==", + "requires": { + "hammerjs": "^2.0.8" + } + }, "chokidar": { "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", @@ -2828,6 +2897,11 @@ "is-glob": "^4.0.3" } }, + "hammerjs": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/hammerjs/-/hammerjs-2.0.8.tgz", + "integrity": "sha512-tSQXBXS/MWQOn/RKckawJ61vvsDpCom87JgxiYdGwHdOa0ht0vzUWDlfioofFCRU0L+6NGDt6XzbgoJvZkMeRQ==" + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -3369,6 +3443,12 @@ "@vue/shared": "3.4.5" } }, + "vue-chartjs": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/vue-chartjs/-/vue-chartjs-5.3.0.tgz", + "integrity": "sha512-8XqX0JU8vFZ+WA2/knz4z3ThClduni2Nm0BMe2u0mXgTfd9pXrmJ07QBI+WAij5P/aPmPMX54HCE1seWL37ZdQ==", + "requires": {} + }, "vue-template-compiler": { "version": "2.7.14", "resolved": "https://registry.npmjs.org/vue-template-compiler/-/vue-template-compiler-2.7.14.tgz", diff --git a/package.json b/package.json index 26527e6..529c499 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,20 @@ "version": "0.1.1", "type": "module", "homepage": "https://github.com/maldestor95/score", - "description": "Online Scoreboard tool","license":"MIT", + "description": "Online Scoreboard tool", + "license": "MIT", "scripts": { "dev": "vite --host", "build": "vue-tsc && vite build", "preview": "vite preview" }, "dependencies": { + "chart.js": "^4.4.1", + "chartjs-plugin-zoom": "^2.0.1", "markdown-it": "^13.0.1", "pinia": "^2.1.7", "vue": "^3.4.5", + "vue-chartjs": "^5.3.0", "yaml": "^2.3.1" }, "devDependencies": { diff --git a/src/pages/wizard/bets.vue b/src/pages/wizard/bets.vue deleted file mode 100644 index 7c9b1e3..0000000 --- a/src/pages/wizard/bets.vue +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/src/pages/wizard/editscore.vue b/src/pages/wizard/editscore.vue index 5b4c1d7..ae2df16 100644 --- a/src/pages/wizard/editscore.vue +++ b/src/pages/wizard/editscore.vue @@ -17,11 +17,13 @@
-
- -
diff --git a/src/pages/wizard/history.vue b/src/pages/wizard/history.vue new file mode 100644 index 0000000..7fcd531 --- /dev/null +++ b/src/pages/wizard/history.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/pages/wizard/historychart.vue b/src/pages/wizard/historychart.vue new file mode 100644 index 0000000..bf4b5d0 --- /dev/null +++ b/src/pages/wizard/historychart.vue @@ -0,0 +1,118 @@ + + + diff --git a/src/pages/wizard/index.vue b/src/pages/wizard/index.vue index 497056f..8d85535 100644 --- a/src/pages/wizard/index.vue +++ b/src/pages/wizard/index.vue @@ -1,21 +1,21 @@ diff --git a/src/pages/wizard/store.ts b/src/pages/wizard/store.ts index ebffccb..1417e96 100644 --- a/src/pages/wizard/store.ts +++ b/src/pages/wizard/store.ts @@ -8,6 +8,7 @@ interface State { } export type UserInfo = { + userId: number name: string scorePerRound: number[] betPerRound: number[] @@ -16,7 +17,7 @@ export type UserInfo = { } const DefaultSettings = () => { return { - userList: [{ name: 'player1', scorePerRound: [], betPerRound: [], currentRound: 0, currentBet: 0 }], + userList: [{ userId: 0, name: 'player1', scorePerRound: [], betPerRound: [], currentRound: 0, currentBet: 0 }], trackBets: false, scoreSteps: [1, 5, 10], betSteps: [1, 2, 5, 10], @@ -46,6 +47,20 @@ export const useScoreStore = defineStore('scores', { return user.scorePerRound.reduce((a, b) => a + b) }) }, + cumulativeScore: (state) => { + return state.userList.map(user => { + if (user.scorePerRound.length == 0) return 0 + let cumul: number[] = [] + for (let index = 0; index < user.scorePerRound.length; index++) { + if (index == 0) { cumul.push(user.scorePerRound[index]) } else { + + cumul.push(user.scorePerRound[index] + cumul[index - 1]) + } + + } + return cumul + }) + }, isGameStarted: (state) => { return state.userList[0].scorePerRound.length > 0 } @@ -54,7 +69,7 @@ export const useScoreStore = defineStore('scores', { addUser() { const username = `player${this.userList.length + 1}` - this.userList.push({ name: username, betPerRound: [], scorePerRound: [], currentBet: 0, currentRound: 0 }) + this.userList.push({ userId: this.userList.length + 1, name: username, betPerRound: [], scorePerRound: [], currentBet: 0, currentRound: 0 }) }, deleteUser(userId: number) { console.log(userId + 'delete') @@ -100,12 +115,17 @@ export const useScoreStore = defineStore('scores', { getScore(userId: number) { return this.totalScore[userId] }, + editCurrentRound(userId: number, newValue: number) { this.userList[userId].currentRound = newValue }, editCurrentBet(userId: number, newValue: number) { this.userList[userId].currentBet = newValue } + , + getCumulativeScore(userId: number) { + return this.cumulativeScore[userId] + } } })