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

256 lines
7.8 KiB
Vue
Raw Normal View History

<template>
2019-07-05 10:17:44 +03:00
<div
2020-09-29 10:18:37 +00:00
v-if="!hideStatus"
:style="hiddenStyle"
2020-07-28 01:27:11 +03:00
class="Conversation"
:class="{ '-expanded' : isExpanded, 'panel' : isExpanded }"
2019-07-05 10:17:44 +03:00
>
<div
v-if="isExpanded"
2022-04-19 23:06:57 +03:00
class="panel-heading conversation-heading -sticky"
2019-07-05 10:17:44 +03:00
>
2024-10-22 08:24:06 +00:00
<h1 class="title">
{{ $t('timeline.conversation') }}
</h1>
<button
v-if="collapsable"
class="button-unstyled -link"
@click.prevent="toggleExpanded"
>
{{ $t('timeline.collapse') }}
</button>
<QuickFilterSettings
v-if="!collapsable && mobileLayout"
:conversation="true"
class="rightside-button"
2022-08-04 23:44:56 +03:00
/>
<QuickViewSettings
v-if="!collapsable"
:conversation="true"
class="rightside-button"
2022-08-04 23:44:56 +03:00
/>
</div>
<div
v-if="isPage && !status"
class="conversation-body"
:class="{ 'panel-body': isExpanded }"
>
<p v-if="!loadStatusError">
<FAIcon
spin
icon="circle-notch"
/>
{{ $t('status.loading') }}
</p>
<p v-else>
{{ $t('status.load_error', { error: loadStatusError }) }}
</p>
</div>
<div
v-else
class="conversation-body"
:class="{ 'panel-body': isExpanded }"
2024-03-04 21:40:35 +02:00
>
2021-08-08 12:40:17 -04:00
<div
v-if="isTreeView"
class="thread-body"
>
<div
v-if="shouldShowAllConversationButton"
class="conversation-dive-to-top-level-box"
>
2022-03-23 16:31:34 +02:00
<i18n-t
keypath="status.show_all_conversation_with_icon"
tag="button"
class="button-unstyled -link"
2022-03-29 15:46:21 +03:00
scope="global"
2022-07-31 12:35:48 +03:00
@click.prevent="diveToTopLevel"
>
2022-03-23 16:31:34 +02:00
<template #icon>
<FAIcon
icon="angle-double-left"
/>
</template>
<template #text>
<span>
{{ $t('status.show_all_conversation', { numStatus: otherTopLevelCount }, otherTopLevelCount) }}
2022-03-23 16:31:34 +02:00
</span>
</template>
</i18n-t>
</div>
<div
v-if="shouldShowAncestors"
class="thread-ancestors"
>
2022-11-07 13:53:56 -05:00
<article
v-for="status in ancestorsOf(diveRoot)"
:key="status.id"
class="thread-ancestor"
2022-03-06 14:13:35 -05:00
:class="{'thread-ancestor-has-other-replies': getReplies(status.id).length > 1, '-faded': shouldFadeAncestors}"
>
2026-02-15 21:31:52 +02:00
<Status
ref="statusComponent"
2026-02-15 21:31:52 +02:00
class="conversation-status status-fadein panel-body"
:statusoid="status"
2026-02-15 21:31:52 +02:00
:replies="getReplies(status.id)"
:expandable="!isExpanded"
:focused="maybeFocused === status.id"
2026-02-15 21:31:52 +02:00
:inline-expanded="collapsable && isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
:in-profile="inProfile"
2026-02-15 21:31:52 +02:00
:in-conversation="isExpanded"
:profile-user-id="profileUserId"
:simple-tree="treeViewIsSimple"
:show-other-replies-as-button="showOtherRepliesButtonInsideStatus"
2026-06-30 06:00:41 +03:00
can-dive
@goto="setFocused"
2026-06-30 06:00:41 +03:00
@dive="() => diveIntoStatus(status.id)"
@suspendable-state-change="onStatusSuspendStateChange"
/>
<div
v-if="showOtherRepliesButtonBelowStatus && getReplies(status.id).length > 1"
class="thread-ancestor-dive-box"
>
<div
class="thread-ancestor-dive-box-inner"
>
2022-03-23 16:31:34 +02:00
<i18n-t
tag="button"
2022-03-29 15:46:21 +03:00
scope="global"
2022-03-23 16:31:34 +02:00
keypath="status.ancestor_follow_with_icon"
class="button-unstyled -link thread-tree-show-replies-button"
@click.prevent="diveIntoStatus(status.id)"
>
2022-03-23 16:31:34 +02:00
<template #icon>
<FAIcon
icon="angle-double-right"
/>
</template>
<template #text>
<span>
{{ $t('status.ancestor_follow', { numReplies: getReplies(status.id, getReplies(status.id).length - 1).length - 1 }) }}
2022-03-23 16:31:34 +02:00
</span>
</template>
</i18n-t>
</div>
</div>
2022-11-07 13:53:56 -05:00
</article>
</div>
<ThreadTree
2021-08-08 12:40:17 -04:00
v-for="status in showingTopLevel"
:key="status.id"
ref="statusComponent"
:depth="0"
2021-08-06 20:18:27 -04:00
2021-08-08 12:40:17 -04:00
:status="status"
:in-profile="inProfile"
:conversation="conversation"
:collapsable="collapsable"
:is-expanded="isExpanded"
:pinned-status-ids-object="pinnedStatusIdsObject"
:profile-user-id="profileUserId"
2021-08-06 20:18:27 -04:00
2021-08-08 12:40:17 -04:00
:get-replies="getReplies"
:focused="maybeFocused"
2021-08-08 12:40:17 -04:00
:toggle-expanded="toggleExpanded"
2021-08-07 00:33:06 -04:00
2021-08-08 12:40:17 -04:00
:simple="treeViewIsSimple"
:thread-display-status="threadDisplayStatus"
:show-thread-recursively="showThreadRecursively"
:total-reply-count="totalReplyCount"
:total-reply-depth="totalReplyDepth"
2026-06-30 06:00:41 +03:00
:can-dive="canDive"
@goto="setFocused"
2026-06-30 06:00:41 +03:00
@dive="diveIntoStatus"
@suspendable-state-change="onStatusSuspendStateChange"
2021-08-08 12:40:17 -04:00
/>
</div>
<div
v-else-if="isLinearView || (isChatView && !isExpanded)"
2021-08-08 12:40:17 -04:00
class="thread-body"
>
2022-11-07 13:53:56 -05:00
<article>
<Status
2022-11-07 13:53:56 -05:00
v-for="status in conversation"
:key="status.id"
ref="statusComponent"
2026-02-15 21:31:52 +02:00
class="conversation-status status-fadein panel-body"
2022-11-07 13:53:56 -05:00
:statusoid="status"
2026-02-15 21:31:52 +02:00
:replies="getReplies(status.id)"
2022-11-07 13:53:56 -05:00
:expandable="!isExpanded"
:focused="maybeFocused === status.id || maybeFocused === status.retweeted_status?.id"
2026-02-15 21:31:52 +02:00
:inline-expanded="collapsable && isExpanded"
:show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
2022-11-07 13:53:56 -05:00
:in-profile="inProfile"
2026-02-15 21:31:52 +02:00
:in-conversation="isExpanded"
2022-11-07 13:53:56 -05:00
:profile-user-id="profileUserId"
@goto="setFocused"
2025-02-04 14:14:31 +02:00
@toggle-expanded="toggleExpanded"
@suspendable-state-change="onStatusSuspendStateChange"
2022-11-07 13:53:56 -05:00
/>
</article>
2021-08-08 12:40:17 -04:00
</div>
<div
v-else-if="isChatView"
class="chat-view"
>
<ChatMessageList
:messages="conversation"
2026-07-10 17:09:17 +03:00
@reply-requested="e => explicitReplyStatus = e"
/>
</div>
2021-08-06 20:18:27 -04:00
</div>
<div
2026-07-10 17:09:17 +03:00
v-if="isChatView && isExpanded && replyStatus"
class="chat-view-reply-form panel-footer -flexible-height"
>
2026-07-10 17:09:17 +03:00
<div class="auto-reply-to-section">
2026-07-22 14:25:39 +03:00
<h4 class="reply-to-text">
2026-07-10 17:09:17 +03:00
{{ explicitReplyStatus ? $t('status.reply_to_selected') : $t('status.reply_to_last') }}
<button
v-if="explicitReplyStatus"
class="button-default"
@click="explicitReplyStatus = null"
>
<FAIcon icon="times" />
{{ $t('general.cancel') }}
</button>
</h4>
2026-07-22 14:25:39 +03:00
<StatusContent
:status="replyStatus"
class="reply-to-preview"
compact
collapse
/>
2026-07-10 17:09:17 +03:00
</div>
<PostStatusForm
2026-07-22 14:25:39 +03:00
class="reply-form"
2026-07-10 17:09:17 +03:00
:reply-to="replyStatus.id"
:attentions="replyStatus.attentions"
:replied-user="replyStatus.user"
2026-07-22 14:25:39 +03:00
:replied-sibject="replyStatus.summary"
:replied-scope="replyStatus.visibility"
:submit-on-enter="!mobileLayout"
:preserve-focus="!mobileLayout"
:auto-focus="!mobileLayout"
disable-quotes
mentions-line
mentions-line-read-only
/>
</div>
</div>
2020-09-29 10:18:37 +00:00
<div
v-else
class="Conversation -hidden"
2020-09-29 10:18:37 +00:00
:style="hiddenStyle"
/>
</template>
<script src="./conversation.js"></script>
<style src="./conversation.scss" />