diff --git a/public/components/NewGameDialog.vue.js b/public/components/NewGameDialog.vue.js
new file mode 100644
index 0000000..3eb6040
--- /dev/null
+++ b/public/components/NewGameDialog.vue.js
@@ -0,0 +1,94 @@
+"use strict"
+
+import GameCommon from './../../common/GameCommon.js'
+import Upload from './../components/Upload.vue.js'
+import ImageTeaser from './../components/ImageTeaser.vue.js'
+
+export default {
+ name: 'NewGameDialog',
+ components: {
+ Upload,
+ ImageTeaser,
+ },
+ template: `
+
+
New game
+
+
Running games
-
New game
-
-
-
Image lib
-
-
-
-
Finished games
@@ -66,9 +30,7 @@ export default {
`,
data() {
return {
- tiles: 1000,
- image: '',
- scoreMode: GameCommon.SCORE_MODE_ANY,
+ showNewGameDialog: false,
gamesRunning: [],
gamesFinished: [],
@@ -82,20 +44,6 @@ export default {
this.gamesFinished = json.gamesFinished
this.images = json.images
},
- computed: {
- scoreModeInt () {
- return parseInt(this.scoreMode, 10)
- },
- tilesInt () {
- return parseInt(this.tiles, 10)
- },
- canStartNewGame () {
- if (!this.tilesInt || !this.image || ![0, 1].includes(this.scoreModeInt)) {
- return false
- }
- return true
- },
- },
methods: {
time(start, end) {
const icon = end ? '🏁' : '⏳'
@@ -104,21 +52,14 @@ export default {
const timeDiffStr = Time.timeDiffStr(from, to)
return `${icon} ${timeDiffStr}`
},
- mediaImgUploaded(j) {
- this.image = j.image
- },
- async onNewGameClick() {
+ async onNewGame(gameSettings) {
const res = await fetch('/newgame', {
method: 'post',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
- body: JSON.stringify({
- tiles: this.tilesInt,
- image: this.image,
- scoreMode: this.scoreModeInt,
- }),
+ body: JSON.stringify(gameSettings),
})
if (res.status === 200) {
const game = await res.json()