2020-07-02 08:03:02 -07:00
|
|
|
import Popover from '../popover/popover.vue'
|
|
|
|
import { mapState } from 'vuex'
|
|
|
|
|
2020-07-07 07:34:35 -07: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 08:03:02 -07:00
|
|
|
const TimelineMenu = {
|
|
|
|
components: {
|
|
|
|
Popover
|
|
|
|
},
|
2020-07-03 02:56:31 -07:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
isOpen: false
|
|
|
|
}
|
|
|
|
},
|
2020-07-02 08:03:02 -07:00
|
|
|
created () {
|
|
|
|
if (this.currentUser && this.currentUser.locked) {
|
|
|
|
this.$store.dispatch('startFetchingFollowRequests')
|
|
|
|
}
|
|
|
|
},
|
2020-07-03 02:56:31 -07:00
|
|
|
methods: {
|
|
|
|
openMenu () {
|
2020-07-07 07:34:35 -07: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 02:56:31 -07:00
|
|
|
setTimeout(() => {
|
|
|
|
this.isOpen = true
|
2020-07-07 07:34:35 -07:00
|
|
|
}, 25)
|
2020-07-03 02:56:31 -07:00
|
|
|
}
|
|
|
|
},
|
2020-07-02 08:03:02 -07:00
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
currentUser: state => state.users.currentUser,
|
|
|
|
privateMode: state => state.instance.private,
|
|
|
|
federating: state => state.instance.federating
|
|
|
|
}),
|
2020-07-07 07:34:35 -07:00
|
|
|
timelineNames () {
|
|
|
|
return timelineNames()
|
2020-07-02 08:03:02 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TimelineMenu
|