diff options
| author | Tusooa Zhu <tusooa@kazv.moe> | 2021-08-06 20:18:27 -0400 |
|---|---|---|
| committer | Tusooa Zhu <tusooa@kazv.moe> | 2022-03-07 19:19:29 -0500 |
| commit | 0582f19e7c2c6f916b427d5ecfbbb571178ce841 (patch) | |
| tree | a45f9f9a7845867b66c2c2acc74464028d1da6f8 /src/components/thread_tree/thread_tree.js | |
| parent | 7e1e8ea42925dffbce1d75e463f38a2c051c764d (diff) | |
Add tree-style thread display
Diffstat (limited to 'src/components/thread_tree/thread_tree.js')
| -rw-r--r-- | src/components/thread_tree/thread_tree.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/components/thread_tree/thread_tree.js b/src/components/thread_tree/thread_tree.js new file mode 100644 index 00000000..4f95122a --- /dev/null +++ b/src/components/thread_tree/thread_tree.js @@ -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 |
