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-03-24 04:16:33 +01: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-22 10:09:58 +01:00
|
|
|
<div class="content">
|
2018-03-29 15:41:28 +02:00
|
|
|
<div :class="openSideBar? 'timeline-wrapper-with-side-bar' : 'timeline-wrapper'">
|
|
|
|
<router-view></router-view>
|
|
|
|
</div>
|
|
|
|
<side-bar></side-bar>
|
2018-03-22 10:09:58 +01:00
|
|
|
</div>
|
2018-03-09 07:21:25 +01:00
|
|
|
</div>
|
2018-03-29 04:25:35 +02:00
|
|
|
<new-toot></new-toot>
|
2018-03-21 07:24:07 +01:00
|
|
|
<jump-modal></jump-modal>
|
2018-03-28 02:57:21 +02:00
|
|
|
<image-viewer></image-viewer>
|
2018-03-08 10:36:09 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-03-29 15:41:28 +02:00
|
|
|
import { mapState } from 'vuex'
|
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 04:25:35 +02:00
|
|
|
import NewToot from './TimelineSpace/Modals/NewToot'
|
2018-03-21 07:24:07 +01:00
|
|
|
import JumpModal from './TimelineSpace/JumpModal'
|
2018-03-28 02:57:21 +02:00
|
|
|
import ImageViewer from './TimelineSpace/Modals/ImageViewer'
|
2018-03-29 15:41:28 +02:00
|
|
|
import SideBar from './TimelineSpace/SideBar'
|
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 15:41:28 +02:00
|
|
|
components: { SideMenu, HeaderMenu, NewToot, JumpModal, ImageViewer, SideBar },
|
|
|
|
computed: {
|
|
|
|
...mapState({
|
|
|
|
openSideBar: state => state.TimelineSpace.SideBar.openSideBar
|
|
|
|
})
|
|
|
|
},
|
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()
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
loading.close()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeDestroy () {
|
|
|
|
this.$store.dispatch('TimelineSpace/stopUserStreaming')
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async clear () {
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearAccount')
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearUsername')
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearTimeline')
|
|
|
|
await this.$store.dispatch('TimelineSpace/clearNotifications')
|
|
|
|
await this.$store.dispatch('TimelineSpace/removeShortcutEvents')
|
|
|
|
return 'clear'
|
|
|
|
},
|
|
|
|
async initialize () {
|
|
|
|
await this.clear()
|
|
|
|
|
|
|
|
this.$store.dispatch('TimelineSpace/watchShortcutEvents')
|
|
|
|
try {
|
|
|
|
const account = await this.$store.dispatch('TimelineSpace/fetchAccount', this.$route.params.id)
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/fetchHomeTimeline', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch timeline',
|
|
|
|
type: 'error'
|
2018-03-13 11:18:02 +01:00
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/username', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch username',
|
|
|
|
type: 'error'
|
2018-03-13 14:35:04 +01:00
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
|
|
|
try {
|
|
|
|
await this.$store.dispatch('TimelineSpace/fetchNotifications', account)
|
|
|
|
} catch (err) {
|
|
|
|
this.$message({
|
|
|
|
message: 'Could not fetch notification',
|
|
|
|
type: 'error'
|
2018-03-13 11:18:02 +01:00
|
|
|
})
|
2018-03-21 02:41:53 +01:00
|
|
|
}
|
2018-03-14 04:24:54 +01:00
|
|
|
this.$store.dispatch('TimelineSpace/startUserStreaming', account)
|
2018-03-21 02:41:53 +01:00
|
|
|
} catch (err) {
|
2018-03-11 17:20:08 +01:00
|
|
|
this.$message({
|
|
|
|
message: 'Could not find account',
|
|
|
|
type: 'error'
|
|
|
|
})
|
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;
|
|
|
|
background-color: #ffffff;
|
|
|
|
border-bottom: solid 1px #dcdfe6;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
2018-03-29 15:41:28 +02:00
|
|
|
padding-top: 48px;
|
|
|
|
height: 100%;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
.timeline-wrapper {
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.timeline-wrapper-with-side-bar {
|
|
|
|
height: 100%;
|
|
|
|
width: -webkit-calc(100% - 180px);
|
|
|
|
overflow: auto;
|
|
|
|
}
|
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>
|