<commit_before><template>
  <q-layout view="lHh Lpr lFf">
    <q-toolbar :class="'bg-' + conf.styles.headerBg">
      <router-link to="/">
        <q-avatar rounded>
          <img src="statics/app-logo-128x128.png">
        </q-avatar>
      </router-link>
      <q-toolbar-title :class="'text-' + conf.styles.headerText">
        {{ group('top') && group('top').data().name }}
      </q-toolbar-title>
    </q-toolbar>
    <q-page-container>
      <router-view />
    </q-page-container>
    <div class="row">
      <div :class="'col q-pa-md bg-' + conf.styles.footerBg + ' text-' + conf.styles.footerText">
        Powerd by <a href="https://github.com/MichinobuMaeda/tamuro" target="_blank">Tamuro</a>
      </div>
    </div>
    <q-page-sticky :position="menuPosition" :offset="[8, 8]">
      <q-fab
        icon="menu" :color="conf.styles.menuBg" :text-color="conf.styles.menuText"
        v-touch-swipe.mouse="handleSwipe"
        :direction="(menuPosition === 'bottom-right' || menuPosition === 'bottom-left') ? 'up' : 'down'"
        @show="showToolChip"
        @hide="hideToolChip"
      >
        <q-fab-action
          v-if="isValidAccount"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="home"
          to="/"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['home']">
            {{ $t('home') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-else
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="exit_to_app"
          to="/signin"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['signin']">
            {{ $t('signin') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="policy"
          to="/policy"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['policy']">
            {{ $t('privacyPolicy') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-if="isValidAccount"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="settings_applications"
          to="/preferences"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['preferences']">
            {{ $t('preferences') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-if="isAdmin"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="cloud_circle"
          to="/service"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['service']">
            Serivce
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-if="isAdmin"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="memory"
          to="/raw"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['raw']">
            Raw data
          </q-tooltip>
        </q-fab-action>
      </q-fab>
    </q-page-sticky>
  </q-layout>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'MyLayout',
  data () {
    return {
      menuPosition: 'bottom-right',
      toolChip: {
        'home': false,
        'signin': false,
        'policy': false,
        'preferences': false,
        'service': false,
        'raw': false
      },
      toolChipTimer: null
    }
  },
  methods: {
    showToolChip () {
      if (this.$store.state.isMobile) {
        this.toolChipTimer = setTimeout(() => { Object.keys(this.toolChip).forEach(key => { this.toolChip[key] = true }) }, 1500)
      }
    },
    hideToolChip () {
      if (this.$store.state.isMobile) {
        if (this.toolChipTimer) {
          clearTimeout(this.toolChipTimer)
          this.toolChipTimer = null
        }
        Object.keys(this.toolChip).forEach(key => { this.toolChip[key] = false })
      }
    },
    handleSwipe ({ evt, ...info }) {
      this.toolChip = false
      if (this.menuPosition === 'bottom-right') {
        if (info.direction === 'left') {
          this.menuPosition = 'bottom-left'
        } else if (info.direction === 'up') {
          this.menuPosition = 'top-right'
        }
      } else if (this.menuPosition === 'top-right') {
        if (info.direction === 'left') {
          this.menuPosition = 'top-left'
        } else if (info.direction === 'down') {
          this.menuPosition = 'bottom-right'
        }
      } else if (this.menuPosition === 'top-left') {
        if (info.direction === 'right') {
          this.menuPosition = 'top-right'
        } else if (info.direction === 'down') {
          this.menuPosition = 'bottom-left'
        }
      } else if (this.menuPosition === 'bottom-left') {
        if (info.direction === 'right') {
          this.menuPosition = 'bottom-right'
        } else if (info.direction === 'up') {
          this.menuPosition = 'top-left'
        }
      }
    }
  },
  computed: {
    ...mapGetters([
      'conf',
      'group',
      'isValidAccount',
      'isAdmin',
      'isManager'
    ])
  }
}
</script><commit_msg>add to save menu position to account.<commit_after><template>
  <q-layout view="lHh Lpr lFf">
    <q-toolbar :class="'bg-' + conf.styles.headerBg">
      <router-link to="/">
        <q-avatar rounded>
          <img src="statics/app-logo-128x128.png">
        </q-avatar>
      </router-link>
      <q-toolbar-title :class="'text-' + conf.styles.headerText">
        {{ group('top') && group('top').data().name }}
      </q-toolbar-title>
    </q-toolbar>
    <q-page-container>
      <router-view />
    </q-page-container>
    <div class="row">
      <div :class="'col q-pa-md bg-' + conf.styles.footerBg + ' text-' + conf.styles.footerText">
        Powerd by <a href="https://github.com/MichinobuMaeda/tamuro" target="_blank">Tamuro</a>
      </div>
    </div>
    <q-page-sticky :position="menuPosition" :offset="[8, 8]">
      <q-fab
        icon="menu" :color="conf.styles.menuBg" :text-color="conf.styles.menuText"
        v-touch-swipe.mouse="handleSwipe"
        :direction="(menuPosition === 'bottom-right' || menuPosition === 'bottom-left') ? 'up' : 'down'"
        @show="showToolChip"
        @hide="hideToolChip"
      >
        <q-fab-action
          v-if="isValidAccount"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="home"
          to="/"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['home']">
            {{ $t('home') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-else
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="exit_to_app"
          to="/signin"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['signin']">
            {{ $t('signin') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="policy"
          to="/policy"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['policy']">
            {{ $t('privacyPolicy') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-if="isValidAccount"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="settings_applications"
          to="/preferences"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['preferences']">
            {{ $t('preferences') }}
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-if="isAdmin"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="cloud_circle"
          to="/service"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['service']">
            Serivce
          </q-tooltip>
        </q-fab-action>
        <q-fab-action
          v-if="isAdmin"
          :color="conf.styles.menuItemBg" :text-color="conf.styles.menuItemText" icon="memory"
          to="/raw"
        >
          <q-tooltip anchor="center left" self="center right" v-model="toolChip['raw']">
            Raw data
          </q-tooltip>
        </q-fab-action>
      </q-fab>
    </q-page-sticky>
  </q-layout>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  name: 'MyLayout',
  data () {
    return {
      menuPosition: (this.$store.state.me && this.$store.state.me.data().menuPosition) || 'bottom-right',
      toolChip: {
        'home': false,
        'signin': false,
        'policy': false,
        'preferences': false,
        'service': false,
        'raw': false
      },
      toolChipTimer: null
    }
  },
  methods: {
    showToolChip () {
      if (this.$store.state.isMobile) {
        this.toolChipTimer = setTimeout(() => { Object.keys(this.toolChip).forEach(key => { this.toolChip[key] = true }) }, 1500)
      }
    },
    hideToolChip () {
      if (this.$store.state.isMobile) {
        if (this.toolChipTimer) {
          clearTimeout(this.toolChipTimer)
          this.toolChipTimer = null
        }
        Object.keys(this.toolChip).forEach(key => { this.toolChip[key] = false })
      }
    },
    async handleSwipe ({ evt, ...info }) {
      Object.keys(this.toolChip).forEach(key => { this.toolChip[key] = false })
      if (this.menuPosition === 'bottom-right') {
        if (info.direction === 'left') {
          this.menuPosition = 'bottom-left'
        } else if (info.direction === 'up') {
          this.menuPosition = 'top-right'
        }
      } else if (this.menuPosition === 'top-right') {
        if (info.direction === 'left') {
          this.menuPosition = 'top-left'
        } else if (info.direction === 'down') {
          this.menuPosition = 'bottom-right'
        }
      } else if (this.menuPosition === 'top-left') {
        if (info.direction === 'right') {
          this.menuPosition = 'top-right'
        } else if (info.direction === 'down') {
          this.menuPosition = 'bottom-left'
        }
      } else if (this.menuPosition === 'bottom-left') {
        if (info.direction === 'right') {
          this.menuPosition = 'bottom-right'
        } else if (info.direction === 'up') {
          this.menuPosition = 'top-left'
        }
      }
      await this.$store.state.db.collection('accounts').doc(this.$store.state.me.id).update({
        menuPosition: this.menuPosition
      })
    }
  },
  computed: {
    ...mapGetters([
      'conf',
      'group',
      'isValidAccount',
      'isAdmin',
      'isManager'
    ])
  }
}
</script>
{'fraction_non_alphanumeric': 0.17722452743199632, 'fraction_numerical': 0.0022130013831258644, 'mean_word_length': 2.0449185850645706, 'pattern_counts': {'":': 0, '<': 107, '<?xml version=': 0, '>': 114, 'https://': 2, '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': '323872', 'n_tokens_mistral': 3553, 'n_tokens_neox': 3470, 'n_words': 561}