Some graphical improvements (first attempt)
[vchess.git] / client / src / views / Analyze.vue
CommitLineData
7f3484bd 1<template lang="pug">
7aa548e7
BA
2main
3 BaseGame(:game="game" :vr="vr" ref="basegame")
7f3484bd
BA
4</template>
5
6<script>
7import BaseGame from "@/components/BaseGame.vue";
7f3484bd 8import { store } from "@/store";
7f3484bd
BA
9import { ArrayFun } from "@/utils/array";
10
11export default {
652f40de 12 name: 'my-analyze',
7f3484bd
BA
13 components: {
14 BaseGame,
7f3484bd
BA
15 },
16 // gameRef: to find the game in (potentially remote) storage
17 data: function() {
18 return {
19 st: store.state,
20 gameRef: { //given in URL (rid = remote ID)
652f40de
BA
21 vname: "",
22 fen: ""
23 },
24 game: {
25 players:[{name:"Analyze"},{name:"Analyze"}],
26 mode: "analyze"
7f3484bd 27 },
7f3484bd 28 vr: null, //"variant rules" object initialized from FEN
652f40de 29 //people: [], //players + observers //TODO later: interactive analyze...
7f3484bd
BA
30 };
31 },
32 watch: {
33 "$route": function(to, from) {
652f40de
BA
34 this.gameRef.fen = to.query["fen"].replace(/_/g, " ");
35 this.gameRef.vname = to.params["vname"];
7f3484bd
BA
36 this.loadGame();
37 },
7f3484bd 38 },
7f3484bd 39 created: function() {
652f40de
BA
40 this.gameRef.fen = this.$route.query["fen"].replace(/_/g, " ");
41 this.gameRef.vname = this.$route.params["vname"];
42 this.loadGame();
7f3484bd
BA
43 },
44 methods: {
652f40de
BA
45 loadGame: async function() {
46 this.game.vname = this.gameRef.vname;
47 this.game.fen = this.gameRef.fen;
48 const vModule = await import("@/variants/" + this.game.vname + ".js");
49 window.V = vModule.VariantRules;
50 this.vr = new V(this.game.fen);
7f3484bd
BA
51 },
52 },
53};
54</script>
55
56<style lang="sass">
57// TODO
58</style>