Fixes
[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, mygames, forum (ext. link)
12 // Right: usermenu, settings, flag
13 nav
14 label.drawer-toggle(for="drawerControl")
15 input#drawerControl.drawer(type="checkbox")
16 #menuBar(@click="hideDrawer")
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="/mygames")
24 | {{ st.tr["My games"] }}
25 a(href="https://forum.vchess.club")
26 | {{ st.tr["Forum"] }}
27 #rightMenu
28 .clickable(onClick="doClick('modalUser')")
29 | {{ st.user.id > 0 ? "Update" : "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 p.clickable(onClick="doClick('modalContact')")
40 | {{ st.tr["Contact"] }}
41 </template>
42
43 <script>
44 // See https://stackoverflow.com/a/35417159
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 export default {
51 components: {
52 ContactForm,
53 Language,
54 Settings,
55 UpsertUser,
56 },
57 data: function() {
58 return {
59 st: store.state,
60 };
61 },
62 computed: {
63 flagImage: function() {
64 return `/images/flags/${this.st.lang}.svg`;
65 },
66 },
67 // mounted: function() {
68 // feather.replace();
69 // },
70 methods: {
71 hideDrawer: function(e) {
72 if (e.target.innerText == "Forum")
73 return; //external link
74 e.preventDefault(); //TODO: why is this needed?
75 document.getElementsByClassName("drawer")[0].checked = false;
76 },
77 },
78 };
79 </script>
80
81 <style lang="sass">
82 #app
83 font-family: "Avenir", Helvetica, Arial, sans-serif
84 -webkit-font-smoothing: antialiased
85 -moz-osx-font-smoothing: grayscale
86
87 .container
88 @media screen and (max-width: 767px)
89 padding: 0
90
91 .row > div
92 padding: 0
93
94 .nopadding
95 padding: 0
96
97 header
98 width: 100%
99 display: flex
100 align-items: center
101 justify-content: center
102 margin: 0 auto
103 & > img
104 width: 30px
105 height: 30px
106
107 .clickable
108 cursor: pointer
109
110 nav
111 width: 100%
112 margin: 0
113 padding: 0
114 & > #menuBar
115 width: 100%
116 padding: 0
117 & > #leftMenu
118 padding: 0
119 width: 50%
120 display: inline-flex
121 align-items: center
122 justify-content: flex-start
123 & > a
124 display: inline-block
125 color: #2c3e50
126 &.router-link-exact-active
127 color: #42b983
128 & > #rightMenu
129 padding: 0
130 width: 50%
131 display: inline-flex
132 align-items: center
133 justify-content: flex-end
134 & > div
135 display: inline-block
136 &#flagContainer
137 display: inline-flex
138 & > img
139 padding: 0
140 width: 36px
141 height: 27px
142
143 [type="checkbox"].drawer+*
144 right: -767px
145
146 #menuBar
147 label.drawer-close
148 top: 50px
149
150 footer
151 border: 1px solid #ddd
152 //background-color: #000033
153 font-size: 1rem
154 width: 100%
155 padding-left: 0
156 padding-right: 0
157 display: inline-flex
158 align-items: center
159 justify-content: center
160 & > .menuitem
161 display: inline-block
162 margin: 0 10px 0 0
163 &:link
164 color: #2c3e50
165 &:visited, &:hover
166 color: #2c3e50
167 text-decoration: none
168 & > p
169 display: inline-block
170 margin: 0 0 0 10px
171 </style>