Separate client and server codes. Keep everything in one git repo for simplicity
[vchess.git] / client / client_OLD / javascripts / components / tabGames.js
diff --git a/client/client_OLD/javascripts/components/tabGames.js b/client/client_OLD/javascripts/components/tabGames.js
new file mode 100644 (file)
index 0000000..3861dba
--- /dev/null
@@ -0,0 +1,40 @@
+// "My" games: tabs my archived local games, my correspondance games
+// + my imported games (of any type).
+// TODO: later, also add possibility to upload a game (parse PGN).
+Vue.component("my-tab-games", {
+       props: ["settings"],
+       data: function() {
+               return {
+                       display: "",
+                       imported: [],
+                       local: [],
+                       corr: []
+               };
+       },
+       template: `
+               <div>
+                       <div class="button-group">
+                               <button @click="display='local'">Local games</button>
+                               <button @click="display='corr'">Correspondance games</button>
+                               <button @click="display='imported'">Imported games</button>
+                       </div>
+                       <my-game-list v-show="display=='local'" :games="local">
+                       </my-game-list>
+                       <my-game-list v-show="display=='corr'" :games="corr">
+                       </my-game-list>
+                       <my-game-list v-show="display=='imported'" :games="imported">
+                       </my-game-list>
+                       <button @click="update">Refresh</button>
+               </div>
+       `,
+       created: function() {
+               // TODO: fetch corr games, local and corr
+               // if any corr game where it's my turn, set display = "corr",
+               // else set display = "local" (if any) or imported (if any and no local)
+       },
+       methods: {
+               update: function() {
+                       // TODO: scan local + imported games, if any new then add it
+               },
+       },
+});