2021-08-07 18:53:23 -04:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import {
|
|
|
|
|
faAngleDoubleDown,
|
2026-01-06 16:22:52 +02:00
|
|
|
faAngleDoubleRight,
|
2021-08-07 18:53:23 -04:00
|
|
|
} from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
2026-01-06 16:22:52 +02:00
|
|
|
library.add(faAngleDoubleDown, faAngleDoubleRight)
|
2021-08-07 18:53:23 -04:00
|
|
|
|
2021-08-06 20:18:27 -04:00
|
|
|
const ThreadTree = {
|
2026-06-04 21:59:09 +03:00
|
|
|
components: {},
|
2021-08-06 20:18:27 -04:00
|
|
|
name: 'ThreadTree',
|
|
|
|
|
props: {
|
|
|
|
|
depth: Number,
|
|
|
|
|
status: Object,
|
|
|
|
|
inProfile: Boolean,
|
|
|
|
|
conversation: Array,
|
|
|
|
|
collapsable: Boolean,
|
|
|
|
|
isExpanded: Boolean,
|
|
|
|
|
pinnedStatusIdsObject: Object,
|
|
|
|
|
profileUserId: String,
|
|
|
|
|
|
2025-05-13 17:54:35 +03:00
|
|
|
isFocusedFunction: Function,
|
2021-08-07 18:53:23 -04:00
|
|
|
highlight: String,
|
2021-08-06 20:18:27 -04:00
|
|
|
getReplies: Function,
|
|
|
|
|
setHighlight: Function,
|
2021-08-07 00:33:06 -04:00
|
|
|
toggleExpanded: Function,
|
|
|
|
|
|
2021-08-07 18:53:23 -04:00
|
|
|
simple: Boolean,
|
2021-08-07 00:33:06 -04:00
|
|
|
// to control display of the whole thread forest
|
|
|
|
|
toggleThreadDisplay: Function,
|
|
|
|
|
threadDisplayStatus: Object,
|
|
|
|
|
showThreadRecursively: Function,
|
|
|
|
|
totalReplyCount: Object,
|
2021-08-07 10:28:45 -04:00
|
|
|
totalReplyDepth: Object,
|
|
|
|
|
statusContentProperties: Object,
|
|
|
|
|
setStatusContentProperty: Function,
|
2021-08-07 11:59:10 -04:00
|
|
|
toggleStatusContentProperty: Function,
|
2026-01-06 16:22:52 +02:00
|
|
|
dive: Function,
|
2021-08-06 20:18:27 -04:00
|
|
|
},
|
|
|
|
|
computed: {
|
2026-01-06 16:22:52 +02:00
|
|
|
suspendable() {
|
|
|
|
|
const selfSuspendable = this.$refs.statusComponent
|
|
|
|
|
? this.$refs.statusComponent.suspendable
|
|
|
|
|
: true
|
2021-09-15 23:35:17 -04:00
|
|
|
if (this.$refs.childComponent) {
|
2026-01-06 16:22:52 +02:00
|
|
|
return (
|
|
|
|
|
selfSuspendable &&
|
|
|
|
|
this.$refs.childComponent.every((s) => s.suspendable)
|
|
|
|
|
)
|
2021-09-15 23:35:17 -04:00
|
|
|
}
|
|
|
|
|
return selfSuspendable
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
reverseLookupTable() {
|
2026-01-06 17:32:22 +02:00
|
|
|
return this.conversation.reduce(
|
|
|
|
|
(table, status, index) => {
|
|
|
|
|
table[status.id] = index
|
|
|
|
|
return table
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
/* no-op */
|
|
|
|
|
},
|
|
|
|
|
)
|
2021-08-06 20:18:27 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
currentReplies() {
|
|
|
|
|
return this.getReplies(this.status.id).map(({ id }) =>
|
|
|
|
|
this.statusById(id),
|
|
|
|
|
)
|
2021-08-06 20:18:27 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
threadShowing() {
|
2021-08-07 00:33:06 -04:00
|
|
|
return this.threadDisplayStatus[this.status.id] === 'showing'
|
2021-08-07 10:28:45 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
currentProp() {
|
2021-08-07 10:28:45 -04:00
|
|
|
return this.statusContentProperties[this.status.id]
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
2021-08-06 20:18:27 -04:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-01-06 16:22:52 +02:00
|
|
|
statusById(id) {
|
2021-08-06 20:18:27 -04:00
|
|
|
return this.conversation[this.reverseLookupTable[id]]
|
|
|
|
|
},
|
2026-01-06 17:32:22 +02:00
|
|
|
collapseThread() {
|
|
|
|
|
/* no-op */
|
|
|
|
|
},
|
|
|
|
|
showThread() {
|
|
|
|
|
/* no-op */
|
|
|
|
|
},
|
|
|
|
|
showAllSubthreads() {
|
|
|
|
|
/* no-op */
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
toggleCurrentProp(name) {
|
2021-08-07 10:28:45 -04:00
|
|
|
this.toggleStatusContentProperty(this.status.id, name)
|
2021-09-16 00:29:14 -04:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
setCurrentProp(name) {
|
2021-09-16 00:29:14 -04:00
|
|
|
this.setStatusContentProperty(this.status.id, name)
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
|
|
|
|
},
|
2021-08-06 20:18:27 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ThreadTree
|