Support diving into one status in a conversation
This commit is contained in:
parent
ace1f5067c
commit
84a3cd92a3
6 changed files with 94 additions and 13 deletions
|
@ -2,6 +2,17 @@ import { reduce, filter, findIndex, clone, get } from 'lodash'
|
|||
import Status from '../status/status.vue'
|
||||
import ThreadTree from '../thread_tree/thread_tree.vue'
|
||||
|
||||
import { library } from '@fortawesome/fontawesome-svg-core'
|
||||
import {
|
||||
faAngleDoubleDown,
|
||||
faAngleDoubleLeft
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
library.add(
|
||||
faAngleDoubleDown,
|
||||
faAngleDoubleLeft
|
||||
)
|
||||
|
||||
// const debug = console.log
|
||||
const debug = () => {}
|
||||
|
||||
|
@ -41,7 +52,8 @@ const conversation = {
|
|||
highlight: null,
|
||||
expanded: false,
|
||||
threadDisplayStatusObject: {}, // id => 'showing' | 'hidden'
|
||||
statusContentPropertiesObject: {}
|
||||
statusContentPropertiesObject: {},
|
||||
diveRoot: null
|
||||
}
|
||||
},
|
||||
props: [
|
||||
|
@ -195,6 +207,18 @@ const conversation = {
|
|||
debug("toplevel =", topLevel)
|
||||
return topLevel
|
||||
},
|
||||
showingTopLevel () {
|
||||
if (this.diveRoot) {
|
||||
return [this.conversation.filter(k => this.diveRoot === k.id)[0]]
|
||||
}
|
||||
return this.topLevel
|
||||
},
|
||||
diveDepth () {
|
||||
return this.diveRoot ? this.depths[this.diveRoot] : 0
|
||||
},
|
||||
diveMode () {
|
||||
return !!this.diveRoot
|
||||
},
|
||||
replies () {
|
||||
let i = 1
|
||||
// eslint-disable-next-line camelcase
|
||||
|
@ -359,6 +383,12 @@ const conversation = {
|
|||
},
|
||||
toggleStatusContentProperty (id, name) {
|
||||
this.setStatusContentProperty(id, name, !this.statusContentProperties[id][name])
|
||||
},
|
||||
diveIntoStatus (id) {
|
||||
this.diveRoot = id
|
||||
},
|
||||
undive () {
|
||||
this.diveRoot = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,22 @@
|
|||
{{ $t('timeline.collapse') }}
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
v-if="diveMode"
|
||||
class="conversation-undive-box"
|
||||
>
|
||||
<i18n
|
||||
path="status.show_all_conversation"
|
||||
tag="button"
|
||||
class="button-unstyled -link"
|
||||
@click.prevent="undive"
|
||||
>
|
||||
<FAIcon icon="angle-double-left" />
|
||||
</i18n>
|
||||
</div>
|
||||
<div v-if="isTreeView">
|
||||
<thread-tree
|
||||
v-for="status in topLevel"
|
||||
v-for="status in showingTopLevel"
|
||||
:key="status.id"
|
||||
ref="statusComponent"
|
||||
:depth="0"
|
||||
|
@ -47,6 +60,7 @@
|
|||
:status-content-properties="statusContentProperties"
|
||||
:set-status-content-property="setStatusContentProperty"
|
||||
:toggle-status-content-property="toggleStatusContentProperty"
|
||||
:dive="diveIntoStatus"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="isLinearView">
|
||||
|
@ -65,6 +79,16 @@
|
|||
:in-profile="inProfile"
|
||||
:profile-user-id="profileUserId"
|
||||
class="conversation-status status-fadein panel-body"
|
||||
|
||||
:toggle-thread-display="toggleThreadDisplay"
|
||||
:thread-display-status="threadDisplayStatus"
|
||||
:show-thread-recursively="showThreadRecursively"
|
||||
:total-reply-count="totalReplyCount"
|
||||
:total-reply-depth="totalReplyDepth"
|
||||
:status-content-properties="statusContentProperties"
|
||||
:set-status-content-property="setStatusContentProperty"
|
||||
:toggle-status-content-property="toggleStatusContentProperty"
|
||||
|
||||
@goto="setHighlight"
|
||||
@toggleExpanded="toggleExpanded"
|
||||
/>
|
||||
|
@ -82,6 +106,10 @@
|
|||
@import '../../_variables.scss';
|
||||
|
||||
.Conversation {
|
||||
.conversation-undive-box {
|
||||
padding: 1em;
|
||||
}
|
||||
.conversation-undive-box,
|
||||
.conversation-status {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue