refs #138 Show unread mark in SideMenu when update timeline
This commit is contained in:
parent
6f9c609876
commit
233eb40cdb
|
@ -13,6 +13,9 @@ import Toot from './Cards/Toot'
|
||||||
export default {
|
export default {
|
||||||
name: 'home',
|
name: 'home',
|
||||||
components: { Toot },
|
components: { Toot },
|
||||||
|
mounted () {
|
||||||
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', false)
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
timeline: state => state.TimelineSpace.homeTimeline
|
timeline: state => state.TimelineSpace.homeTimeline
|
||||||
|
|
|
@ -13,6 +13,9 @@ import Notification from './Cards/Notification'
|
||||||
export default {
|
export default {
|
||||||
name: 'notifications',
|
name: 'notifications',
|
||||||
components: { Notification },
|
components: { Notification },
|
||||||
|
mounted () {
|
||||||
|
this.$store.commit('TimelineSpace/SideMenu/changeUnreadNotifications', false)
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
notifications: state => state.TimelineSpace.notifications
|
notifications: state => state.TimelineSpace.notifications
|
||||||
|
|
|
@ -16,10 +16,14 @@
|
||||||
<el-menu-item :index="`/${id()}/home`">
|
<el-menu-item :index="`/${id()}/home`">
|
||||||
<icon name="home"></icon>
|
<icon name="home"></icon>
|
||||||
<span>Home</span>
|
<span>Home</span>
|
||||||
|
<el-badge is-dot :hidden="!unreadHomeTimeline">
|
||||||
|
</el-badge>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item :index="`/${id()}/notifications`">
|
<el-menu-item :index="`/${id()}/notifications`">
|
||||||
<icon name="bell"></icon>
|
<icon name="bell"></icon>
|
||||||
<span>Notification</span>
|
<span>Notification</span>
|
||||||
|
<el-badge is-dot :hidden="!unreadNotifications">
|
||||||
|
</el-badge>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item :index="`/${id()}/favourites`">
|
<el-menu-item :index="`/${id()}/favourites`">
|
||||||
<icon name="star"></icon>
|
<icon name="star"></icon>
|
||||||
|
@ -45,7 +49,9 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState({
|
...mapState({
|
||||||
account: state => state.TimelineSpace.account,
|
account: state => state.TimelineSpace.account,
|
||||||
username: state => state.TimelineSpace.username
|
username: state => state.TimelineSpace.username,
|
||||||
|
unreadHomeTimeline: state => state.TimelineSpace.SideMenu.unreadHomeTimeline,
|
||||||
|
unreadNotifications: state => state.TimelineSpace.SideMenu.unreadNotifications
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -76,12 +82,18 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.timeline-menu {
|
.timeline-menu /deep/ {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 70px;
|
top: 70px;
|
||||||
left: 65px;
|
left: 65px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 180px;
|
width: 180px;
|
||||||
|
|
||||||
|
.el-badge__content {
|
||||||
|
background-color: #409eff;
|
||||||
|
border: none;
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -117,6 +117,7 @@ const TimelineSpace = {
|
||||||
startUserStreaming ({ commit }, account) {
|
startUserStreaming ({ commit }, account) {
|
||||||
ipcRenderer.on('update-start-user-streaming', (event, update) => {
|
ipcRenderer.on('update-start-user-streaming', (event, update) => {
|
||||||
commit('appendHomeTimeline', update)
|
commit('appendHomeTimeline', update)
|
||||||
|
commit('TimelineSpace/SideMenu/changeUnreadHomeTimeline', true, { root: true })
|
||||||
})
|
})
|
||||||
ipcRenderer.on('notification-start-user-streaming', (event, notification) => {
|
ipcRenderer.on('notification-start-user-streaming', (event, notification) => {
|
||||||
let notify = buildNotification(notification)
|
let notify = buildNotification(notification)
|
||||||
|
@ -124,6 +125,7 @@ const TimelineSpace = {
|
||||||
router.push(`/${account._id}/notifications`)
|
router.push(`/${account._id}/notifications`)
|
||||||
}
|
}
|
||||||
commit('appendNotifications', notification)
|
commit('appendNotifications', notification)
|
||||||
|
commit('TimelineSpace/SideMenu/changeUnreadNotifications', true, { root: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
|
@ -1,7 +1,17 @@
|
||||||
const SideMenu = {
|
const SideMenu = {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {},
|
state: {
|
||||||
mutations: {},
|
unreadHomeTimeline: false,
|
||||||
|
unreadNotifications: false
|
||||||
|
},
|
||||||
|
mutations: {
|
||||||
|
changeUnreadHomeTimeline (state, value) {
|
||||||
|
state.unreadHomeTimeline = value
|
||||||
|
},
|
||||||
|
changeUnreadNotifications (state, value) {
|
||||||
|
state.unreadNotifications = value
|
||||||
|
}
|
||||||
|
},
|
||||||
actions: {}
|
actions: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue