2016-10-28 01:01:48 +09:00
|
|
|
import UserPanel from './components/user_panel/user_panel.vue'
|
2016-11-07 04:11:23 +09:00
|
|
|
import NavPanel from './components/nav_panel/nav_panel.vue'
|
2018-02-04 00:27:33 +09:00
|
|
|
import InstanceSpecificPanel from './components/instance_specific_panel/instance_specific_panel.vue'
|
2018-09-03 15:57:22 +09:00
|
|
|
import FeaturesPanel from './components/features_panel/features_panel.vue'
|
2018-09-03 14:43:10 +09:00
|
|
|
import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_panel.vue'
|
2020-08-04 08:44:35 +09:00
|
|
|
import ShoutPanel from './components/shout_panel/shout_panel.vue'
|
2019-01-15 02:23:13 +09:00
|
|
|
import MediaModal from './components/media_modal/media_modal.vue'
|
2018-12-16 02:13:01 +09:00
|
|
|
import SideDrawer from './components/side_drawer/side_drawer.vue'
|
2019-09-20 02:59:34 +09:00
|
|
|
import MobilePostStatusButton from './components/mobile_post_status_button/mobile_post_status_button.vue'
|
2019-03-13 06:50:54 +09:00
|
|
|
import MobileNav from './components/mobile_nav/mobile_nav.vue'
|
2020-10-30 04:13:31 +09:00
|
|
|
import DesktopNav from './components/desktop_nav/desktop_nav.vue'
|
2019-03-19 17:53:11 +09:00
|
|
|
import UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue'
|
2022-06-08 12:31:48 +09:00
|
|
|
import EditStatusModal from './components/edit_status_modal/edit_status_modal.vue'
|
2019-09-20 02:27:37 +09:00
|
|
|
import PostStatusModal from './components/post_status_modal/post_status_modal.vue'
|
2022-06-21 13:52:08 +09:00
|
|
|
import StatusHistoryModal from './components/status_history_modal/status_history_modal.vue'
|
2020-07-02 16:40:41 +09:00
|
|
|
import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue'
|
2020-05-07 22:10:53 +09:00
|
|
|
import { windowWidth, windowHeight } from './services/window_utils/window_utils'
|
2020-12-18 08:01:58 +09:00
|
|
|
import { mapGetters } from 'vuex'
|
2022-04-06 01:22:15 +09:00
|
|
|
import { defineAsyncComponent } from 'vue'
|
2016-10-27 02:03:55 +09:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'app',
|
|
|
|
components: {
|
2016-11-07 04:11:23 +09:00
|
|
|
UserPanel,
|
2016-11-28 03:44:56 +09:00
|
|
|
NavPanel,
|
2022-04-06 01:22:15 +09:00
|
|
|
Notifications: defineAsyncComponent(() => import('./components/notifications/notifications.vue')),
|
2018-02-11 23:12:05 +09:00
|
|
|
InstanceSpecificPanel,
|
2018-09-03 15:57:22 +09:00
|
|
|
FeaturesPanel,
|
2018-09-03 14:55:40 +09:00
|
|
|
WhoToFollowPanel,
|
2020-08-04 08:44:35 +09:00
|
|
|
ShoutPanel,
|
2019-01-15 02:23:13 +09:00
|
|
|
MediaModal,
|
2019-03-12 01:51:37 +09:00
|
|
|
SideDrawer,
|
2019-09-20 02:59:34 +09:00
|
|
|
MobilePostStatusButton,
|
2019-03-19 17:53:11 +09:00
|
|
|
MobileNav,
|
2020-10-30 04:13:31 +09:00
|
|
|
DesktopNav,
|
2022-06-13 07:36:41 +09:00
|
|
|
SettingsModal: defineAsyncComponent(() => import('./components/settings_modal/settings_modal.vue')),
|
2022-08-02 06:37:48 +09:00
|
|
|
UpdateNotification: defineAsyncComponent(() => import('./components/update_notification/update_notification.vue')),
|
2019-09-20 02:27:37 +09:00
|
|
|
UserReportingModal,
|
2020-07-02 16:40:41 +09:00
|
|
|
PostStatusModal,
|
2022-06-08 12:31:48 +09:00
|
|
|
EditStatusModal,
|
2022-06-21 13:52:08 +09:00
|
|
|
StatusHistoryModal,
|
2020-07-02 16:40:41 +09:00
|
|
|
GlobalNoticeList
|
2016-11-04 00:58:32 +09:00
|
|
|
},
|
2017-01-18 01:27:39 +09:00
|
|
|
data: () => ({
|
2020-11-01 23:44:57 +09:00
|
|
|
mobileActivePanel: 'timeline'
|
2017-01-18 01:27:39 +09:00
|
|
|
}),
|
2018-08-25 19:12:33 +09:00
|
|
|
created () {
|
|
|
|
// Load the locale from the storage
|
2020-06-09 00:22:07 +09:00
|
|
|
const val = this.$store.getters.mergedConfig.interfaceLanguage
|
|
|
|
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
2019-03-03 23:33:40 +09:00
|
|
|
window.addEventListener('resize', this.updateMobileState)
|
|
|
|
},
|
2021-04-24 23:56:00 +09:00
|
|
|
unmounted () {
|
2019-03-03 23:33:40 +09:00
|
|
|
window.removeEventListener('resize', this.updateMobileState)
|
2018-08-25 19:12:33 +09:00
|
|
|
},
|
2016-11-04 00:58:32 +09:00
|
|
|
computed: {
|
2022-04-11 02:18:54 +09:00
|
|
|
classes () {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
'-reverse': this.reverseLayout,
|
|
|
|
'-no-sticky-headers': this.noSticky,
|
|
|
|
'-has-new-post-button': this.newPostButtonShown
|
|
|
|
},
|
|
|
|
'-' + this.layoutType
|
|
|
|
]
|
|
|
|
},
|
2022-08-17 08:33:39 +09:00
|
|
|
navClasses () {
|
|
|
|
const { navbarColumnStretch } = this.$store.getters.mergedConfig
|
|
|
|
return [
|
|
|
|
'-' + this.layoutType,
|
|
|
|
...(navbarColumnStretch ? ['-column-stretch'] : [])
|
|
|
|
]
|
|
|
|
},
|
2016-11-28 03:44:56 +09:00
|
|
|
currentUser () { return this.$store.state.users.currentUser },
|
2020-12-18 08:01:58 +09:00
|
|
|
userBackground () { return this.currentUser.background_image },
|
|
|
|
instanceBackground () {
|
|
|
|
return this.mergedConfig.hideInstanceWallpaper
|
|
|
|
? null
|
|
|
|
: this.$store.state.instance.background
|
2017-02-17 00:59:06 +09:00
|
|
|
},
|
2020-12-18 08:01:58 +09:00
|
|
|
background () { return this.userBackground || this.instanceBackground },
|
2019-02-04 05:32:24 +09:00
|
|
|
bgStyle () {
|
2020-12-18 08:01:58 +09:00
|
|
|
if (this.background) {
|
2020-12-17 01:25:07 +09:00
|
|
|
return {
|
|
|
|
'--body-background-image': `url(${this.background})`
|
|
|
|
}
|
2019-02-15 21:20:52 +09:00
|
|
|
}
|
|
|
|
},
|
2022-04-07 06:06:41 +09:00
|
|
|
shout () { return this.$store.state.shout.joined },
|
2018-09-10 03:21:23 +09:00
|
|
|
suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled },
|
2019-08-13 03:29:11 +09:00
|
|
|
showInstanceSpecificPanel () {
|
|
|
|
return this.$store.state.instance.showInstanceSpecificPanel &&
|
2019-10-07 05:28:30 +09:00
|
|
|
!this.$store.getters.mergedConfig.hideISP &&
|
2019-08-13 03:29:11 +09:00
|
|
|
this.$store.state.instance.instanceSpecificPanelContent
|
|
|
|
},
|
2022-04-12 05:30:41 +09:00
|
|
|
isChats () {
|
|
|
|
return this.$route.name === 'chat' || this.$route.name === 'chats'
|
|
|
|
},
|
2022-08-17 06:48:10 +09:00
|
|
|
isListEdit () {
|
|
|
|
return this.$route.name === 'lists-edit'
|
|
|
|
},
|
2022-04-11 02:18:54 +09:00
|
|
|
newPostButtonShown () {
|
2022-04-12 05:30:41 +09:00
|
|
|
if (this.isChats) return false
|
2022-08-17 06:48:10 +09:00
|
|
|
if (this.isListEdit) return false
|
2022-04-11 02:18:54 +09:00
|
|
|
return this.$store.getters.mergedConfig.alwaysShowNewPostButton || this.layoutType === 'mobile'
|
|
|
|
},
|
2019-03-03 23:33:40 +09:00
|
|
|
showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
|
2022-06-22 08:44:04 +09:00
|
|
|
editingAvailable () { return this.$store.state.instance.editingAvailable },
|
2021-06-15 02:54:40 +09:00
|
|
|
shoutboxPosition () {
|
2022-04-27 00:12:45 +09:00
|
|
|
return this.$store.getters.mergedConfig.alwaysShowNewPostButton || false
|
2021-06-15 02:54:40 +09:00
|
|
|
},
|
2021-06-15 05:33:51 +09:00
|
|
|
hideShoutbox () {
|
2021-06-15 04:42:56 +09:00
|
|
|
return this.$store.getters.mergedConfig.hideShoutbox
|
|
|
|
},
|
2022-04-06 00:38:05 +09:00
|
|
|
layoutType () { return this.$store.state.interface.layoutType },
|
2020-05-13 03:59:52 +09:00
|
|
|
privateMode () { return this.$store.state.instance.private },
|
2022-04-13 03:18:06 +09:00
|
|
|
reverseLayout () {
|
|
|
|
const { thirdColumnMode, sidebarRight: reverseSetting } = this.$store.getters.mergedConfig
|
|
|
|
if (this.layoutType !== 'wide') {
|
|
|
|
return reverseSetting
|
|
|
|
} else {
|
|
|
|
return thirdColumnMode === 'notifications' ? reverseSetting : !reverseSetting
|
|
|
|
}
|
|
|
|
},
|
2022-04-07 21:11:23 +09:00
|
|
|
noSticky () { return this.$store.getters.mergedConfig.disableStickyHeaders },
|
|
|
|
showScrollbars () { return this.$store.getters.mergedConfig.showScrollbars },
|
2020-12-18 08:01:58 +09:00
|
|
|
...mapGetters(['mergedConfig'])
|
2017-01-18 01:27:39 +09:00
|
|
|
},
|
|
|
|
methods: {
|
2019-03-03 23:33:40 +09:00
|
|
|
updateMobileState () {
|
2022-04-13 03:18:06 +09:00
|
|
|
this.$store.dispatch('setLayoutWidth', windowWidth())
|
|
|
|
this.$store.dispatch('setLayoutHeight', windowHeight())
|
2020-05-07 22:10:53 +09:00
|
|
|
}
|
2016-10-27 02:03:55 +09:00
|
|
|
}
|
|
|
|
}
|