profile.vue 2.12 KB
Newer Older
NGPixel's avatar
NGPixel committed
1
<template lang='pug'>
2
  v-app(:dark='darkMode').profile
NGPixel's avatar
NGPixel committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
    nav-header
    v-navigation-drawer.pb-0(v-model='profileDrawerShown', app, fixed, clipped, left, permanent)
      v-list(dense)
        v-list-tile.pt-2(to='/profile')
          v-list-tile-action: v-icon account_circle
          v-list-tile-title Profile
        v-list-tile(to='/preferences')
          v-list-tile-action: v-icon settings
          v-list-tile-title Preferences
        v-divider.my-2
        v-subheader My Content
        v-list-tile(to='/pages')
          v-list-tile-action: v-icon pages
          v-list-tile-title Pages
        v-list-tile(to='/comments')
          v-list-tile-action: v-icon question_answer
          v-list-tile-title Comments

    v-content
      transition(name='profile-router')
        router-view

25
    nav-footer
26
    notify
27
    search-results
NGPixel's avatar
NGPixel committed
28 29 30 31 32
</template>

<script>
import VueRouter from 'vue-router'

33
/* global WIKI, siteConfig */
34

NGPixel's avatar
NGPixel committed
35 36 37 38 39 40 41 42 43 44 45 46
const router = new VueRouter({
  mode: 'history',
  base: '/p',
  routes: [
    { path: '/', redirect: '/profile' },
    { path: '/profile', component: () => import(/* webpackChunkName: "profile" */ './profile/profile.vue') },
    { path: '/preferences', component: () => import(/* webpackChunkName: "profile" */ './profile/preferences.vue') },
    { path: '/pages', component: () => import(/* webpackChunkName: "profile" */ './profile/pages.vue') },
    { path: '/comments', component: () => import(/* webpackChunkName: "profile" */ './profile/comments.vue') }
  ]
})

47 48 49 50 51 52 53 54 55
router.beforeEach((to, from, next) => {
  WIKI.$store.commit('loadingStart', 'profile')
  next()
})

router.afterEach((to, from) => {
  WIKI.$store.commit('loadingStop', 'profile')
})

NGPixel's avatar
NGPixel committed
56 57 58 59 60 61 62
export default {
  data() {
    return {
      profileDrawerShown: true
    }
  },
  computed: {
63
    darkMode() { return siteConfig.darkMode }
NGPixel's avatar
NGPixel committed
64
  },
65 66 67 68
  router,
  created() {
    this.$store.commit('page/SET_MODE', 'profile')
  }
NGPixel's avatar
NGPixel committed
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
}
</script>

<style lang='scss'>

.profile-router {
  &-enter-active, &-leave-active {
    transition: opacity .25s ease;
    opacity: 1;
  }
  &-enter-active {
    transition-delay: .25s;
  }
  &-enter, &-leave-to {
    opacity: 0;
  }
}

</style>