From 6a319154d94c51f0464e0de31c6f88fbe20defea Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 5 Apr 2022 19:22:15 +0300 Subject: teleport bread --- src/components/mobile_nav/mobile_nav.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 9e736cfb..877d52a9 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -78,7 +78,8 @@ const MobileNav = { this.$store.dispatch('logout') }, markNotificationsAsSeen () { - this.$refs.notifications.markAsSeen() + // this.$refs.notifications.markAsSeen() + this.$store.dispatch('markNotificationsAsSeen') }, onScroll ({ target: { scrollTop, clientHeight, scrollHeight } }) { if (scrollTop + clientHeight >= scrollHeight) { -- cgit v1.2.3-70-g09d2 From 3a16a59f37b9b637bb4cbc1c3575810a65515cbc Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 11 Aug 2022 21:56:30 +0300 Subject: navigation refactored, used in mobile nav as well --- src/components/mobile_nav/mobile_nav.js | 9 ++- src/components/mobile_nav/mobile_nav.vue | 29 ++++---- src/components/nav_panel/nav_panel.js | 25 ++----- src/components/nav_panel/nav_panel.vue | 28 +------- src/components/navigation/filter.js | 11 +++ src/components/navigation/navigation.js | 61 ++++++++++++++++ src/components/navigation/navigation_entry.js | 32 +++++++++ src/components/navigation/navigation_entry.vue | 96 ++++++++++++++++++++++++++ src/components/navigation/navigation_pins.js | 68 ++++++++++++++++++ src/components/navigation/navigation_pins.vue | 64 +++++++++++++++++ src/modules/api.js | 3 + 11 files changed, 363 insertions(+), 63 deletions(-) create mode 100644 src/components/navigation/filter.js create mode 100644 src/components/navigation/navigation.js create mode 100644 src/components/navigation/navigation_entry.js create mode 100644 src/components/navigation/navigation_entry.vue create mode 100644 src/components/navigation/navigation_pins.js create mode 100644 src/components/navigation/navigation_pins.vue (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 877d52a9..af47f032 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -2,6 +2,7 @@ import SideDrawer from '../side_drawer/side_drawer.vue' import Notifications from '../notifications/notifications.vue' import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils' import GestureService from '../../services/gesture_service/gesture_service' +import NavigationPins from 'src/components/navigation/navigation_pins.vue' import { mapGetters } from 'vuex' import { library } from '@fortawesome/fontawesome-svg-core' import { @@ -19,7 +20,8 @@ library.add( const MobileNav = { components: { SideDrawer, - Notifications + Notifications, + NavigationPins }, data: () => ({ notificationsCloseGesture: undefined, @@ -47,7 +49,10 @@ const MobileNav = { isChat () { return this.$route.name === 'chat' }, - ...mapGetters(['unreadChatCount']) + ...mapGetters(['unreadChatCount']), + chatsPinned () { + return new Set(this.$store.state.serverSideStorage.prefsStorage.collections.pinnedNavItems).has('chats') + } }, methods: { toggleMobileSidebar () { diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index 949cf17e..82e726a4 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -17,20 +17,12 @@ icon="bars" />
- - {{ sitename }} - -
-
+ +
Date: Wed, 28 Sep 2022 21:30:09 +0300 Subject: added scrolltotop for mobile notifications --- src/components/mobile_nav/mobile_nav.js | 15 ++++++++++++--- src/components/mobile_nav/mobile_nav.vue | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index 88cbe1be..fb8ffa30 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -8,13 +8,17 @@ import { library } from '@fortawesome/fontawesome-svg-core' import { faTimes, faBell, - faBars + faBars, + faArrowUp, + faMinus } from '@fortawesome/free-solid-svg-icons' library.add( faTimes, faBell, - faBars + faBars, + faArrowUp, + faMinus ) const MobileNav = { @@ -25,7 +29,8 @@ const MobileNav = { }, data: () => ({ notificationsCloseGesture: undefined, - notificationsOpen: false + notificationsOpen: false, + notificationsAtTop: true }), created () { this.notificationsCloseGesture = GestureService.swipeGesture( @@ -80,6 +85,9 @@ const MobileNav = { scrollToTop () { window.scrollTo(0, 0) }, + scrollMobileNotificationsToTop () { + this.$refs.mobileNotifications.scrollTo(0, 0) + }, logout () { this.$router.replace('/main/public') this.$store.dispatch('logout') @@ -89,6 +97,7 @@ const MobileNav = { this.$store.dispatch('markNotificationsAsSeen') }, onScroll ({ target: { scrollTop, clientHeight, scrollHeight } }) { + this.notificationsAtTop = scrollTop > 0 if (scrollTop + clientHeight >= scrollHeight) { this.$refs.notifications.fetchOlderNotifications() } diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index c38be75b..264bc713 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -48,6 +48,20 @@ >
{{ $t('notifications.notifications') }} + +
@@ -165,6 +180,10 @@ box-shadow: 0px 0px 4px rgba(0,0,0,.6); box-shadow: var(--topBarShadow); + .spacer { + flex: 1; + } + .title { font-size: 1.3em; margin-left: 0.6em; -- cgit v1.2.3-70-g09d2 From b4a7e58bec86205e23adda2b0625d237acd5aa91 Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 17 Mar 2022 17:51:39 -0400 Subject: Show badges for unread announcements --- src/components/mobile_nav/mobile_nav.js | 2 +- src/components/mobile_nav/mobile_nav.vue | 2 +- src/components/nav_panel/nav_panel.js | 2 +- src/components/navigation/navigation.js | 3 ++- src/components/notifications/notifications.js | 4 ++-- src/components/side_drawer/side_drawer.js | 2 +- src/components/side_drawer/side_drawer.vue | 6 ++++++ src/modules/announcements.js | 9 +++++++++ 8 files changed, 23 insertions(+), 7 deletions(-) (limited to 'src/components/mobile_nav/mobile_nav.js') diff --git a/src/components/mobile_nav/mobile_nav.js b/src/components/mobile_nav/mobile_nav.js index fb8ffa30..cdbbb812 100644 --- a/src/components/mobile_nav/mobile_nav.js +++ b/src/components/mobile_nav/mobile_nav.js @@ -54,7 +54,7 @@ const MobileNav = { isChat () { return this.$route.name === 'chat' }, - ...mapGetters(['unreadChatCount']), + ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount']), chatsPinned () { return new Set(this.$store.state.serverSideStorage.prefsStorage.collections.pinnedNavItems).has('chats') } diff --git a/src/components/mobile_nav/mobile_nav.vue b/src/components/mobile_nav/mobile_nav.vue index d642008b..0f1fe621 100644 --- a/src/components/mobile_nav/mobile_nav.vue +++ b/src/components/mobile_nav/mobile_nav.vue @@ -19,7 +19,7 @@ icon="bars" />
diff --git a/src/components/nav_panel/nav_panel.js b/src/components/nav_panel/nav_panel.js index 66c8a4cd..438615da 100644 --- a/src/components/nav_panel/nav_panel.js +++ b/src/components/nav_panel/nav_panel.js @@ -117,7 +117,7 @@ const NavPanel = { } ) }, - ...mapGetters(['unreadChatCount']) + ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount']) } } diff --git a/src/components/navigation/navigation.js b/src/components/navigation/navigation.js index 4541e60b..40100f97 100644 --- a/src/components/navigation/navigation.js +++ b/src/components/navigation/navigation.js @@ -75,6 +75,7 @@ export const ROOT_ITEMS = { announcements: { route: 'announcements', icon: 'bullhorn', - label: 'nav.announcements' + label: 'nav.announcements', + badgeGetter: 'unreadAnnouncementCount' } } diff --git a/src/components/notifications/notifications.js b/src/components/notifications/notifications.js index c3acd9e0..dde9c93e 100644 --- a/src/components/notifications/notifications.js +++ b/src/components/notifications/notifications.js @@ -69,7 +69,7 @@ const Notifications = { return this.unseenNotifications.length }, unseenCountTitle () { - return this.unseenCount + (this.unreadChatCount) + return this.unseenCount + (this.unreadChatCount) + this.unreadAnnouncementCount }, loading () { return this.$store.state.statuses.notifications.loading @@ -94,7 +94,7 @@ const Notifications = { return this.filteredNotifications.slice(0, this.unseenCount + this.seenToDisplayCount) }, noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders }, - ...mapGetters(['unreadChatCount']) + ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount']) }, mounted () { this.scrollerRef = this.$refs.root.closest('.column.-scrollable') diff --git a/src/components/side_drawer/side_drawer.js b/src/components/side_drawer/side_drawer.js index bb22446b..680216dd 100644 --- a/src/components/side_drawer/side_drawer.js +++ b/src/components/side_drawer/side_drawer.js @@ -97,7 +97,7 @@ const SideDrawer = { ...mapState({ pleromaChatMessagesAvailable: state => state.instance.pleromaChatMessagesAvailable }), - ...mapGetters(['unreadChatCount']) + ...mapGetters(['unreadChatCount', 'unreadAnnouncementCount']) }, methods: { toggleDrawer () { diff --git a/src/components/side_drawer/side_drawer.vue b/src/components/side_drawer/side_drawer.vue index dccb8ab7..4101cb03 100644 --- a/src/components/side_drawer/side_drawer.vue +++ b/src/components/side_drawer/side_drawer.vue @@ -202,6 +202,12 @@ class="fa-scale-110 fa-old-padding" icon="bullhorn" /> {{ $t("nav.announcements") }} + + {{ unreadAnnouncementCount }} +
  • { + return (!cur.inactive && !cur.read) ? acc + 1 : acc + }, 0) + } +} + const announcements = { state: defaultState, mutations, + getters, actions: { fetchAnnouncements (store) { const currentUser = store.rootState.users.currentUser -- cgit v1.2.3-70-g09d2