Translations
[vchess.git] / client / src / App.vue
1 <template lang="pug">
2 #app
3 Settings
4 ContactForm
5 UpsertUser
6 .container
7 .row
8 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
9 // Menu (top of page):
10 // Left: hall, variants, problems, mygames
11 // Right: usermenu, settings
12 nav
13 label.drawer-toggle(for="drawerControl")
14 input#drawerControl.drawer(type="checkbox")
15 #menuBar(@click="hideDrawer($event)")
16 label.drawer-close(for="drawerControl")
17 #leftMenu
18 router-link(to="/")
19 | {{ st.tr["Hall"] }}
20 router-link(to="/mygames")
21 | {{ st.tr["My games"] }}
22 router-link(to="/variants")
23 | {{ st.tr["Variants"] }}
24 router-link(to="/problems")
25 | {{ st.tr["Problems"] }}
26 #rightMenu
27 .clickable(onClick="window.doClick('modalUser')")
28 | {{ st.user.id > 0 ? (st.user.name || "@nonymous") : "Login" }}
29 #divSettings.clickable(onClick="window.doClick('modalSettings')")
30 span {{ st.tr["Settings"] }}
31 img(src="/images/icons/settings.svg")
32 router-view
33 .row
34 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
35 footer
36 router-link.menuitem(to="/about") {{ st.tr["About"] }}
37 router-link.menuitem(to="/news") {{ st.tr["News"] }}
38 p.clickable(onClick="window.doClick('modalContact')")
39 | {{ st.tr["Contact"] }}
40 </template>
41
42 <script>
43 import ContactForm from "@/components/ContactForm.vue";
44 import Settings from "@/components/Settings.vue";
45 import UpsertUser from "@/components/UpsertUser.vue";
46 import { store } from "./store.js";
47 import { processModalClick } from "./utils/modalClick.js";
48 export default {
49 components: {
50 ContactForm,
51 Settings,
52 UpsertUser
53 },
54 data: function() {
55 return {
56 st: store.state
57 };
58 },
59 mounted: function() {
60 let dialogs = document.querySelectorAll("div[role='dialog']");
61 dialogs.forEach(d => {
62 d.addEventListener("click", processModalClick);
63 });
64 },
65 methods: {
66 hideDrawer: function(e) {
67 if (e.target.innerText == "Forum") return; //external link
68 e.preventDefault(); //TODO: why is this needed?
69 document.getElementsByClassName("drawer")[0].checked = false;
70 }
71 }
72 };
73 </script>
74
75 <style lang="sass">
76 html, *
77 font-family: "Open Sans", Arial, sans-serif
78 --a-link-color: black
79 --a-visited-color: black
80
81 body
82 padding: 0
83 min-width: 320px
84 --fore-color: #1c1e10 //#2c3e50
85 //--back-color: #f2f2f2
86 background-image: radial-gradient(white, #e6e6ff) //lavender)
87
88 #app
89 -webkit-font-smoothing: antialiased
90 -moz-osx-font-smoothing: grayscale
91
92 .container
93 // 45px is footer height
94 min-height: calc(100vh - 45px)
95 overflow: hidden
96 padding: 0
97 margin: 0
98
99 .row > div
100 padding: 0
101
102 header
103 width: 100%
104 display: flex
105 align-items: center
106 justify-content: center
107 margin: 0 auto
108
109 .clickable
110 cursor: pointer
111
112 .text-center
113 text-align: center
114
115 .clearer
116 clear: both
117
118 .button-group
119 margin: 0
120
121 input[type="checkbox"]:focus
122 outline: 0
123
124 input[type=checkbox]:checked:before
125 top: -5px;
126 height: 18px
127
128 table
129 display: block
130 padding: 0
131 tr > td
132 cursor: pointer
133 th, td
134 padding: 5px
135
136 #divSettings
137 padding: 0 10px 0 0
138 height: 100%
139 & > span
140 vertical-align: middle
141 & > img
142 padding: 0
143 height: 24px
144 vertical-align: middle
145
146 @media screen and (max-width: 767px)
147 table
148 tr > th, td
149 font-size: 14px
150
151 nav
152 width: 100%
153 margin: 0
154 padding: 0
155 & > #menuBar
156 width: 100%
157 padding: 0
158 @media screen and (min-width: 768px)
159 & > #leftMenu
160 padding: 0
161 width: 50%
162 display: inline-flex
163 align-items: center
164 justify-content: flex-start
165 & > a
166 display: inline-block
167 color: #2c3e50
168 &.router-link-exact-active
169 color: #42b983
170 & > #rightMenu
171 padding: 0
172 width: 50%
173 display: inline-flex
174 align-items: center
175 justify-content: flex-end
176 & > div
177 display: inline-block
178 @media screen and (max-width: 767px)
179 & > #leftMenu
180 margin-top: 42px
181 padding-bottom: 5px
182 & > a
183 color: #2c3e50
184 &.router-link-exact-active
185 color: #42b983
186 & > #rightMenu
187 padding-top: 5px
188 border-top: 1px solid darkgrey
189
190 @media screen and (max-width: 767px)
191 nav
192 height: 42px
193 border: none
194 & > label.drawer-toggle
195 cursor: pointer
196 font-size: 32px
197 position: absolute
198 top: 5px
199 line-height: 1em
200 padding: 0
201 & > #menuBar
202 z-index: 5000 //to hide currently selected piece if any
203
204 [type="checkbox"].drawer+*
205 right: -767px
206
207 [type=checkbox].drawer+* .drawer-close
208 top: 0
209 left: 10px
210 padding: 0
211 width: 42px
212 height: 42px
213
214 [type=checkbox].drawer+* .drawer-close:before
215 font-size: 50px
216 line-height: 1em
217
218 @media screen and (max-width: 767px)
219 .button-group
220 flex-direction: row
221 button:not(:first-child)
222 border-left: 1px solid var(--button-group-border-color)
223 border-top: 0
224
225 footer
226 height: 45px
227 border: 1px solid #ddd
228 box-sizing: border-box
229 //background-color: #000033
230 font-size: 1rem
231 width: 100%
232 padding: 0
233 display: inline-flex
234 align-items: center
235 justify-content: center
236 & > .router-link-exact-active
237 color: #42b983 !important
238 text-decoration: none
239 & > .menuitem
240 display: inline-block
241 margin: 0 12px
242 &:link
243 color: #2c3e50
244 &:visited, &:hover
245 color: #2c3e50
246 text-decoration: none
247 & > p
248 display: inline-block
249 margin: 0 12px
250
251 @media screen and (max-width: 767px)
252 footer
253 border: none
254
255 // Styles for diagrams and board (partial).
256 // TODO: where to put that ?
257
258 .light-square-diag
259 background-color: #e5e5ca
260
261 .dark-square-diag
262 background-color: #6f8f57
263
264 div.board
265 float: left
266 height: 0
267 display: inline-block
268 position: relative
269
270 div.board8
271 width: 12.5%
272 padding-bottom: 12.5%
273
274 div.board10
275 width: 10%
276 padding-bottom: 10%
277
278 div.board11
279 width: 9.09%
280 padding-bottom: 9.1%
281
282 img.piece
283 width: 100%
284
285 img.piece, img.mark-square
286 max-width: 100%
287 height: auto
288 display: block
289
290 img.mark-square
291 opacity: 0.6
292 width: 76%
293 position: absolute
294 top: 12%
295 left: 12%
296 opacity: .7
297
298 .in-shadow
299 filter: brightness(50%)
300 </style>