wikijs-fork/client/components/profile.vue

100 lines
2.5 KiB
Vue
Raw Normal View History

2018-05-21 03:27:06 +00:00
<template lang='pug'>
v-app.profile
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
v-footer.py-2.justify-center(app, absolute, color='grey lighten-3', inset, height='auto')
.caption.grey--text.text--darken-1 Powered by Wiki.js
v-snackbar(
:color='notification.style'
bottom,
right,
multi-line,
v-model='notificationState'
)
.text-xs-left
v-icon.mr-3(dark) {{ notification.icon }}
span {{ notification.message }}
</template>
<script>
import VueRouter from 'vue-router'
import { mapState } from 'vuex'
2018-05-28 18:46:55 +00:00
/* global WIKI */
2018-05-21 03:27:06 +00:00
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') }
]
})
2018-05-28 18:46:55 +00:00
router.beforeEach((to, from, next) => {
WIKI.$store.commit('loadingStart', 'profile')
next()
})
router.afterEach((to, from) => {
WIKI.$store.commit('loadingStop', 'profile')
})
2018-05-21 03:27:06 +00:00
export default {
data() {
return {
profileDrawerShown: true
}
},
computed: {
...mapState(['notification']),
notificationState: {
get() { return this.notification.isActive },
set(newState) { this.$store.commit('updateNotificationState', newState) }
}
},
router
}
</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>