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