Add tree-style thread display
This commit is contained in:
parent
7e1e8ea429
commit
0582f19e7c
8 changed files with 224 additions and 21 deletions
52
src/components/thread_tree/thread_tree.js
Normal file
52
src/components/thread_tree/thread_tree.js
Normal file
|
@ -0,0 +1,52 @@
|
|||
import Status from '../status/status.vue'
|
||||
|
||||
const debug = console.log
|
||||
|
||||
const ThreadTree = {
|
||||
components: {
|
||||
Status
|
||||
},
|
||||
name: 'ThreadTree',
|
||||
props: {
|
||||
depth: Number,
|
||||
status: Object,
|
||||
inProfile: Boolean,
|
||||
conversation: Array,
|
||||
collapsable: Boolean,
|
||||
isExpanded: Boolean,
|
||||
pinnedStatusIdsObject: Object,
|
||||
profileUserId: String,
|
||||
|
||||
focused: Function,
|
||||
getHighlight: Function,
|
||||
getReplies: Function,
|
||||
setHighlight: Function,
|
||||
toggleExpanded: Function
|
||||
},
|
||||
computed: {
|
||||
reverseLookupTable () {
|
||||
return this.conversation.reduce((table, status, index) => {
|
||||
table[status.id] = index
|
||||
return table
|
||||
}, {})
|
||||
},
|
||||
currentReplies () {
|
||||
debug('status:', this.status)
|
||||
debug('getReplies:', this.getReplies(this.status.id))
|
||||
return this.getReplies(this.status.id).map(({ id }) => this.statusById(id))
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
statusById (id) {
|
||||
return this.conversation[this.reverseLookupTable[id]]
|
||||
},
|
||||
collapseThread () {
|
||||
},
|
||||
showThread () {
|
||||
},
|
||||
showAllSubthreads () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ThreadTree
|
Loading…
Add table
Add a link
Reference in a new issue