summaryrefslogtreecommitdiff
path: root/views/games_active.pug
blob: f8f41114eb0dab1e316e7bcf4c50a70ed062e6b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//- vim:ts=4:sw=4:
- let open_games = games.filter(game => game.status === 0 && !game.is_match)
- let future_games = games.filter(game => game.status === 0 && game.is_match)
- let active_games = games.filter(game => game.status === 1 && game.is_opposed && !game.your_turn)
- let move_games = games.filter(game => game.status === 1 && game.is_opposed && game.your_turn)
- let solo_games = games.filter(game => game.status === 1 && !game.is_opposed)
- let finished_games = games.filter(game => game.status === 2)
- move_games.sort((a,b)=> a.mtime < b.mtime ? -1 : a.mtime > b.mtime ? 1 : 0)
- finished_games.sort((a,b)=> a.mtime < b.mtime ? -1 : a.mtime > b.mtime ? 1 : 0)
doctype html
html
	head
		include head
		title= SITE_NAME
		if active_games.length > 0
			meta(http-equiv="refresh" content=600)
	body
		include header
		article.wide
			h1 Your games

			if open_games.length > 0
				h2 Open
				+gamelist(open_games)

			p
				a(href="/create") Create a new game

			+tourlist(seeds, active_pools, finished_pools)

			p
				a(href="/tm/list") Join a tournament

			if move_games.length > 0
				h2 Move
				+gamelist(move_games)

			if active_games.length > 0
				h2 Active
				+gamelist(active_games)

			if solo_games.length > 0
				h2 Solo
				+gamelist(solo_games)

			if future_games.length > 0
				h2 Future
				+gamelist(future_games)

			if finished_games.length > 0
				h2 Recently finished
				+gamelist(finished_games)

			p
				a(href="/games/finished") All your finished games
				br
				a(href="/tm/finished") All your finished tournaments