Saving current state
[vchess.git] / client / src / App.vue
1 <template lang="pug">
2 #app
3 Language
4 Settings
5 ContactForm
6 UpsertUser
7 .container
8 .row
9 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
10 // Menu (top of page):
11 // Left: hall, variants, mygames, problems
12 // Right: usermenu, settings, flag
13 nav
14 label.drawer-toggle(for="drawerControl")
15 input#drawerControl.drawer(type="checkbox")
16 #menuBar
17 label.drawer-close(for="drawerControl")
18 #leftMenu
19 router-link(to="/")
20 | {{ st.tr["Hall"] }}
21 router-link(to="/variants")
22 | {{ st.tr["Variants"] }}
23 router-link(to="/mygames")
24 | {{ st.tr["My games"] }}
25 router-link(to="/problems")
26 | {{ st.tr["Problems"] }}
27 #rightMenu
28 .clickable(onClick="doClick('modalUser')")
29 | {{ !st.user.id ? "Login" : "Update" }}
30 .clickable(onClick="doClick('modalSettings')")
31 | {{ st.tr["Settings"] }}
32 .clickable#flagContainer(onClick="doClick('modalLang')")
33 img(v-if="!!st.lang" :src="flagImage")
34 router-view
35 .row
36 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
37 footer
38 a(href="https://github.com/yagu0/vchess") {{ st.tr["Source code"] }}
39 p.clickable(onClick="doClick('modalContact')")
40 | {{ st.tr["Contact form"] }}
41 //my-game(:game-ref="gameRef" :mode="mode" :settings="settings" @game-over="archiveGame")
42 //// TODO: add only the necessary icons to mini-css custom build
43 //script(src="//unpkg.com/feather-icons")
44 </template>
45
46 <script>
47 // See https://stackoverflow.com/a/35417159
48 import ContactForm from "@/components/ContactForm.vue";
49 import Language from "@/components/Language.vue";
50 import Settings from "@/components/Settings.vue";
51 import UpsertUser from "@/components/UpsertUser.vue";
52 import { store } from "./store.js";
53 export default {
54 components: {
55 ContactForm,
56 Language,
57 Settings,
58 UpsertUser,
59 },
60 data: function() {
61 return {
62 st: store.state,
63 };
64 },
65 // // TODO: $route: ...
66 // gameRef: function() {
67 // this.loadGame();
68 // },
69 computed: {
70 flagImage: function() {
71 return `/images/flags/${this.st.lang}.svg`;
72 },
73 },
74 };
75 </script>
76
77 <style lang="sass">
78 #app
79 font-family: "Avenir", Helvetica, Arial, sans-serif
80 -webkit-font-smoothing: antialiased
81 -moz-osx-font-smoothing: grayscale
82
83 .container
84 @media screen and (max-width: 767px)
85 padding: 0
86
87 .row > div
88 padding: 0
89
90 .nopadding
91 padding: 0
92
93 header
94 width: 100%
95 display: flex
96 align-items: center
97 justify-content: center
98 margin: 0 auto
99 & > img
100 width: 30px
101 height: 30px
102
103 .clickable
104 cursor: pointer
105
106 nav
107 width: 100%
108 margin: 0
109 padding: 0
110 & > #menuBar
111 width: 100%
112 padding: 0
113 & > #leftMenu
114 padding: 0
115 width: 50%
116 display: inline-flex
117 align-items: center
118 justify-content: flex-start
119 & > a
120 display: inline-block
121 color: #2c3e50
122 &.router-link-exact-active
123 color: #42b983
124 & > #rightMenu
125 padding: 0
126 width: 50%
127 display: inline-flex
128 align-items: center
129 justify-content: flex-end
130 & > div
131 display: inline-block
132 &#flagContainer
133 display: inline-flex
134 & > img
135 padding: 0
136 width: 36px
137 height: 27px
138
139 // TODO: drawer, until 600px wide OK (seemingly)
140 // After, zone where left and right just go on top of another
141 // Then, on narrow screen put everything on one line
142 [type="checkbox"].drawer+*
143 right: -767px
144
145 footer
146 //background-color: #000033
147 font-size: 1rem
148 width: 100%
149 padding-left: 0
150 padding-right: 0
151 display: inline-flex
152 align-items: center
153 justify-content: center
154 & > a
155 display: inline-block
156 margin: 0 10px 0 0
157 &:link
158 color: #2c3e50
159 &:hover
160 text-decoration: none
161 & > p
162 display: inline-block
163 margin: 0 0 0 10px
164 </style>