diff --git a/game/index.js b/game/index.js
index e5d4823..af335ab 100644
--- a/game/index.js
+++ b/game/index.js
@@ -28,30 +28,50 @@ const Upload = {
}
}
+const GameTeaser = {
+ name: 'gameteaser',
+ props: {
+ game: Object,
+ },
+ template: `
+
`,
+ methods: {
+ time(start, end) {
+ const icon = end ? '🏁' : '⏳'
+ const from = start;
+ const to = end || Time.timestamp()
+ const timeDiffStr = Time.timeDiffStr(from, to)
+ return `${icon} ${timeDiffStr}`
+ },
+ },
+}
+
export default {
components: {
Upload,
+ GameTeaser,
},
props: {
- games: Array,
+ gamesRunning: Array,
+ gamesFinished: Array,
images: Array,
},
template: `
Running games
-
-
+
+
New game
@@ -75,12 +95,16 @@ export default {
Image lib
-
![]()
+ class="imageteaser"
+ :style="{'background-image': 'url(' + i.url + ')'}">
+
+
+
Finished games
+
+
`,
data() {
diff --git a/game/style.css b/game/style.css
index 3eb7d4c..ed4b1f2 100644
--- a/game/style.css
+++ b/game/style.css
@@ -202,3 +202,15 @@ input:focus {
top: 0;
right: 0;
}
+
+
+.imageteaser {
+ width: 150px;
+ height: 100px;
+ display: inline-block;
+ margin: 5px;
+ background-size: contain;
+ background-position: center;
+ background-repeat: no-repeat;
+ background-color: #222;
+}
diff --git a/game/templates/index.html.twig b/game/templates/index.html.twig
index 9c64053..7043d13 100644
--- a/game/templates/index.html.twig
+++ b/game/templates/index.html.twig
@@ -12,7 +12,8 @@
el: '#app',
render: (h) => h(Page, {
props: {
- games: {{ games|json_encode|raw }},
+ gamesRunning: {{ gamesRunning|json_encode|raw }},
+ gamesFinished: {{ gamesFinished|json_encode|raw }},
images: {{ images|json_encode|raw }},
},
}),
diff --git a/server/index.js b/server/index.js
index 542ec6d..379a0d3 100644
--- a/server/index.js
+++ b/server/index.js
@@ -113,7 +113,8 @@ app.use('/', async (req, res, next) => {
]
res.send(await render('index.html.twig', {
- games,
+ gamesRunning: games.filter(g => !g.finished),
+ gamesFinished: games.filter(g => !!g.finished),
images: allImages(),
}))
} else {