socket rooms correspnding to pages. TODO: Hall+Game (split live and corr? shared...
[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, problems
12 // Right: usermenu, settings, flag
13 nav
14 label.drawer-toggle(for="drawerControl")
15 input#drawerControl.drawer(type="checkbox")
16 #menuBar
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 router-link(to="/problems")
26 | {{ st.tr["Problems"] }}
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 // TODO: add only the necessary icons to mini-css custom build
42 //script(src="//unpkg.com/feather-icons")
43 </template>
44
45 <script>
46 // See https://stackoverflow.com/a/35417159
47 import ContactForm from "@/components/ContactForm.vue";
48 import Language from "@/components/Language.vue";
49 import Settings from "@/components/Settings.vue";
50 import UpsertUser from "@/components/UpsertUser.vue";
51 import { store } from "./store.js";
52 export default {
53 components: {
54 ContactForm,
55 Language,
56 Settings,
57 UpsertUser,
58 },
59 data: function() {
60 return {
61 st: store.state,
62 };
63 },
64 computed: {
65 flagImage: function() {
66 return `/images/flags/${this.st.lang}.svg`;
67 },
68 },
69 };
70 </script>
71
72 <style lang="sass">
73 #app
74 font-family: "Avenir", Helvetica, Arial, sans-serif
75 -webkit-font-smoothing: antialiased
76 -moz-osx-font-smoothing: grayscale
77
78 .container
79 @media screen and (max-width: 767px)
80 padding: 0
81
82 .row > div
83 padding: 0
84
85 .nopadding
86 padding: 0
87
88 header
89 width: 100%
90 display: flex
91 align-items: center
92 justify-content: center
93 margin: 0 auto
94 & > img
95 width: 30px
96 height: 30px
97
98 .clickable
99 cursor: pointer
100
101 nav
102 width: 100%
103 margin: 0
104 padding: 0
105 & > #menuBar
106 width: 100%
107 padding: 0
108 & > #leftMenu
109 padding: 0
110 width: 50%
111 display: inline-flex
112 align-items: center
113 justify-content: flex-start
114 & > a
115 display: inline-block
116 color: #2c3e50
117 &.router-link-exact-active
118 color: #42b983
119 & > #rightMenu
120 padding: 0
121 width: 50%
122 display: inline-flex
123 align-items: center
124 justify-content: flex-end
125 & > div
126 display: inline-block
127 &#flagContainer
128 display: inline-flex
129 & > img
130 padding: 0
131 width: 36px
132 height: 27px
133
134 // TODO: drawer, until 600px wide OK (seemingly)
135 // After, zone where left and right just go on top of another
136 // Then, on narrow screen put everything on one line
137 [type="checkbox"].drawer+*
138 right: -767px
139
140 footer
141 //background-color: #000033
142 font-size: 1rem
143 width: 100%
144 padding-left: 0
145 padding-right: 0
146 display: inline-flex
147 align-items: center
148 justify-content: center
149 & > .menuitem
150 display: inline-block
151 margin: 0 10px 0 0
152 &:link
153 color: #2c3e50
154 &:hover
155 text-decoration: none
156 & > p
157 display: inline-block
158 margin: 0 0 0 10px
159 </style>