2020-07-02 15:03:02 +00:00
|
|
|
import Popover from '../popover/popover.vue'
|
|
|
|
import { mapState } from 'vuex'
|
2020-10-19 16:38:49 +00:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
import {
|
|
|
|
faUsers,
|
|
|
|
faGlobeEurope,
|
|
|
|
faBookmark,
|
|
|
|
faEnvelope,
|
|
|
|
faHome,
|
|
|
|
faChevronDown
|
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
faUsers,
|
|
|
|
faGlobeEurope,
|
|
|
|
faBookmark,
|
|
|
|
faEnvelope,
|
|
|
|
faHome,
|
|
|
|
faChevronDown
|
|
|
|
)
|
2020-07-02 15:03:02 +00:00
|
|
|
|
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',
|
2020-08-19 10:06:46 +00:00
|
|
|
'public-external-timeline': 'nav.twkn',
|
|
|
|
'tag-timeline': 'tag'
|
2020-07-07 14:34:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-28 06:41:00 +00:00
|
|
|
if (timelineNames()[this.$route.name]) {
|
2020-07-28 06:40:04 +00:00
|
|
|
this.$store.dispatch('setLastTimeline', this.$route.name)
|
|
|
|
}
|
2020-07-02 15:03:02 +00:00
|
|
|
},
|
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-08-19 10:06:46 +00:00
|
|
|
},
|
|
|
|
timelineName () {
|
|
|
|
const route = this.$route.name
|
|
|
|
if (route === 'tag-timeline') {
|
|
|
|
return '#' + this.$route.params.tag
|
|
|
|
}
|
|
|
|
const i18nkey = timelineNames()[this.$route.name]
|
|
|
|
return i18nkey ? this.$t(i18nkey) : route
|
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-08-19 10:06:46 +00:00
|
|
|
})
|
2020-07-02 15:03:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default TimelineMenu
|