Draft of a problems section + news system
[vchess.git] / client / src / App.vue
1 <template lang="pug">
2 #app
3 Language
4 Settings
5 ContactForm
6 UpsertUser
7 .container
8 .row
9 .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2
10 // Menu (top of page):
11 // Left: hall, variants, problems, mygames
12 // Right: usermenu, settings, flag
13 nav
14 label.drawer-toggle(for="drawerControl")
15 input#drawerControl.drawer(type="checkbox")
16 #menuBar(@click="hideDrawer($event)")
17 label.drawer-close(for="drawerControl")
18 #leftMenu
19 router-link(to="/")
20 | {{ st.tr["Hall"] }}
21 router-link(to="/variants")
22 | {{ st.tr["Variants"] }}
23 router-link(to="/problems")
24 | {{ st.tr["Problems"] }}
25 router-link(to="/mygames")
26 | {{ st.tr["My games"] }}
27 #rightMenu
28 .clickable(onClick="doClick('modalUser')")
29 | {{ st.user.id > 0 ? (st.user.name || "@nonymous") : "Login" }}
30 .clickable(onClick="doClick('modalSettings')")
31 | {{ st.tr["Settings"] }}
32 .clickable#flagContainer(onClick="doClick('modalLang')")
33 img(v-if="!!st.lang" :src="flagImage")
34 router-view
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"] }}
42 </template>
43
44 <script>
45 import ContactForm from "@/components/ContactForm.vue";
46 import Language from "@/components/Language.vue";
47 import Settings from "@/components/Settings.vue";
48 import UpsertUser from "@/components/UpsertUser.vue";
49 import { store } from "./store.js";
50 import { processModalClick } from "./utils/modalClick.js";
51 export default {
52 components: {
53 ContactForm,
54 Language,
55 Settings,
56 UpsertUser,
57 },
58 data: function() {
59 return {
60 st: store.state,
61 };
62 },
63 computed: {
64 flagImage: function() {
65 return `/images/flags/${this.st.lang}.svg`;
66 },
67 },
68 mounted: function() {
69 let dialogs = document.querySelectorAll("div[role='dialog']");
70 dialogs.forEach(d => {
71 d.addEventListener("click", processModalClick);
72 });
73 },
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 },
82 };
83 </script>
84
85 <style lang="sass">
86 html, *
87 font-family: "Open Sans", Arial, sans-serif
88 --a-link-color: black
89 --a-visited-color: black
90
91 body
92 padding: 0
93 min-width: 320px
94 --fore-color: #1c1e10 //#2c3e50
95 //--back-color: #f2f2f2
96 background-image: radial-gradient(white, #e6e6ff) //lavender)
97
98 #app
99 -webkit-font-smoothing: antialiased
100 -moz-osx-font-smoothing: grayscale
101
102 .container
103 // 45px is footer height
104 min-height: calc(100vh - 45px)
105 overflow: hidden
106 @media screen and (max-width: 767px)
107 padding: 0
108
109 .row > div
110 padding: 0
111
112 header
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
125 .text-center
126 text-align: center
127
128 .clearer
129 clear: both
130
131 nav
132 width: 100%
133 margin: 0
134 padding: 0
135 & > #menuBar
136 width: 100%
137 padding: 0
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
181
182 @media screen and (max-width: 767px)
183 nav
184 height: 32px
185 border: none
186 & > label.drawer-toggle
187 font-size: 1.2rem
188 position: absolute
189 top: -12px
190 //padding: -5px 0 0 10px
191
192 [type="checkbox"].drawer+*
193 right: -767px
194
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
202 footer
203 height: 45px
204 border: 1px solid #ddd
205 box-sizing: border-box
206 //background-color: #000033
207 font-size: 1rem
208 width: 100%
209 padding: 0
210 display: inline-flex
211 align-items: center
212 justify-content: center
213 & > .router-link-exact-active
214 color: #42b983 !important
215 text-decoration: none
216 & > .menuitem
217 display: inline-block
218 margin: 0 12px
219 &:link
220 color: #2c3e50
221 &:visited, &:hover
222 color: #2c3e50
223 text-decoration: none
224 & > p
225 display: inline-block
226 margin: 0 12px
227
228 @media screen and (max-width: 767px)
229 footer
230 border: none
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
241 div.board
242 float: left
243 height: 0
244 display: inline-block
245 position: relative
246
247 div.board8
248 width: 12.5%
249 padding-bottom: 12.5%
250
251 div.board10
252 width: 10%
253 padding-bottom: 10%
254
255 div.board11
256 width: 9.09%
257 padding-bottom: 9.1%
258
259 img.piece
260 width: 100%
261
262 img.piece, img.mark-square
263 max-width: 100%
264 height: auto
265 display: block
266
267 img.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%)
277 </style>