2020-07-02 15:03:02 +00:00
|
|
|
import Popover from '../popover/popover.vue'
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
2020-07-07 14:34:35 +00:00
|
|
|
// Route -> i18n key mapping, exported andnot in the computed
|
|
|
|
// because nav panel benefits from the same information.
|
|
|
|
export const timelineNames = () => {
|
|
|
|
return {
|
|
|
|
'friends': 'nav.timeline',
|
|
|
|
'bookmarks': 'nav.bookmarks',
|
|
|
|
'dms': 'nav.dms',
|
|
|
|
'public-timeline': 'nav.public_tl',
|
|
|
|
'public-external-timeline': 'nav.twkn'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-02 15:03:02 +00:00
|
|
|
const TimelineMenu = {
|
|
|
|
components: {
|
|
|
|
Popover
|
|
|
|
},
|
2020-07-03 09:56:31 +00:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
isOpen: false
|
|
|
|
}
|
|
|
|
},
|
2020-07-02 15:03:02 +00:00
|
|
|
created () {
|
|
|
|
if (this.currentUser && this.currentUser.locked) {
|
|
|
|
this.$store.dispatch('startFetchingFollowRequests')
|
|
|
|
}
|
|
|
|
},
|
2020-07-03 09:56:31 +00:00
|
|
|
methods: {
|
|
|
|
openMenu () {
|
2020-07-07 14:34:35 +00:00
|
|
|
// $nextTick is too fast, animation won't play back but
|
|
|
|
// instead starts in fully open position. Low values
|
|
|
|
// like 1-5 work on fast machines but not on mobile, 25
|
|
|
|
// seems like a good compromise that plays without significant
|
|
|
|
// added lag.
|
2020-07-03 09:56:31 +00:00
|
|
|
setTimeout(() => {
|
|
|
|
this.isOpen = true
|
2020-07-07 14:34:35 +00:00
|
|
|
}, 25)
|
2020-07-03 09:56:31 +00:00
|
|
|
}
|
|
|
|
},
|
2020-07-02 15:03:02 +00:00
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
currentUser: state => state.users.currentUser,
|
|
|
|
privateMode: state => state.instance.private,
|
|
|
|
federating: state => state.instance.federating
|
|
|
|
}),
|
2020-07-07 14:34:35 +00:00
|
|
|
timelineNames () {
|
|
|
|
return timelineNames()
|
2020-07-02 15:03:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TimelineMenu
|