refs #299 Manage unread mark for local timeline

This commit is contained in:
AkiraFukushima 2018-05-14 21:52:04 +09:00
parent d0fe2ffa57
commit ea120ae97e
5 changed files with 15 additions and 1 deletions

View File

@ -32,7 +32,7 @@ export default {
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
},
beforeUpdate () {
if (this.$store.state.TimelineSpace.SideMenu.unreadHomeTimeline) {
if (this.$store.state.TimelineSpace.SideMenu.unreadHomeTimeline && this.heading) {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
}
},

View File

@ -28,8 +28,14 @@ export default {
})
},
mounted () {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', false)
document.getElementById('scrollable').addEventListener('scroll', this.onScroll)
},
beforeUpdate () {
if (this.$store.state.TimelineSpace.SideMenu.unreadLocalTimeline && this.heading) {
this.$store.commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', false)
}
},
destroyed () {
this.$store.commit('TimelineSpace/Contents/Local/changeHeading', true)
this.$store.commit('TimelineSpace/Contents/Local/mergeTimeline')

View File

@ -41,6 +41,8 @@
<el-menu-item :index="`/${id()}/local`">
<icon name="users"></icon>
<span>Local timeline</span>
<el-badge is-dot :hidden="!unreadLocalTimeline">
</el-badge>
</el-menu-item>
<el-menu-item :index="`/${id()}/public`">
<icon name="globe"></icon>
@ -74,6 +76,7 @@ export default {
account: state => state.TimelineSpace.account,
unreadHomeTimeline: state => state.TimelineSpace.SideMenu.unreadHomeTimeline,
unreadNotifications: state => state.TimelineSpace.SideMenu.unreadNotifications,
unreadLocalTimeline: state => state.TimelineSpace.SideMenu.unreadLocalTimeline,
lists: state => state.TimelineSpace.SideMenu.lists,
themeColor: state => state.App.theme.side_menu_color
})

View File

@ -99,6 +99,7 @@ const TimelineSpace = {
if (rootState.TimelineSpace.Contents.Local.heading && Math.random() > 0.8) {
commit('TimelineSpace/Contents/Local/archiveTimeline', {}, { root: true })
}
commit('TimelineSpace/SideMenu/changeUnreadLocalTimeline', true, { root: true })
})
return new Promise((resolve, reject) => {
ipcRenderer.send('start-local-streaming', account)

View File

@ -5,6 +5,7 @@ const SideMenu = {
state: {
unreadHomeTimeline: false,
unreadNotifications: false,
unreadLocalTimeline: false,
lists: []
},
mutations: {
@ -14,6 +15,9 @@ const SideMenu = {
changeUnreadNotifications (state, value) {
state.unreadNotifications = value
},
changeUnreadLocalTimeline (state, value) {
state.unreadLocalTimeline = value
},
updateLists (state, lists) {
state.lists = lists
}