diff options
| author | lain <lain@soykaf.club> | 2020-08-06 10:17:44 +0000 |
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-08-06 10:17:44 +0000 |
| commit | 3e6e6096bfd1dad3283396c086e45b09523faaee (patch) | |
| tree | dc322fff1bd377b920669287fbdd5653ba9bfede /src/components/timeline_menu/timeline_menu.js | |
| parent | 9a10ad38260cc4d1ef93a6988ef2cb0941080156 (diff) | |
| parent | e57562959f5e71fd6e3bf180e2856d504ffb1fcf (diff) | |
Merge branch 'feat/separate-timeline-navigation-from-navpanel' into 'develop'
Separate timeline navigation from navpanel
See merge request pleroma/pleroma-fe!1172
Diffstat (limited to 'src/components/timeline_menu/timeline_menu.js')
| -rw-r--r-- | src/components/timeline_menu/timeline_menu.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/components/timeline_menu/timeline_menu.js b/src/components/timeline_menu/timeline_menu.js new file mode 100644 index 00000000..c0d75c54 --- /dev/null +++ b/src/components/timeline_menu/timeline_menu.js @@ -0,0 +1,57 @@ +import Popover from '../popover/popover.vue' +import { mapState } from 'vuex' + +// 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' + } +} + +const TimelineMenu = { + components: { + Popover + }, + data () { + return { + isOpen: false + } + }, + created () { + if (this.currentUser && this.currentUser.locked) { + this.$store.dispatch('startFetchingFollowRequests') + } + if (timelineNames()[this.$route.name]) { + this.$store.dispatch('setLastTimeline', this.$route.name) + } + }, + methods: { + openMenu () { + // $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. + setTimeout(() => { + this.isOpen = true + }, 25) + } + }, + computed: { + ...mapState({ + currentUser: state => state.users.currentUser, + privateMode: state => state.instance.private, + federating: state => state.instance.federating + }), + timelineNames () { + return timelineNames() + } + } +} + +export default TimelineMenu |
