summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/SettingsModule.vue
blob: 7b3477fc8fcad4108228767f20a9ac962181d45f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<i18n>
{
  "en": {
    "ui": "User Interface",
    "darkTheme": "Dark Theme",
    "coloredTabs": "Colored tabpanels",
    "clipped": "Show menu under the top bar",
    "mini": "Show icons in collapsed menu",
    "language": "Language",
    "general": "General",
    "appearance": "Appearance",
    "noAnimations": "Disable animations"
  },
  "de": {
    "ui": "Benutzeroberfläche",
    "darkTheme": "Dunkles Design",
    "coloredTabs": "Tab-Panels einfärben",
    "clipped": "Menü an die Hauptleiste andocken",
    "mini": "Symbole im eingeklappten Menü anzeigen",
    "language": "Sprache",
    "general": "Allgemein",
    "appearance": "Aussehen",
    "noAnimations": "Animationen ausschalten"
  }
}
</i18n>

<template>
  <v-container :key="key">
    <v-layout>
      <v-flex xl10 offset-xl1 lg12>
      <v-card class="tabbar-card">
        <v-tabs :dark="tabsDark" :background-color="tabsColor" :slider-color="tabsSliderColor"
          v-model="tab"
          centered
          grow
          hide-slider
        >
          <v-tab>
            <v-icon class="tabbar-tabicon">desktop_windows</v-icon>{{ $t('ui') }}
          </v-tab>
        </v-tabs>
      </v-card>
      <v-tabs-items v-model="tab">
        <v-tab-item>
          <v-layout wrap>
            <v-flex xs12 md6>
              <div :class="{ 'mr-3': $vuetify.breakpoint.mdAndUp }">
                <v-subheader>{{ $t('general') }}</v-subheader>
                <v-card>
                  <v-card-text>
                    <v-select
                      style="max-width: 240px"
                      class="ma-3"
                      :value="store.locale"
                      @input="save('locale', $event)"
                      :items="langChoices"
                      :label="$t('language')"
                      prepend-icon="language"
                      :menu-props="{ offsetY: '' }"
                      hide-details
                    ></v-select>
                  </v-card-text>
                </v-card>
              </div>
            </v-flex>
            <v-flex xs12 md6>
              <div :class="{ 'ml-3': $vuetify.breakpoint.mdAndUp }">
                <v-subheader>{{ $t('appearance') }}</v-subheader>
                <v-card>
                  <v-card-text>
                    <v-switch
                      class="mx-3 my-3"
                      :input-value="store.dark"
                      @change="save('dark', $event)"
                      :label="$t('darkTheme')" color="primary"
                      prepend-icon="style"
                      hide-details
                    ></v-switch>
                    <v-switch
                      class="mx-3 my-4"
                      :input-value="store.coloredTabs"
                      @change="save('coloredTabs', $event)"
                      :label="$t('coloredTabs')"
                      color="primary"
                      prepend-icon="format_color_fill"
                      hide-details
                    ></v-switch>
                    <v-switch
                      class="mx-3 my-4 hidden-md-and-down"
                      :input-value="store.clipped"
                      @change="save('clipped', $event)"
                      :label="$t('clipped')"
                      color="primary"
                      prepend-icon="view_quilt"
                      hide-details
                    ></v-switch>
                    <v-switch
                      class="mx-3 my-4 hidden-md-and-down"
                      :input-value="store.mini"
                      @change="save('mini', $event)"
                      :label="$t('mini')"
                      color="primary"
                      prepend-icon="view_list"
                      hide-details
                    ></v-switch>
                    <v-switch
                      class="mx-3 my-3"
                      :input-value="store.noAnimations"
                      @change="save('noAnimations', $event)"
                      :label="$t('noAnimations')"
                      color="primary"
                      prepend-icon="visibility_off"
                      hide-details
                    ></v-switch>
                  </v-card-text>
                </v-card>
              </div>
            </v-flex>
          </v-layout>
        </v-tab-item>
        <v-tab-item>
          <v-subheader>{{ $t('general') }}</v-subheader>
          <v-card>
            <v-card-text>
              TODO
            </v-card-text>
          </v-card>
        </v-tab-item>
      </v-tabs-items>
      </v-flex>
    </v-layout>
  </v-container>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'SettingsPage',
  data () {
    return {
      langChoices: [ { text: 'Deutsch', value: 'de' }, { text: 'English', value: 'en' } ],
      tab: 0,
      key: true
    }
  },
  computed: {
    ...mapGetters(['tabsDark', 'tabsColor', 'tabsSliderColor']),
    store () { return this.$store.state.settings }
  },
  methods: {
    save (name, value) {
      if (name === 'noAnimations') setTimeout(() => { this.key = !this.key }, 0)
      this.$store.commit('saveSetting', { name: name, value: value })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
</style>