pleroma-fe/src/components/thread_tree/thread_tree.vue

121 lines
3.6 KiB
Vue
Raw Normal View History

2021-08-06 20:18:27 -04:00
<template>
2022-11-07 13:53:56 -05:00
<article class="thread-tree">
<Status
2026-08-18 18:00:36 +03:00
:key="statusId"
2021-08-06 20:18:27 -04:00
ref="statusComponent"
2026-08-18 18:00:36 +03:00
:status-id="statusId"
:replies="getReplies(statusId)"
2026-06-30 06:00:41 +03:00
:inline-expanded="collapsable && isExpanded"
2021-08-06 20:18:27 -04:00
:expandable="!isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:in-conversation="isExpanded"
2026-08-18 18:00:36 +03:00
:focused="focused === statusId"
2021-08-06 20:18:27 -04:00
:in-profile="inProfile"
:profile-user-id="profileUserId"
2026-09-07 18:07:01 +03:00
class="conversation-status conversation-status-treeview panel-body"
2021-08-07 00:33:06 -04:00
:thread-display-state="threadDisplay.get(statusId)"
2026-06-30 06:00:41 +03:00
:can-dive="canDive"
2026-08-18 18:00:36 +03:00
@dive="$emit('dive', statusId)"
@goto="$emit('goto', statusId)"
@toggle-expanded="$emit('toggleExpanded', statusId)"
@suspendable-state-change="$emit('suspendableStateChange', e)"
@height-change="$emit('heightChange', e)"
2021-08-06 20:18:27 -04:00
/>
<div
2026-06-30 06:00:41 +03:00
v-if="currentReplies.length > 0 && threadShowing"
2021-08-06 20:18:27 -04:00
class="thread-tree-replies"
>
<ThreadTree
2026-08-20 21:35:45 +03:00
v-for="replyStatusId in currentReplies"
2026-08-18 18:00:36 +03:00
:key="replyStatusId"
2021-08-06 20:18:27 -04:00
ref="childComponent"
2021-08-07 00:33:06 -04:00
:depth="depth + 1"
2026-08-18 18:00:36 +03:00
:status-id="replyStatusId"
2021-08-06 20:18:27 -04:00
:in-profile="inProfile"
:conversation="conversation"
:collapsable="collapsable"
:is-expanded="isExpanded"
:pinned-status-ids-object="pinnedStatusIdsObject"
:profile-user-id="profileUserId"
:replies="replies"
:focused="focused"
2021-08-06 20:18:27 -04:00
:thread-display="threadDisplay"
:thread-display-default="threadDisplayDefault"
2026-06-30 06:00:41 +03:00
:can-dive="canDive"
@show-thread-recursively="(e) => $emit('showThreadRecursively', e)"
@goto="(e) => $emit('goto', e)"
2026-06-30 06:00:41 +03:00
@dive="(e) => $emit('dive', e)"
@suspendable-state-change="e => $emit('suspendableStateChange', e)"
@toggle-expanded="(e) => $emit('toggleExpanded', e)"
2026-08-24 16:35:51 +03:00
@height-change="e => $emit('heightChange', e)"
2021-08-06 20:18:27 -04:00
/>
</div>
2021-08-07 00:33:06 -04:00
<div
v-if="currentReplies.length && !threadShowing"
class="thread-tree-replies thread-tree-replies-hidden"
>
2022-03-29 12:04:09 +03:00
<i18n-t
2021-08-07 18:53:23 -04:00
v-if="simple"
2022-03-29 15:35:18 +03:00
scope="global"
2021-08-07 18:53:23 -04:00
tag="button"
2022-03-23 16:31:34 +02:00
keypath="status.thread_follow_with_icon"
2021-08-07 18:53:23 -04:00
class="button-unstyled -link thread-tree-show-replies-button"
2026-08-18 18:00:36 +03:00
@click.prevent="$emit('dive', statusId)"
2021-08-07 18:53:23 -04:00
>
2022-03-23 16:31:34 +02:00
<template #icon>
<FAIcon
icon="angle-double-right"
/>
</template>
<template #text>
<span>
2026-08-18 18:00:36 +03:00
{{ $t('status.thread_follow', { numStatus: totalReplyCount[statusId] }, totalReplyCount[statusId]) }}
2022-03-23 16:31:34 +02:00
</span>
</template>
</i18n-t>
2022-03-29 12:04:09 +03:00
<i18n-t
2021-08-07 18:53:23 -04:00
v-else
2022-03-29 12:04:09 +03:00
scope="global"
tag="button"
2022-03-23 16:31:34 +02:00
keypath="status.thread_show_full_with_icon"
2021-08-07 00:33:06 -04:00
class="button-unstyled -link thread-tree-show-replies-button"
@click.prevent="$emit('showThreadRecursively', statusId)"
2021-08-07 00:33:06 -04:00
>
2022-03-23 16:31:34 +02:00
<template #icon>
<FAIcon
icon="angle-double-down"
/>
</template>
<template #text>
<span>
2026-08-18 18:00:36 +03:00
{{ $t('status.thread_show_full', { numStatus: totalReplyCount[statusId], depth: totalReplyDepth[statusId] }, totalReplyCount[statusId]) }}
2022-03-23 16:31:34 +02:00
</span>
</template>
</i18n-t>
2021-08-07 00:33:06 -04:00
</div>
2022-11-07 13:53:56 -05:00
</article>
2021-08-06 20:18:27 -04:00
</template>
<script src="./thread_tree.js"></script>
<style lang="scss">
.thread-tree-replies {
2024-03-04 19:45:42 +02:00
margin-left: var(--status-margin);
border-left: 2px solid var(--border);
2021-08-06 20:18:27 -04:00
}
2021-08-08 12:40:17 -04:00
2021-08-07 00:33:06 -04:00
.thread-tree-replies-hidden {
2024-03-04 19:45:42 +02:00
padding: var(--status-margin);
2023-01-09 13:02:16 -05:00
/* Make the button stretch along the whole row */
display: flex;
align-items: stretch;
flex-direction: column;
2021-08-07 00:33:06 -04:00
}
2021-08-06 20:18:27 -04:00
</style>