Step toward a one-page application
[vchess.git] / client / client_OLD / javascripts / components / tabGames.js
1 // "My" games: tabs my archived local games, my correspondance games
2 // + my imported games (of any type).
3 // TODO: later, also add possibility to upload a game (parse PGN).
4 Vue.component("my-tab-games", {
5 props: ["settings"],
6 data: function() {
7 return {
8 display: "",
9 imported: [],
10 local: [],
11 corr: []
12 };
13 },
14 template: `
15 <div>
16 <div class="button-group">
17 <button @click="display='local'">Local games</button>
18 <button @click="display='corr'">Correspondance games</button>
19 <button @click="display='imported'">Imported games</button>
20 </div>
21 <my-game-list v-show="display=='local'" :games="local">
22 </my-game-list>
23 <my-game-list v-show="display=='corr'" :games="corr">
24 </my-game-list>
25 <my-game-list v-show="display=='imported'" :games="imported">
26 </my-game-list>
27 <button @click="update">Refresh</button>
28 </div>
29 `,
30 created: function() {
31 // TODO: fetch corr games, local and corr
32 // if any corr game where it's my turn, set display = "corr",
33 // else set display = "local" (if any) or imported (if any and no local)
34 },
35 methods: {
36 update: function() {
37 // TODO: scan local + imported games, if any new then add it
38 },
39 },
40 });