diff --git a/src/renderer/components/TimelineSpace/Contents/Favourites.vue b/src/renderer/components/TimelineSpace/Contents/Favourites.vue index c81d7a1c..02dca8a4 100644 --- a/src/renderer/components/TimelineSpace/Contents/Favourites.vue +++ b/src/renderer/components/TimelineSpace/Contents/Favourites.vue @@ -80,7 +80,7 @@ export default { }) } }, - focusedIndex: function (newState, oldState) { + focusedId: function (newState, oldState) { if (newState && this.heading) { this.heading = false } else if (newState === null && !this.heading) { diff --git a/src/renderer/components/TimelineSpace/Contents/Local.vue b/src/renderer/components/TimelineSpace/Contents/Local.vue index 13083ff0..622fefe9 100644 --- a/src/renderer/components/TimelineSpace/Contents/Local.vue +++ b/src/renderer/components/TimelineSpace/Contents/Local.vue @@ -78,7 +78,7 @@ export default { }) } }, - focusedIndex: function (newState, oldState) { + focusedId: function (newState, oldState) { if (newState && this.heading) { this.$store.commit('TimelineSpace/Contents/Local/changeHeading', false) } else if (newState === null && !this.heading) { diff --git a/src/renderer/components/TimelineSpace/Contents/Public.vue b/src/renderer/components/TimelineSpace/Contents/Public.vue index 985e572e..71837a5c 100644 --- a/src/renderer/components/TimelineSpace/Contents/Public.vue +++ b/src/renderer/components/TimelineSpace/Contents/Public.vue @@ -4,16 +4,16 @@
-
+
@@ -37,7 +37,7 @@ export default { components: { Toot }, data () { return { - focusedIndex: null + focusedId: null } }, computed: { @@ -81,8 +81,8 @@ export default { }) } }, - focusedIndex: function (newState, oldState) { - if (newState >= 0 && this.heading) { + focusedId: function (newState, oldState) { + if (newState && this.heading) { this.$store.commit('TimelineSpace/Contents/Public/changeHeading', false) } else if (newState === null && !this.heading) { this.$store.commit('TimelineSpace/Contents/Public/changeHeading', true) @@ -174,24 +174,26 @@ export default { document.getElementById('scrollable'), 0 ) - this.focusedIndex = null + this.focusedId = null }, focusNext () { - if (this.focusedIndex === null) { - this.focusedIndex = 0 - } else if (this.focusedIndex < this.timeline.length) { - this.focusedIndex++ + const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri) + if (currentIndex === -1) { + this.focusedId = this.timeline[0].uri + } else if (currentIndex < this.timeline.length) { + this.focusedId = this.timeline[currentIndex + 1].uri } }, focusPrev () { - if (this.focusedIndex === 0) { - this.focusedIndex = null - } else if (this.focusedIndex > 0) { - this.focusedIndex-- + const currentIndex = this.timeline.findIndex(toot => this.focusedId === toot.uri) + if (currentIndex === 0) { + this.focusedId = null + } else if (currentIndex > 0) { + this.focusedId = this.timeline[currentIndex - 1].uri } }, - focusToot (index) { - this.focusedIndex = index + focusToot (message) { + this.focusedId = message.uri } } }