Do not send new-move message in analyze mode
[vchess.git] / client / src / App.vue
CommitLineData
625022fd 1<template lang="pug">
98db2082 2#app
c66a829b 3 Settings
98db2082 4 ContactForm
c66a829b 5 UpsertUser
98db2082 6 .container
98db2082 7 .row
85e5b5c1
BA
8 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
9 // Menu (top of page):
89021f18 10 // Left: hall, variants, problems, mygames
5b3dc10e 11 // Right: usermenu, settings
85e5b5c1
BA
12 nav
13 label.drawer-toggle(for="drawerControl")
14 input#drawerControl.drawer(type="checkbox")
9a3049f3 15 #menuBar(@click="hideDrawer($event)")
85e5b5c1
BA
16 label.drawer-close(for="drawerControl")
17 #leftMenu
18 router-link(to="/")
cf2343ce 19 | {{ st.tr["Hall"] }}
ae2c49bb
BA
20 router-link(to="/mygames")
21 | {{ st.tr["My games"] }}
85e5b5c1
BA
22 router-link(to="/variants")
23 | {{ st.tr["Variants"] }}
89021f18
BA
24 router-link(to="/problems")
25 | {{ st.tr["Problems"] }}
85e5b5c1 26 #rightMenu
2c5d7b20 27 .clickable(onClick="window.doClick('modalUser')") {{ userName }}
5b3dc10e
BA
28 #divSettings.clickable(onClick="window.doClick('modalSettings')")
29 span {{ st.tr["Settings"] }}
b9a5fe01 30 img(src="/images/icons/settings.svg")
fb54f098 31 router-view
604b951e
BA
32 .row
33 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
34 footer
35 router-link.menuitem(to="/about") {{ st.tr["About"] }}
d9a7a1e4
BA
36 router-link.menuitem#newsMenu(to="/news") {{ st.tr["News"] }}
37 a.menuitem(href="https://discord.gg/a9ZFKBe")
38 span Discord
39 img(src="/images/icons/discord.svg")
b0a0468a
BA
40 a.menuitem(href="https://github.com/yagu0/vchess")
41 span {{ st.tr["Code"] }}
42 img(src="/images/icons/github.svg")
910d631b 43 p.clickable(onClick="window.doClick('modalContact')")
604b951e 44 | {{ st.tr["Contact"] }}
625022fd
BA
45</template>
46
98db2082 47<script>
98db2082 48import ContactForm from "@/components/ContactForm.vue";
98db2082 49import Settings from "@/components/Settings.vue";
c66a829b 50import UpsertUser from "@/components/UpsertUser.vue";
42a92848 51import { store } from "@/store.js";
d9a7a1e4 52import { ajax } from "@/utils/ajax.js";
98db2082 53export default {
98db2082
BA
54 components: {
55 ContactForm,
98db2082 56 Settings,
6808d7a1 57 UpsertUser
c66a829b
BA
58 },
59 data: function() {
d9a7a1e4
BA
60 return { st: store.state };
61 },
62 mounted: function() {
63 ajax(
64 "/newsts",
65 "GET",
66 {
67 success: (res) => {
68 if (this.st.user.newsRead < res.timestamp)
69 document.getElementById("newsMenu").classList.add("somenews");
70 }
71 }
72 );
98db2082 73 },
2c5d7b20
BA
74 computed: {
75 userName: function() {
76 return (
77 this.st.user.id > 0
78 ? (this.st.user.name || "@nonymous")
79 : "Login"
80 );
81 }
82 },
4f887105
BA
83 methods: {
84 hideDrawer: function(e) {
4f887105
BA
85 e.preventDefault(); //TODO: why is this needed?
86 document.getElementsByClassName("drawer")[0].checked = false;
6808d7a1
BA
87 }
88 }
98db2082
BA
89};
90</script>
91
625022fd 92<style lang="sass">
bc093771
BA
93html, *
94 font-family: "Open Sans", Arial, sans-serif
b0a0468a
BA
95 --a-link-color: darkred
96 --a-visited-color: darkred
dcd68c41
BA
97
98body
99 padding: 0
100 min-width: 320px
83c6c2c9
BA
101 --fore-color: #1c1e10 //#2c3e50
102 //--back-color: #f2f2f2
103 background-image: radial-gradient(white, #e6e6ff) //lavender)
dcd68c41 104
625022fd 105#app
625022fd
BA
106 -webkit-font-smoothing: antialiased
107 -moz-osx-font-smoothing: grayscale
625022fd 108
85e5b5c1 109.container
604b951e
BA
110 // 45px is footer height
111 min-height: calc(100vh - 45px)
dcd68c41 112 overflow: hidden
bd76b456
BA
113 padding: 0
114 margin: 0
85e5b5c1 115
fb54f098
BA
116.row > div
117 padding: 0
118
07052665
BA
119a
120 text-decoration: underline
121
85e5b5c1
BA
122header
123 width: 100%
124 display: flex
125 align-items: center
126 justify-content: center
127 margin: 0 auto
85e5b5c1
BA
128
129.clickable
130 cursor: pointer
131
dcd68c41
BA
132.text-center
133 text-align: center
134
a17ae317
BA
135.bold
136 font-weight: bold
137
dcd68c41
BA
138.clearer
139 clear: both
140
bd76b456
BA
141.button-group
142 margin: 0
143
144input[type="checkbox"]:focus
145 outline: 0
146
147input[type=checkbox]:checked:before
148 top: -5px;
149 height: 18px
150
151table
152 display: block
153 padding: 0
154 tr > td
155 cursor: pointer
156 th, td
157 padding: 5px
158
5b3dc10e
BA
159#divSettings
160 padding: 0 10px 0 0
161 height: 100%
162 & > span
8423b682 163 padding-right: 5px
5b3dc10e
BA
164 vertical-align: middle
165 & > img
166 padding: 0
d81c26d1 167 height: 1.2em
5b3dc10e
BA
168 vertical-align: middle
169
bd76b456
BA
170@media screen and (max-width: 767px)
171 table
172 tr > th, td
173 font-size: 14px
174
85e5b5c1
BA
175nav
176 width: 100%
fb54f098 177 margin: 0
85e5b5c1
BA
178 padding: 0
179 & > #menuBar
180 width: 100%
181 padding: 0
8c5f5390
BA
182 @media screen and (min-width: 768px)
183 & > #leftMenu
184 padding: 0
185 width: 50%
186 display: inline-flex
187 align-items: center
188 justify-content: flex-start
189 & > a
190 display: inline-block
07052665 191 text-decoration: none
8c5f5390
BA
192 color: #2c3e50
193 &.router-link-exact-active
194 color: #42b983
195 & > #rightMenu
196 padding: 0
197 width: 50%
198 display: inline-flex
199 align-items: center
200 justify-content: flex-end
201 & > div
202 display: inline-block
8c5f5390
BA
203 @media screen and (max-width: 767px)
204 & > #leftMenu
bd76b456 205 margin-top: 42px
8c5f5390 206 padding-bottom: 5px
8c5f5390
BA
207 & > #rightMenu
208 padding-top: 5px
209 border-top: 1px solid darkgrey
85e5b5c1 210
430a2038
BA
211@media screen and (max-width: 767px)
212 nav
bd76b456 213 height: 42px
430a2038 214 border: none
57c8c2a6 215 & > label.drawer-toggle
bd76b456 216 cursor: pointer
89021f18 217 position: absolute
57eb158f
BA
218 top: 0
219 left: 5px
220 line-height: 42px
221 height: 42px
b5aa30b5 222 padding: 0
57eb158f
BA
223 & > label.drawer-toggle:before
224 font-size: 42px
c6913dbc
BA
225 & > #menuBar
226 z-index: 5000 //to hide currently selected piece if any
430a2038 227
85e5b5c1
BA
228[type="checkbox"].drawer+*
229 right: -767px
230
bd76b456 231[type=checkbox].drawer+* .drawer-close
b5aa30b5 232 top: 0
57eb158f 233 left: 5px
b5aa30b5 234 padding: 0
57eb158f
BA
235 height: 50px
236 width: 50px
237 line-height: 50px
bd76b456
BA
238
239[type=checkbox].drawer+* .drawer-close:before
240 font-size: 50px
241
dcd68c41
BA
242@media screen and (max-width: 767px)
243 .button-group
244 flex-direction: row
245 button:not(:first-child)
246 border-left: 1px solid var(--button-group-border-color)
247 border-top: 0
248
85e5b5c1 249footer
604b951e 250 height: 45px
5701c228 251 border: 1px solid #ddd
604b951e 252 box-sizing: border-box
85e5b5c1
BA
253 //background-color: #000033
254 font-size: 1rem
255 width: 100%
604b951e 256 padding: 0
85e5b5c1
BA
257 display: inline-flex
258 align-items: center
259 justify-content: center
050ae3b5
BA
260 & > .router-link-exact-active
261 color: #42b983 !important
262 text-decoration: none
92a523d1 263 & > .menuitem
604b951e 264 margin: 0 12px
b0a0468a
BA
265 display: inline-flex;
266 align-self: center;
85e5b5c1
BA
267 &:link
268 color: #2c3e50
07052665 269 text-decoration: none
5701c228
BA
270 &:visited, &:hover
271 color: #2c3e50
85e5b5c1 272 text-decoration: none
b0a0468a 273 & > img
afd71778 274 height: 1.2em
b0a0468a
BA
275 display: inline-block
276 margin-left: 5px
85e5b5c1
BA
277 & > p
278 display: inline-block
604b951e 279 margin: 0 12px
430a2038
BA
280
281@media screen and (max-width: 767px)
282 footer
283 border: none
89021f18 284
d9a7a1e4 285@media screen and (max-width: 420px)
4ec83d37
BA
286 .container
287 min-height: calc(100vh - 55px)
d9a7a1e4 288 footer
f14572c4 289 height: 55px
d9a7a1e4 290 display: block
f14572c4 291 padding: 5px 0
d9a7a1e4
BA
292
293.menuitem.somenews
294 color: red
295 &:link, &:visited, &:hover
296 color: red
297
89021f18
BA
298// Styles for diagrams and board (partial).
299// TODO: where to put that ?
300
301.light-square-diag
302 background-color: #e5e5ca
303
304.dark-square-diag
305 background-color: #6f8f57
306
307div.board
6e47d367 308 user-select: none
89021f18
BA
309 float: left
310 height: 0
311 display: inline-block
312 position: relative
313
1a3cfdc0
BA
314div.board5
315 width: 20%
316 padding-bottom: 20%
317
89021f18
BA
318div.board8
319 width: 12.5%
320 padding-bottom: 12.5%
321
6f2f9437
BA
322div.board9
323 width: 11.1%
324 padding-bottom: 11.1%
325
89021f18
BA
326div.board10
327 width: 10%
328 padding-bottom: 10%
329
330div.board11
331 width: 9.09%
472c0c4f
BA
332 padding-bottom: 9.09%
333
334div.board12
335 width: 8.33%
336 padding-bottom: 8.33%
89021f18
BA
337
338img.piece
339 width: 100%
340
49dad261 341img.piece, img.mark-square, img.circle-square
89021f18
BA
342 max-width: 100%
343 height: auto
344 display: block
345
346img.mark-square
49dad261 347 opacity: .7
89021f18
BA
348 width: 76%
349 position: absolute
350 top: 12%
351 left: 12%
49dad261
BA
352
353img.circle-square
354 opacity: 0.7
355 width: 100%
356 position: absolute
357 top: 0
358 left: 0
89021f18
BA
359
360.in-shadow
361 filter: brightness(50%)
625022fd 362</style>