Customisation of default profile tab, clean up settings (#156)

Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/156
This commit is contained in:
floatingghost 2022-09-05 17:02:16 +00:00
parent c301daa276
commit ae1b6ad887
7 changed files with 54 additions and 47 deletions

View file

@ -33,22 +33,21 @@ const FriendList = withLoadMore({
additionalPropNames: ['userId']
})(List)
const defaultTabKey = 'statuses'
const UserProfile = {
data () {
return {
error: false,
userId: null,
tab: defaultTabKey,
tab: 'statuses',
footerRef: null,
note: null,
noteLoading: false
}
},
created () {
const defaultTabKey = this.defaultTabKey
const routeParams = this.$route.params
const hash = get(this.$route, 'hash', defaultTabKey).replace(/^#/, '')
const hash = (get(this.$route, 'hash') || defaultTabKey).replace(/^#/, '')
if (hash !== '') this.tab = hash
this.load(routeParams.name || routeParams.id)
},
@ -86,6 +85,9 @@ const UserProfile = {
},
currentUser () {
return this.$store.state.users.currentUser
},
defaultTabKey () {
return this.$store.getters.mergedConfig.userProfileDefaultTab || 'statuses'
}
},
methods: {
@ -191,7 +193,7 @@ const UserProfile = {
},
'$route.hash': function (newVal) {
const oldTab = this.tab
this.tab = newVal.replace(/^#/, '') || defaultTabKey
this.tab = newVal.replace(/^#/, '') || this.defaultTabKey
this.onRouteChange(oldTab, this.tab)
}
},