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