2018-03-08 10:36:09 +01:00
|
|
|
<template>
|
|
|
|
<div id="timeline_space">
|
2018-03-09 07:21:25 +01:00
|
|
|
<side-menu></side-menu>
|
2018-03-22 10:09:58 +01:00
|
|
|
<div class="page">
|
2018-04-18 01:18:50 +02:00
|
|
|
<header class="header" style="-webkit-app-region: drag;">
|
2018-03-22 10:09:58 +01:00
|
|
|
<header-menu></header-menu>
|
2018-03-24 04:16:33 +01:00
|
|
|
</header>
|
2018-03-29 17:20:15 +02:00
|
|
|
<contents></contents>
|
2018-03-09 07:21:25 +01:00
|
|
|
</div>
|
2018-03-29 17:20:35 +02:00
|
|
|
<modals></modals>
|
2018-03-08 10:36:09 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-03-09 07:21:25 +01:00
|
|
|
import SideMenu from './TimelineSpace/SideMenu'
|
2018-03-22 10:09:58 +01:00
|
|
|
import HeaderMenu from './TimelineSpace/HeaderMenu'
|
2018-03-29 17:20:15 +02:00
|
|
|
import Contents from './TimelineSpace/Contents'
|
2018-03-29 17:20:35 +02:00
|
|
|
import Modals from './TimelineSpace/Modals'
|
2018-03-09 07:21:25 +01:00
|
|
|
|
2018-03-08 10:36:09 +01:00
|
|
|
export default {
|
2018-03-08 16:24:18 +01:00
|
|
|
name: 'timeline-space',
|
2018-03-29 17:20:35 +02:00
|
|
|
components: { SideMenu, HeaderMenu, Modals, Contents },
|
2018-03-08 16:24:18 +01:00
|
|
|
created () {
|
2018-03-13 15:31:06 +01:00
|
|
|
const loading = this.$loading({
|
|
|
|
lock: true,
|
|
|
|
text: 'Loading',
|
|
|
|
spinner: 'el-icon-loading',
|
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
this.initialize()
|
|
|
|
.then(() => {
|
|
|
|
loading.close()
|
2018-04-19 17:13:37 +02:00
|
|
|
this.$store.commit('GlobalHeader/updateChanging', false)
|
2018-03-21 02:41:53 +01:00
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
loading.close()
|
2018-04-19 17:13:37 +02:00
|
|
|
this.$store.commit('GlobalHeader/updateChanging', false)
|
2018-03-21 02:41:53 +01:00
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
2018-05-14 14:37:34 +02:00
|
|
|
this.$store.dispatch('TimelineSpace/stopLocalStreaming')
|
2018-03-21 02:41:53 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async clear () {
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearAccount')
|
2018-04-20 17:06:29 +02:00
|
|
|
await this.$store.commit('TimelineSpace/Contents/Home/clearTimeline')
|
2018-05-14 14:37:34 +02:00
|
|
|
await this.$store.commit('TimelineSpace/Contents/Local/clearTimeline')
|
2018-04-20 17:06:29 +02:00
|
|
|
await this.$store.commit('TimelineSpace/Contents/Notifications/clearNotifications')
|
2018-03-21 02:41:53 +01:00
|
|
|
await this.$store.dispatch('TimelineSpace/removeShortcutEvents')
|
2018-05-17 15:02:59 +02:00
|
|
|
await this.$store.dispatch('TimelineSpace/clearUnread')
|
2018-03-21 02:41:53 +01:00
|
|
|
return 'clear'
|
|
|
|
},
|
|
|
|
async initialize () {
|
|
|
|
await this.clear()
|
|
|
|
|
|
|
|
this.$store.dispatch('TimelineSpace/watchShortcutEvents')
|
2018-04-08 15:09:28 +02:00
|
|
|
const account = await this.$store.dispatch('TimelineSpace/localAccount', this.$route.params.id).catch(() => {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not find account',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
try {
|
2018-04-20 17:06:29 +02:00
|
|
|
await this.$store.dispatch('TimelineSpace/Contents/Home/fetchTimeline', account)
|
2018-03-21 02:41:53 +01:00
|
|
|
} catch (err) {
|
2018-03-11 17:20:08 +01:00
|
|
|
this.$message({
|
2018-04-08 15:09:28 +02:00
|
|
|
message: 'Could not fetch timeline',
|
2018-03-11 17:20:08 +01:00
|
|
|
type: 'error'
|
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
2018-04-08 15:09:28 +02:00
|
|
|
try {
|
2018-04-20 17:06:29 +02:00
|
|
|
await this.$store.dispatch('TimelineSpace/Contents/Notifications/fetchNotifications', account)
|
2018-04-08 15:09:28 +02:00
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch notification',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
}
|
2018-05-14 14:37:34 +02:00
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/Contents/Local/fetchLocalTimeline', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch local timeline',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
}
|
2018-04-08 15:09:28 +02:00
|
|
|
this.$store.dispatch('TimelineSpace/SideMenu/fetchLists', account)
|
|
|
|
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
|
|
|
.catch(() => {
|
|
|
|
this.$message({
|
|
|
|
message: 'Failed to start streaming',
|
|
|
|
type: 'error'
|
|
|
|
})
|
|
|
|
})
|
2018-05-14 14:37:34 +02:00
|
|
|
this.$store.dispatch('TimelineSpace/startLocalStreaming', account)
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
2018-03-08 16:24:18 +01:00
|
|
|
}
|
2018-03-08 10:36:09 +01:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2018-03-29 15:41:28 +02:00
|
|
|
#timeline_space {
|
|
|
|
height: 100%;
|
|
|
|
}
|
2018-03-22 10:09:58 +01:00
|
|
|
.page {
|
2018-03-09 09:36:57 +01:00
|
|
|
margin-left: 180px;
|
2018-03-29 15:41:28 +02:00
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
2018-03-22 10:09:58 +01:00
|
|
|
|
|
|
|
.header {
|
|
|
|
width: 100%;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 245px;
|
|
|
|
height: 48px;
|
2018-04-13 02:09:51 +02:00
|
|
|
border-bottom: solid 1px var(--theme-border-color);
|
2018-03-22 10:09:58 +01:00
|
|
|
}
|
2018-03-09 07:21:25 +01:00
|
|
|
}
|
2018-03-12 17:42:47 +01:00
|
|
|
|
2018-03-08 10:36:09 +01:00
|
|
|
</style>
|