<i18n>
{
  "en": {
    "darkTheme": "Dark Theme",
    "coloredTabs": "Colored tabpanels",
    "clipped": "Show menu under the top bar",
    "mini": "Show icons in collapsed menu"
  },
  "de": {
    "darkTheme": "Dunkles Design",
    "coloredTabs": "Tab-Panels einfärben",
    "clipped": "Menü an die Hauptleiste andocken",
    "mini": "Symbole im eingeklappten Menü anzeigen"
  }
}
</i18n>

<template>
  <v-container>
    <v-layout>
      <v-flex md4 offset-md4 sm10 offset-sm1>
        <v-select :value="store.locale" @input="save('locale', $event)" class="lang-select" :items="langChoices" solo offset-y></v-select>
        <v-switch :input-value="store.dark" @change="save('dark', $event)" :label="$t('darkTheme')" color="primary"></v-switch>
        <v-switch :input-value="store.coloredTabs" @change="save('coloredTabs', $event)" :label="$t('coloredTabs')" color="primary"></v-switch>
        <v-switch :input-value="store.clipped" @change="save('clipped', $event)" :label="$t('clipped')" color="primary" class="hidden-md-and-down"></v-switch>
        <v-switch :input-value="store.mini" @change="save('mini', $event)" :label="$t('mini')" color="primary" class="hidden-md-and-down"></v-switch>
      </v-flex>
    </v-layout>
  </v-container>
</template>

<script>
export default {
  name: 'SettingsPage',
  data () {
    return {
      langChoices: [ { text: 'Deutsch', value: 'de' }, { text: 'English', value: 'en' } ]
    }
  },
  computed: {
    store () { return this.$store.state.settings }
  },
  methods: {
    save (name, value) { this.$store.commit('saveSetting', { name: name, value: value }) }
  }
}
</script>

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

.lang-select {
  margin-top: 40px;
  margin-bottom: 40px;
}

</style>
