akkoma-fe/src/App.js

79 lines
2.7 KiB
JavaScript
Raw Normal View History

2016-10-27 16:01:48 +00:00
import UserPanel from './components/user_panel/user_panel.vue'
2016-11-06 19:11:23 +00:00
import NavPanel from './components/nav_panel/nav_panel.vue'
2016-11-27 18:44:56 +00:00
import Notifications from './components/notifications/notifications.vue'
2017-05-12 16:54:12 +00:00
import UserFinder from './components/user_finder/user_finder.vue'
2018-09-03 05:43:10 +00:00
import FeaturesPanel from './components/features_panel/features_panel.vue'
2018-02-03 15:27:33 +00:00
import InstanceSpecificPanel from './components/instance_specific_panel/instance_specific_panel.vue'
2018-09-03 05:43:10 +00:00
import WhoToFollowPanel from './components/who_to_follow_panel/who_to_follow_panel.vue'
2018-01-26 14:11:34 +00:00
import ChatPanel from './components/chat_panel/chat_panel.vue'
2016-10-26 17:03:55 +00:00
export default {
name: 'app',
components: {
2016-11-06 19:11:23 +00:00
UserPanel,
2016-11-27 18:44:56 +00:00
NavPanel,
2017-05-12 16:54:12 +00:00
Notifications,
2018-01-26 14:11:34 +00:00
UserFinder,
2018-02-11 14:12:05 +00:00
WhoToFollowPanel,
InstanceSpecificPanel,
ChatPanel
2016-11-03 15:58:32 +00:00
},
2017-01-17 16:27:39 +00:00
data: () => ({
mobileActivePanel: 'timeline',
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')
)
2017-01-17 16:27:39 +00:00
}),
created () {
// Load the locale from the storage
this.$i18n.locale = this.$store.state.config.interfaceLanguage
},
2016-11-03 15:58:32 +00:00
computed: {
2016-11-27 18:44:56 +00:00
currentUser () { return this.$store.state.users.currentUser },
2017-02-16 15:59:06 +00:00
background () {
return this.currentUser.background_image || this.$store.state.config.background
},
enableMask () { return this.supportsMask && this.$store.state.config.logoMask },
logoStyle () {
return {
'visibility': this.enableMask ? 'hidden' : 'visible'
}
},
logoMaskStyle () {
return this.enableMask ? {
'mask-image': `url(${this.$store.state.config.logo})`
} : {
'background-color': this.enableMask ? '' : 'transparent'
}
},
logoBgStyle () {
return Object.assign({
'margin': `${this.$store.state.config.logoMargin} 0`
}, this.enableMask ? {} : {
'background-color': this.enableMask ? '' : 'transparent'
})
},
logo () { return this.$store.state.config.logo },
2017-02-16 15:59:06 +00:00
style () { return { 'background-image': `url(${this.background})` } },
2018-01-26 14:11:34 +00:00
sitename () { return this.$store.state.config.name },
2018-02-03 23:36:10 +00:00
chat () { return this.$store.state.chat.channel.state === 'joined' },
2018-08-22 02:47:36 +00:00
suggestionsEnabled () { return this.$store.state.config.suggestionsEnabled },
2018-02-10 01:09:49 +00:00
showInstanceSpecificPanel () { return this.$store.state.config.showInstanceSpecificPanel }
2017-01-17 16:27:39 +00:00
},
methods: {
activatePanel (panelName) {
this.mobileActivePanel = panelName
},
scrollToTop () {
window.scrollTo(0, 0)
2017-07-02 10:25:34 +00:00
},
logout () {
this.$store.dispatch('logout')
2017-01-17 16:27:39 +00:00
}
2016-10-26 17:03:55 +00:00
}
}