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'
|
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,
|
|
|
|
UserFinder
|
2016-11-03 15:58:32 +00:00
|
|
|
},
|
2017-01-17 16:27:39 +00:00
|
|
|
data: () => ({
|
|
|
|
mobileActivePanel: 'timeline'
|
|
|
|
}),
|
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
|
|
|
|
},
|
2017-02-16 16:44:36 +00:00
|
|
|
logoStyle () { return { 'background-image': `url(${this.$store.state.config.logo})` } },
|
2017-02-16 15:59:06 +00:00
|
|
|
style () { return { 'background-image': `url(${this.background})` } },
|
2017-02-14 21:21:23 +00:00
|
|
|
sitename () { return this.$store.state.config.name }
|
2017-01-17 16:27:39 +00:00
|
|
|
},
|
2017-11-12 18:24:20 +00:00
|
|
|
created () {
|
|
|
|
// this is to detect user zooming mostly
|
|
|
|
window.addEventListener('resize', this.fixSidebarWidth)
|
|
|
|
},
|
|
|
|
mounted () {
|
|
|
|
// for some reason, at least in dev mode, dom is not ready enough at this point
|
|
|
|
// in theory calling the function directly here should be enough, but it's not
|
|
|
|
setTimeout( () => { this.fixSidebarWidth() }, 500)
|
|
|
|
},
|
|
|
|
destroyed () {
|
|
|
|
window.removeEventListener('resize', this.fixSidebarWidth)
|
|
|
|
},
|
2017-01-17 16:27:39 +00:00
|
|
|
methods: {
|
|
|
|
activatePanel (panelName) {
|
|
|
|
this.mobileActivePanel = panelName
|
2017-02-18 20:55:16 +00:00
|
|
|
},
|
|
|
|
scrollToTop () {
|
|
|
|
window.scrollTo(0, 0)
|
2017-07-02 10:25:34 +00:00
|
|
|
},
|
|
|
|
logout () {
|
|
|
|
this.$store.dispatch('logout')
|
2017-11-12 18:24:20 +00:00
|
|
|
},
|
|
|
|
fixSidebarWidth () {
|
|
|
|
// firefox
|
|
|
|
let barwidth = window.innerWidth - document.body.offsetWidth
|
|
|
|
if (document.body.offsetWidth <= 0) {
|
|
|
|
// chromium
|
|
|
|
barwidth = window.innerWidth - document.body.scrollWidth
|
|
|
|
}
|
|
|
|
// adjust the sidebar size to fit the scrollbar width to keep the gap consistently sized
|
|
|
|
document.getElementById("sidebar-container").style.width = `${345 + barwidth}px`
|
|
|
|
document.getElementById("sidebar-container").style.paddingRight = `${barwidth}px`
|
2017-01-17 16:27:39 +00:00
|
|
|
}
|
2016-10-26 17:03:55 +00:00
|
|
|
}
|
|
|
|
}
|