<i18n>
{
  "en": {
    "darkTheme": "Dark Theme",
    "clipped": "Show drawer under the top bar",
    "mini": "Show icons in collapsed drawer"
  },
  "de": {
    "darkTheme": "Dark Theme",
    "clipped": "Zeige den Drawer unter der Hauptleiste",
    "mini": "Zeige die Symbole im eingeklappten Drawer"
  }
}
</i18n>

<template>
  <v-container>
    <v-layout>
      <v-flex md4 offset-md4 sm10 offset-sm1>
        <v-select
          class="lang-select"
          :items="langChoices"
          v-model="locale"
          solo
          offset-y
        ></v-select>
        <v-switch
          :label="$t('darkTheme')"
          v-model="dark"
          color="primary"
        ></v-switch>
        <v-switch
          :label="$t('clipped')"
          v-model="clipped"
          color="primary"
          class="hidden-md-and-down"
        ></v-switch>
        <v-switch
          :label="$t('mini')"
          v-model="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: {
    locale: {
      get () { return this.$store.state.locale },
      set (value) { this.$store.commit('setLocale', value) }
    },
    dark: {
      get () { return this.$store.state.dark },
      set (value) { this.$store.commit('setDark', value) }
    },
    clipped: {
      get () { return this.$store.state.clipped },
      set (value) { this.$store.commit('setClipped', value) }
    },
    mini: {
      get () { return this.$store.state.mini },
      set (value) { this.$store.commit('setMini', value) }
    }
  }
}
</script>

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

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

</style>
