biome format --write
This commit is contained in:
parent
8372348148
commit
9262e803ec
415 changed files with 54076 additions and 17419 deletions
|
|
@ -6,7 +6,7 @@ import NavigationPins from 'src/components/navigation/navigation_pins.vue'
|
|||
|
||||
import {
|
||||
unseenNotificationsFromStore,
|
||||
countExtraNotifications
|
||||
countExtraNotifications,
|
||||
} from '../../services/notification_utils/notification_utils'
|
||||
|
||||
import { mapGetters } from 'vuex'
|
||||
|
|
@ -21,79 +21,79 @@ import {
|
|||
faBars,
|
||||
faArrowUp,
|
||||
faMinus,
|
||||
faCheckDouble
|
||||
faCheckDouble,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
library.add(
|
||||
faTimes,
|
||||
faBell,
|
||||
faBars,
|
||||
faArrowUp,
|
||||
faMinus,
|
||||
faCheckDouble
|
||||
)
|
||||
library.add(faTimes, faBell, faBars, faArrowUp, faMinus, faCheckDouble)
|
||||
|
||||
const MobileNav = {
|
||||
components: {
|
||||
SideDrawer,
|
||||
Notifications,
|
||||
NavigationPins,
|
||||
ConfirmModal
|
||||
ConfirmModal,
|
||||
},
|
||||
data: () => ({
|
||||
notificationsCloseGesture: undefined,
|
||||
notificationsOpen: false,
|
||||
notificationsAtTop: true,
|
||||
showingConfirmLogout: false
|
||||
showingConfirmLogout: false,
|
||||
}),
|
||||
created () {
|
||||
created() {
|
||||
this.notificationsCloseGesture = GestureService.swipeGesture(
|
||||
GestureService.DIRECTION_RIGHT,
|
||||
() => this.closeMobileNotifications(true),
|
||||
50
|
||||
50,
|
||||
)
|
||||
},
|
||||
computed: {
|
||||
currentUser () {
|
||||
currentUser() {
|
||||
return this.$store.state.users.currentUser
|
||||
},
|
||||
unseenNotifications () {
|
||||
unseenNotifications() {
|
||||
return unseenNotificationsFromStore(this.$store)
|
||||
},
|
||||
unseenNotificationsCount () {
|
||||
return this.unseenNotifications.length + countExtraNotifications(this.$store)
|
||||
unseenNotificationsCount() {
|
||||
return (
|
||||
this.unseenNotifications.length + countExtraNotifications(this.$store)
|
||||
)
|
||||
},
|
||||
unseenCount () {
|
||||
unseenCount() {
|
||||
return this.unseenNotifications.length
|
||||
},
|
||||
unseenCountBadgeText () {
|
||||
unseenCountBadgeText() {
|
||||
return `${this.unseenCount ? this.unseenCount : ''}`
|
||||
},
|
||||
hideSitename () { return this.$store.state.instance.hideSitename },
|
||||
sitename () { return this.$store.state.instance.name },
|
||||
isChat () {
|
||||
hideSitename() {
|
||||
return this.$store.state.instance.hideSitename
|
||||
},
|
||||
sitename() {
|
||||
return this.$store.state.instance.name
|
||||
},
|
||||
isChat() {
|
||||
return this.$route.name === 'chat'
|
||||
},
|
||||
...mapState(useAnnouncementsStore, ['unreadAnnouncementCount']),
|
||||
...mapState(useServerSideStorageStore, {
|
||||
pinnedItems: store => new Set(store.prefsStorage.collections.pinnedNavItems).has('chats')
|
||||
pinnedItems: (store) =>
|
||||
new Set(store.prefsStorage.collections.pinnedNavItems).has('chats'),
|
||||
}),
|
||||
shouldConfirmLogout () {
|
||||
shouldConfirmLogout() {
|
||||
return this.$store.getters.mergedConfig.modalOnLogout
|
||||
},
|
||||
closingDrawerMarksAsSeen () {
|
||||
closingDrawerMarksAsSeen() {
|
||||
return this.$store.getters.mergedConfig.closingDrawerMarksAsSeen
|
||||
},
|
||||
...mapGetters(['unreadChatCount'])
|
||||
...mapGetters(['unreadChatCount']),
|
||||
},
|
||||
methods: {
|
||||
toggleMobileSidebar () {
|
||||
toggleMobileSidebar() {
|
||||
this.$refs.sideDrawer.toggleDrawer()
|
||||
},
|
||||
openMobileNotifications () {
|
||||
openMobileNotifications() {
|
||||
this.notificationsOpen = true
|
||||
},
|
||||
closeMobileNotifications (markRead) {
|
||||
closeMobileNotifications(markRead) {
|
||||
if (this.notificationsOpen) {
|
||||
// make sure to mark notifs seen only when the notifs were open and not
|
||||
// from close-calls.
|
||||
|
|
@ -103,53 +103,53 @@ const MobileNav = {
|
|||
}
|
||||
}
|
||||
},
|
||||
notificationsTouchStart (e) {
|
||||
notificationsTouchStart(e) {
|
||||
GestureService.beginSwipe(e, this.notificationsCloseGesture)
|
||||
},
|
||||
notificationsTouchMove (e) {
|
||||
notificationsTouchMove(e) {
|
||||
GestureService.updateSwipe(e, this.notificationsCloseGesture)
|
||||
},
|
||||
scrollToTop () {
|
||||
scrollToTop() {
|
||||
window.scrollTo(0, 0)
|
||||
},
|
||||
scrollMobileNotificationsToTop () {
|
||||
scrollMobileNotificationsToTop() {
|
||||
this.$refs.mobileNotifications.scrollTo(0, 0)
|
||||
},
|
||||
showConfirmLogout () {
|
||||
showConfirmLogout() {
|
||||
this.showingConfirmLogout = true
|
||||
},
|
||||
hideConfirmLogout () {
|
||||
hideConfirmLogout() {
|
||||
this.showingConfirmLogout = false
|
||||
},
|
||||
logout () {
|
||||
logout() {
|
||||
if (!this.shouldConfirmLogout) {
|
||||
this.doLogout()
|
||||
} else {
|
||||
this.showConfirmLogout()
|
||||
}
|
||||
},
|
||||
doLogout () {
|
||||
doLogout() {
|
||||
this.$router.replace('/main/public')
|
||||
this.$store.dispatch('logout')
|
||||
this.hideConfirmLogout()
|
||||
},
|
||||
markNotificationsAsSeen () {
|
||||
markNotificationsAsSeen() {
|
||||
this.$store.dispatch('markNotificationsAsSeen')
|
||||
},
|
||||
onScroll ({ target: { scrollTop, clientHeight, scrollHeight } }) {
|
||||
onScroll({ target: { scrollTop, clientHeight, scrollHeight } }) {
|
||||
this.notificationsAtTop = scrollTop > 0
|
||||
if (scrollTop + clientHeight >= scrollHeight) {
|
||||
this.$refs.notifications.fetchOlderNotifications()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
$route () {
|
||||
$route() {
|
||||
// handles closing notificaitons when you press any router-link on the
|
||||
// notifications.
|
||||
this.closeMobileNotifications()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default MobileNav
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue