2026-01-29 15:11:47 +02:00
|
|
|
import { mapActions, mapState } from 'pinia'
|
2026-01-29 15:07:00 +02:00
|
|
|
import { mapGetters } from 'vuex'
|
2026-01-08 17:26:52 +02:00
|
|
|
|
|
|
|
|
import { USERNAME_ROUTES } from 'src/components/navigation/navigation.js'
|
2026-01-29 20:40:00 +02:00
|
|
|
import GestureService from '../../services/gesture_service/gesture_service'
|
|
|
|
|
import { unseenNotificationsFromStore } from '../../services/notification_utils/notification_utils'
|
|
|
|
|
import UserCard from '../user_card/user_card.vue'
|
|
|
|
|
|
2026-01-08 17:26:52 +02:00
|
|
|
import { useAnnouncementsStore } from 'src/stores/announcements'
|
2026-01-29 00:49:26 +02:00
|
|
|
import { useInstanceStore } from 'src/stores/instance.js'
|
2026-02-05 00:28:45 +02:00
|
|
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
2026-01-08 17:26:52 +02:00
|
|
|
import { useInterfaceStore } from 'src/stores/interface'
|
|
|
|
|
import { useShoutStore } from 'src/stores/shout'
|
|
|
|
|
|
2020-10-20 22:13:19 +03:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import {
|
|
|
|
|
faBell,
|
|
|
|
|
faBullhorn,
|
|
|
|
|
faCog,
|
2026-01-06 16:23:17 +02:00
|
|
|
faComments,
|
2022-08-12 01:00:41 +03:00
|
|
|
faCompass,
|
2026-01-06 16:22:52 +02:00
|
|
|
faFilePen,
|
2026-01-06 16:23:17 +02:00
|
|
|
faHome,
|
|
|
|
|
faInfoCircle,
|
|
|
|
|
faList,
|
|
|
|
|
faSearch,
|
|
|
|
|
faSignInAlt,
|
|
|
|
|
faSignOutAlt,
|
|
|
|
|
faTachometerAlt,
|
|
|
|
|
faUserPlus,
|
2020-10-20 22:13:19 +03:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
|
|
|
|
library.add(
|
|
|
|
|
faSignInAlt,
|
|
|
|
|
faSignOutAlt,
|
|
|
|
|
faHome,
|
|
|
|
|
faComments,
|
|
|
|
|
faBell,
|
|
|
|
|
faUserPlus,
|
|
|
|
|
faBullhorn,
|
|
|
|
|
faSearch,
|
|
|
|
|
faTachometerAlt,
|
|
|
|
|
faCog,
|
2022-08-06 17:26:43 +03:00
|
|
|
faInfoCircle,
|
2022-08-12 01:00:41 +03:00
|
|
|
faCompass,
|
2023-03-10 20:26:13 -05:00
|
|
|
faList,
|
2026-01-06 16:22:52 +02:00
|
|
|
faFilePen,
|
2020-10-20 22:13:19 +03:00
|
|
|
)
|
2018-12-23 19:50:19 +02:00
|
|
|
|
2018-12-15 19:13:01 +02:00
|
|
|
const SideDrawer = {
|
2022-07-31 12:35:48 +03:00
|
|
|
props: ['logout'],
|
2018-12-23 19:50:19 +02:00
|
|
|
data: () => ({
|
|
|
|
|
closed: true,
|
2026-01-06 16:22:52 +02:00
|
|
|
closeGesture: undefined,
|
2018-12-23 19:50:19 +02:00
|
|
|
}),
|
2026-01-06 16:22:52 +02:00
|
|
|
created() {
|
|
|
|
|
this.closeGesture = GestureService.swipeGesture(
|
|
|
|
|
GestureService.DIRECTION_LEFT,
|
|
|
|
|
this.toggleDrawer,
|
|
|
|
|
)
|
2019-11-19 14:07:15 +00:00
|
|
|
|
|
|
|
|
if (this.currentUser && this.currentUser.locked) {
|
2020-01-21 16:51:49 +01:00
|
|
|
this.$store.dispatch('startFetchingFollowRequests')
|
2019-11-19 14:07:15 +00:00
|
|
|
}
|
2019-03-25 22:44:58 +02:00
|
|
|
},
|
2019-03-05 14:01:49 -05:00
|
|
|
components: { UserCard },
|
2018-12-15 19:13:01 +02:00
|
|
|
computed: {
|
2026-01-06 16:22:52 +02:00
|
|
|
currentUser() {
|
2018-12-15 19:13:01 +02:00
|
|
|
return this.$store.state.users.currentUser
|
2018-12-28 21:39:54 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
shout() {
|
|
|
|
|
return useShoutStore().joined
|
|
|
|
|
},
|
|
|
|
|
unseenNotifications() {
|
2018-12-28 21:39:54 +02:00
|
|
|
return unseenNotificationsFromStore(this.$store)
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
unseenNotificationsCount() {
|
2018-12-28 21:39:54 +02:00
|
|
|
return this.unseenNotifications.length
|
2019-01-16 02:33:08 +00:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
followRequestCount() {
|
2019-02-27 14:38:10 -05:00
|
|
|
return this.$store.state.api.followRequests.length
|
2019-11-11 14:37:14 -06:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
timelinesRoute() {
|
2022-08-23 22:10:21 +03:00
|
|
|
let name
|
2023-04-05 21:06:37 -06:00
|
|
|
if (useInterfaceStore().lastTimeline) {
|
|
|
|
|
name = useInterfaceStore().lastTimeline
|
2022-08-23 22:10:21 +03:00
|
|
|
}
|
|
|
|
|
name = this.currentUser ? 'friends' : 'public-timeline'
|
|
|
|
|
if (USERNAME_ROUTES.has(name)) {
|
2022-08-23 22:18:33 +03:00
|
|
|
return { name, params: { username: this.currentUser.screen_name } }
|
2022-08-23 22:10:21 +03:00
|
|
|
} else {
|
|
|
|
|
return { name }
|
2020-07-23 15:09:32 +03:00
|
|
|
}
|
2020-07-14 11:44:06 +03:00
|
|
|
},
|
2026-01-29 15:07:00 +02:00
|
|
|
...mapState(useAnnouncementsStore, [
|
|
|
|
|
'supportsAnnouncements',
|
|
|
|
|
'unreadAnnouncementCount',
|
|
|
|
|
]),
|
2026-02-05 00:28:45 +02:00
|
|
|
...mapState(useInstanceCapabilitiesStore, [
|
|
|
|
|
'pleromaChatMessagesAvailable',
|
|
|
|
|
'suggestionsEnabled',
|
|
|
|
|
]),
|
2026-01-29 15:07:00 +02:00
|
|
|
...mapState(useInstanceStore, ['private', 'federating']),
|
|
|
|
|
...mapState(useInstanceStore, {
|
|
|
|
|
logo: (store) => store.instanceIdentity.logo,
|
|
|
|
|
sitename: (store) => store.instanceIdentity.name,
|
|
|
|
|
hideSitename: (store) => store.instanceIdentity.hideSitename,
|
2020-05-07 16:10:53 +03:00
|
|
|
}),
|
2026-01-06 16:22:52 +02:00
|
|
|
...mapGetters(['unreadChatCount', 'draftCount']),
|
2018-12-20 22:20:04 +02:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleDrawer() {
|
2018-12-23 19:50:19 +02:00
|
|
|
this.closed = !this.closed
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
doLogout() {
|
2018-12-22 17:32:07 +02:00
|
|
|
this.logout()
|
2018-12-28 21:39:54 +02:00
|
|
|
this.toggleDrawer()
|
2018-12-23 19:50:19 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
touchStart(e) {
|
2019-03-25 22:44:58 +02:00
|
|
|
GestureService.beginSwipe(e, this.closeGesture)
|
2018-12-23 19:50:19 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
touchMove(e) {
|
2019-03-25 22:44:58 +02:00
|
|
|
GestureService.updateSwipe(e, this.closeGesture)
|
2020-05-25 16:16:30 +03:00
|
|
|
},
|
2026-01-29 15:11:47 +02:00
|
|
|
...mapActions(useInterfaceStore, ['openSettingsModal']),
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2018-12-15 19:13:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default SideDrawer
|