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