<commit_before><template lang="pug">
  v-layout(row, wrap, justify-space-between, align-center)
    v-flex(xs4, sm2, md1)
      span.label(v-show='hasFiles') {{ nbElems }} {{ label }}

    v-flex(xs4, sm2, md2)
      history

    v-flex(xs4, sm2, md5)
      v-switch.mt-0(
        v-show='hasFiles',
        v-model='inside',
        color='primary',
        :label="inside ? 'Inside' : 'Outside'"
        persistent-hint,
        hint='Play in KawAnime?'
      )

    v-flex.right-buttons(xs12, sm5, md4)
      v-btn(icon, large, @click='refresh', :loading='refreshing')
        v-icon(large) refresh
      v-btn(flat, @click='changeDir') Change Dir
      v-btn(v-show='hasFiles', @click='reset', :loading='resetting') Refresh info
</template>

<script>
import History from 'components/history/modal.vue'

export default {
  name: 'Local-Tools',

  components: { History },

  props: ['nbElems', 'resetting'],

  data: () => ({
    refreshing: false
  }),

  computed: {
    inside: {
      get () {
        return this.$store.state.localFiles.inside
      },
      set (bool) {
        this.$store.commit('localFiles/setInside', bool)
      }
    },
    hasFiles () {
      return this.nbElems !== 0
    },
    label () {
      return this.nbElems === 1
        ? 'episode'
        : 'episodes'
    }
  },

  methods: {
    async refresh () {
      this.refreshing = true

      await this.$store.dispatch('localFiles/update')

      this.refreshing = false
    },
    async changeDir () {
      const { data: { path } } = await this.$axios.get('openThis', {
        params: {
          type: 'dialog'
        }
      })

      if (!path) return

      this.$store.commit('localFiles/setDir', path)
      this.refresh()
    },
    reset () {
      this.$log('Refreshing local information.')
      this.$emit('reset')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .right-buttons
    display flex
    justify-content space-around
    align-items center

  .label
    font-size 14px
    letter-spacing 0.03em
    font-weight 500
</style>
<commit_msg>Improved localpage tools left display<commit_after><template lang="pug">
  v-layout(row, wrap, justify-space-between, align-center)
    v-flex.left(xs12, sm6, md5, lg4, xl3, d-flex, justify-space-around, align-center)
      span.label(v-show='hasFiles') {{ nbElems }} {{ label }}

      history

      v-switch.mt-0(
        v-show='hasFiles',
        v-model='inside',
        color='primary',
        :label="inside ? 'Inside' : 'Outside'"
        persistent-hint,
        hint='Play in KawAnime?'
      )

    v-flex.right-buttons(xs12, sm5, md4)
      v-btn(icon, large, @click='refresh', :loading='refreshing')
        v-icon(large) refresh
      v-btn(flat, @click='changeDir') Change Dir
      v-btn(v-show='hasFiles', @click='reset', :loading='resetting') Refresh info
</template>

<script>
import History from 'components/history/modal.vue'

export default {
  name: 'Local-Tools',

  components: { History },

  props: ['nbElems', 'resetting'],

  data: () => ({
    refreshing: false
  }),

  computed: {
    inside: {
      get () {
        return this.$store.state.localFiles.inside
      },
      set (bool) {
        this.$store.commit('localFiles/setInside', bool)
      }
    },
    hasFiles () {
      return this.nbElems !== 0
    },
    label () {
      return this.nbElems === 1
        ? 'episode'
        : 'episodes'
    }
  },

  methods: {
    async refresh () {
      this.refreshing = true

      await this.$store.dispatch('localFiles/update')

      this.refreshing = false
    },
    async changeDir () {
      const { data: { path } } = await this.$axios.get('openThis', {
        params: {
          type: 'dialog'
        }
      })

      if (!path) return

      this.$store.commit('localFiles/setDir', path)
      this.refresh()
    },
    reset () {
      this.$log('Refreshing local information.')
      this.$emit('reset')
    }
  }
}
</script>

<style lang="stylus" scoped>
  .right-buttons
    display flex
    justify-content space-around
    align-items center

  .left

    & > *
      display flex !important
      justify-content center

  .label
    font-size 14px
    letter-spacing 0.03em
    font-weight 500
</style>

{'fraction_non_alphanumeric': 0.1557396449704142, 'fraction_numerical': 0.010650887573964497, 'mean_word_length': 2.2407975460122698, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2956927', 'n_tokens_mistral': 1462, 'n_tokens_neox': 1396, 'n_words': 277}