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