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'
|
2017-05-13 02:54:12 +10:00
|
|
|
import UserFinder from './components/user_finder/user_finder.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'
|
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'
|
2018-12-29 06:39:54 +11:00
|
|
|
import { unseenNotificationsFromStore } from './services/notification_utils/notification_utils'
|
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-01-27 01:11:34 +11:00
|
|
|
UserFinder,
|
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,
|
2018-12-16 04:13:01 +11:00
|
|
|
SideDrawer
|
2016-11-04 02:58:32 +11:00
|
|
|
},
|
2017-01-18 03:27:39 +11:00
|
|
|
data: () => ({
|
2018-08-31 11:06:00 +10:00
|
|
|
mobileActivePanel: 'timeline',
|
2018-12-03 15:49:14 +11:00
|
|
|
finderHidden: true,
|
2018-08-31 11:06:00 +10:00
|
|
|
supportsMask: window.CSS && window.CSS.supports && (
|
|
|
|
window.CSS.supports('mask-size', 'contain') ||
|
|
|
|
window.CSS.supports('-webkit-mask-size', 'contain') ||
|
|
|
|
window.CSS.supports('-moz-mask-size', 'contain') ||
|
|
|
|
window.CSS.supports('-ms-mask-size', 'contain') ||
|
|
|
|
window.CSS.supports('-o-mask-size', 'contain')
|
2018-12-24 04:50:19 +11:00
|
|
|
)
|
2017-01-18 03:27:39 +11:00
|
|
|
}),
|
2018-08-25 20:12:33 +10:00
|
|
|
created () {
|
|
|
|
// Load the locale from the storage
|
|
|
|
this.$i18n.locale = this.$store.state.config.interfaceLanguage
|
|
|
|
},
|
2016-11-04 02:58:32 +11:00
|
|
|
computed: {
|
2016-11-28 05:44:56 +11:00
|
|
|
currentUser () { return this.$store.state.users.currentUser },
|
2017-02-17 02:59:06 +11:00
|
|
|
background () {
|
2018-09-10 05:02:22 +10:00
|
|
|
return this.currentUser.background_image || this.$store.state.instance.background
|
2017-02-17 02:59:06 +11:00
|
|
|
},
|
2018-09-10 05:02:22 +10:00
|
|
|
enableMask () { return this.supportsMask && this.$store.state.instance.logoMask },
|
2018-08-31 11:06:00 +10:00
|
|
|
logoStyle () {
|
|
|
|
return {
|
|
|
|
'visibility': this.enableMask ? 'hidden' : 'visible'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
logoMaskStyle () {
|
|
|
|
return this.enableMask ? {
|
2018-09-10 05:02:22 +10:00
|
|
|
'mask-image': `url(${this.$store.state.instance.logo})`
|
2018-08-31 11:06:00 +10:00
|
|
|
} : {
|
|
|
|
'background-color': this.enableMask ? '' : 'transparent'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
logoBgStyle () {
|
|
|
|
return Object.assign({
|
2018-12-03 15:49:14 +11:00
|
|
|
'margin': `${this.$store.state.instance.logoMargin} 0`,
|
|
|
|
opacity: this.finderHidden ? 1 : 0
|
2018-08-31 11:06:00 +10:00
|
|
|
}, this.enableMask ? {} : {
|
|
|
|
'background-color': this.enableMask ? '' : 'transparent'
|
|
|
|
})
|
|
|
|
},
|
2018-09-10 05:02:22 +10:00
|
|
|
logo () { return this.$store.state.instance.logo },
|
2018-11-15 03:39:17 +11:00
|
|
|
style () {
|
|
|
|
return {
|
|
|
|
'--body-background-image': `url(${this.background})`,
|
|
|
|
'background-image': `url(${this.background})`
|
|
|
|
}
|
|
|
|
},
|
2018-09-10 04:21:23 +10:00
|
|
|
sitename () { return this.$store.state.instance.name },
|
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 },
|
2018-12-29 06:39:54 +11:00
|
|
|
showInstanceSpecificPanel () { return this.$store.state.instance.showInstanceSpecificPanel },
|
|
|
|
unseenNotifications () {
|
|
|
|
return unseenNotificationsFromStore(this.$store)
|
|
|
|
},
|
|
|
|
unseenNotificationsCount () {
|
|
|
|
return this.unseenNotifications.length
|
2019-02-05 22:57:11 +11:00
|
|
|
},
|
|
|
|
showFeaturesPanel () { return this.$store.state.config.showFeaturesPanel }
|
2017-01-18 03:27:39 +11:00
|
|
|
},
|
|
|
|
methods: {
|
2017-02-19 07:55:16 +11:00
|
|
|
scrollToTop () {
|
|
|
|
window.scrollTo(0, 0)
|
2017-07-02 20:25:34 +10:00
|
|
|
},
|
|
|
|
logout () {
|
2018-11-10 20:43:25 +11:00
|
|
|
this.$router.replace('/main/public')
|
2017-07-02 20:25:34 +10:00
|
|
|
this.$store.dispatch('logout')
|
2018-12-03 15:49:14 +11:00
|
|
|
},
|
|
|
|
onFinderToggled (hidden) {
|
|
|
|
this.finderHidden = hidden
|
2018-12-16 04:13:01 +11:00
|
|
|
},
|
|
|
|
toggleMobileSidebar () {
|
2018-12-24 04:50:19 +11:00
|
|
|
this.$refs.sideDrawer.toggleDrawer()
|
2017-01-18 03:27:39 +11:00
|
|
|
}
|
2016-10-27 04:03:55 +11:00
|
|
|
}
|
|
|
|
}
|