2016-10-28 03:01:48 +11:00
|
|
|
import UserPanel from './components/user_panel/user_panel.vue'
|
2016-11-07 06:11:23 +11:00
|
|
|
import NavPanel from './components/nav_panel/nav_panel.vue'
|
2016-11-28 05:44:56 +11:00
|
|
|
import Notifications from './components/notifications/notifications.vue'
|
2018-02-04 02:27:33 +11:00
|
|
|
import InstanceSpecificPanel from './components/instance_specific_panel/instance_specific_panel.vue'
|
2018-09-03 16:57:22 +10:00
|
|
|
import FeaturesPanel from './components/features_panel/features_panel.vue'
|
2018-09-03 15:43:10 +10:00
|
|
|
import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_panel.vue'
|
2018-01-27 01:11:34 +11:00
|
|
|
import ChatPanel from './components/chat_panel/chat_panel.vue'
|
2020-05-04 00:36:12 +10:00
|
|
|
import SettingsModal from './components/settings_modal/settings_modal.vue'
|
2019-01-15 04:23:13 +11:00
|
|
|
import MediaModal from './components/media_modal/media_modal.vue'
|
2018-12-16 04:13:01 +11:00
|
|
|
import SideDrawer from './components/side_drawer/side_drawer.vue'
|
2019-09-20 03:59:34 +10:00
|
|
|
import MobilePostStatusButton from './components/mobile_post_status_button/mobile_post_status_button.vue'
|
2019-03-13 08:50:54 +11:00
|
|
|
import MobileNav from './components/mobile_nav/mobile_nav.vue'
|
2020-10-30 06:13:31 +11:00
|
|
|
import DesktopNav from './components/desktop_nav/desktop_nav.vue'
|
2019-03-19 19:53:11 +11:00
|
|
|
import UserReportingModal from './components/user_reporting_modal/user_reporting_modal.vue'
|
2019-09-20 03:27:37 +10:00
|
|
|
import PostStatusModal from './components/post_status_modal/post_status_modal.vue'
|
2020-07-02 17:40:41 +10:00
|
|
|
import GlobalNoticeList from './components/global_notice_list/global_notice_list.vue'
|
2020-05-07 23:10:53 +10:00
|
|
|
import { windowWidth, windowHeight } from './services/window_utils/window_utils'
|
2020-12-18 10:01:58 +11:00
|
|
|
import { mapGetters } from 'vuex'
|
2016-10-27 04:03:55 +11:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'app',
|
|
|
|
components: {
|
2016-11-07 06:11:23 +11:00
|
|
|
UserPanel,
|
2016-11-28 05:44:56 +11:00
|
|
|
NavPanel,
|
2017-05-13 02:54:12 +10:00
|
|
|
Notifications,
|
2018-02-12 01:12:05 +11:00
|
|
|
InstanceSpecificPanel,
|
2018-09-03 16:57:22 +10:00
|
|
|
FeaturesPanel,
|
2018-09-03 15:55:40 +10:00
|
|
|
WhoToFollowPanel,
|
2018-12-16 04:13:01 +11:00
|
|
|
ChatPanel,
|
2019-01-15 04:23:13 +11:00
|
|
|
MediaModal,
|
2019-03-12 03:51:37 +11:00
|
|
|
SideDrawer,
|
2019-09-20 03:59:34 +10:00
|
|
|
MobilePostStatusButton,
|
2019-03-19 19:53:11 +11:00
|
|
|
MobileNav,
|
2020-10-30 06:13:31 +11:00
|
|
|
DesktopNav,
|
2020-05-04 00:36:12 +10:00
|
|
|
SettingsModal,
|
2019-09-20 03:27:37 +10:00
|
|
|
UserReportingModal,
|
2020-07-02 17:40:41 +10:00
|
|
|
PostStatusModal,
|
|
|
|
GlobalNoticeList
|
2016-11-04 02:58:32 +11:00
|
|
|
},
|
2017-01-18 03:27:39 +11:00
|
|
|
data: () => ({
|
2020-11-02 01:44:57 +11:00
|
|
|
mobileActivePanel: 'timeline'
|
2017-01-18 03:27:39 +11:00
|
|
|
}),
|
2018-08-25 20:12:33 +10:00
|
|
|
created () {
|
|
|
|
// Load the locale from the storage
|
2020-06-09 01:22:07 +10:00
|
|
|
const val = this.$store.getters.mergedConfig.interfaceLanguage
|
|
|
|
this.$store.dispatch('setOption', { name: 'interfaceLanguage', value: val })
|
2019-03-04 01:33:40 +11:00
|
|
|
window.addEventListener('resize', this.updateMobileState)
|
|
|
|
},
|
|
|
|
destroyed () {
|
|
|
|
window.removeEventListener('resize', this.updateMobileState)
|
2018-08-25 20:12:33 +10:00
|
|
|
},
|
2016-11-04 02:58:32 +11:00
|
|
|
computed: {
|
2016-11-28 05:44:56 +11:00
|
|
|
currentUser () { return this.$store.state.users.currentUser },
|
2020-12-18 10:01:58 +11:00
|
|
|
userBackground () { return this.currentUser.background_image },
|
|
|
|
instanceBackground () {
|
|
|
|
return this.mergedConfig.hideInstanceWallpaper
|
|
|
|
? null
|
|
|
|
: this.$store.state.instance.background
|
2017-02-17 02:59:06 +11:00
|
|
|
},
|
2020-12-18 10:01:58 +11:00
|
|
|
background () { return this.userBackground || this.instanceBackground },
|
2019-02-04 07:32:24 +11:00
|
|
|
bgStyle () {
|
2020-12-18 10:01:58 +11:00
|
|
|
if (this.background) {
|
2020-12-17 03:25:07 +11:00
|
|
|
return {
|
|
|
|
'--body-background-image': `url(${this.background})`
|
|
|
|
}
|
2019-02-15 23:20:52 +11:00
|
|
|
}
|
|
|
|
},
|
2018-02-04 10:36:10 +11:00
|
|
|
chat () { return this.$store.state.chat.channel.state === 'joined' },
|
2018-09-10 04:21:23 +10:00
|
|
|
suggestionsEnabled () { return this.$store.state.instance.suggestionsEnabled },
|
2019-08-13 04:29:11 +10:00
|
|
|
showInstanceSpecificPanel () {
|
|
|
|
return this.$store.state.instance.showInstanceSpecificPanel &&
|
2019-10-07 07:28:30 +11:00
|
|
|
!this.$store.getters.mergedConfig.hideISP &&
|
2019-08-13 04:29:11 +10:00
|
|
|
this.$store.state.instance.instanceSpecificPanelContent
|
|
|
|
},
|
2019-03-04 01:33:40 +11:00
|
|
|
showFeaturesPanel () { return this.$store.state.instance.showFeaturesPanel },
|
2019-11-12 07:25:38 +11:00
|
|
|
isMobileLayout () { return this.$store.state.interface.mobileLayout },
|
2020-05-13 04:59:52 +10:00
|
|
|
privateMode () { return this.$store.state.instance.private },
|
|
|
|
sidebarAlign () {
|
|
|
|
return {
|
2021-05-27 08:22:55 +10:00
|
|
|
'order': this.$store.getters.mergedConfig.sidebarRight ? 99 : 0
|
2020-05-13 04:59:52 +10:00
|
|
|
}
|
2020-12-18 10:01:58 +11:00
|
|
|
},
|
|
|
|
...mapGetters(['mergedConfig'])
|
2017-01-18 03:27:39 +11:00
|
|
|
},
|
|
|
|
methods: {
|
2019-03-04 01:33:40 +11:00
|
|
|
updateMobileState () {
|
2019-04-02 06:41:34 +11:00
|
|
|
const mobileLayout = windowWidth() <= 800
|
2020-05-07 23:10:53 +10:00
|
|
|
const layoutHeight = windowHeight()
|
2019-04-02 06:41:34 +11:00
|
|
|
const changed = mobileLayout !== this.isMobileLayout
|
2019-03-04 01:33:40 +11:00
|
|
|
if (changed) {
|
2019-04-02 06:41:34 +11:00
|
|
|
this.$store.dispatch('setMobileLayout', mobileLayout)
|
2019-03-04 01:33:40 +11:00
|
|
|
}
|
2020-05-07 23:10:53 +10:00
|
|
|
this.$store.dispatch('setLayoutHeight', layoutHeight)
|
|
|
|
}
|
2016-10-27 04:03:55 +11:00
|
|
|
}
|
|
|
|
}
|