import Time from './../../common/Time.js' const GameTeaser = { name: 'game-teaser', props: { game: Object, }, template: `
🧩 {{game.tilesFinished}}/{{game.tilesTotal}}
👥 {{game.players}}
{{time(game.started, game.finished)}}
↪️ Watch replay
`, computed: { style() { const url = this.game.imageUrl.replace('uploads/', 'uploads/r/') + '-375x210.webp' return { 'background-image': `url("${url}")`, } }, }, 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 GameTeaser