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

189 lines
5.5 KiB
Vue
Raw Normal View History

<template>
2019-07-05 10:17:44 +03:00
<div
ref="root"
2020-07-28 01:27:11 +03:00
class="Conversation"
2026-09-07 18:07:01 +03:00
:class="{ '-expanded' : isExpanded, '-page': isPage, '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">
<RichContent
2026-08-04 14:33:17 +03:00
v-if="conversation[0]?.summary_raw_html"
:html="conversation[0].summary_raw_html"
:emoji="conversation[0].emojis"
2026-08-04 19:20:51 +03:00
/>
<template v-else>
2026-08-04 19:20:51 +03:00
{{ $t('timeline.conversation') }}
</template>
2024-10-22 08:24:06 +00:00
</h1>
<button
v-if="!isPage"
class="button-unstyled -link"
@click.prevent="toggleExpanded"
>
{{ $t('timeline.collapse') }}
</button>
<QuickFilterSettings
v-if="isPage && mobileLayout"
:conversation="true"
class="rightside-button"
2022-08-04 23:44:56 +03:00
/>
<QuickViewSettings
v-if="isPage"
:conversation="true"
class="rightside-button"
2022-08-04 23:44:56 +03:00
/>
</div>
<div
v-if="isPage && !status"
class="conversation-body"
ref="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"
ref="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: topLevel.length - 1 }, topLevel.length - 1) }}
2022-03-23 16:31:34 +02:00
</span>
</template>
</i18n-t>
</div>
<div
v-if="shouldShowAncestors"
class="thread-ancestors"
>
<article
v-for="status in currentAncestors"
class="thread-ancestor"
2026-09-08 17:17:24 +03:00
:class="{'thread-ancestor-has-other-replies': statusReplies.size > 1, '-faded': shouldFadeAncestors}"
>
<Status
class="conversation-status panel-body"
:class="getStatusClasses(status)"
2026-02-15 21:31:52 +02:00
:status-id="status.id"
2026-09-08 17:17:24 +03:00
:replies="statusReplies"
2026-02-15 21:31:52 +02:00
:focused="focused === status.id"
can-dive
@goto="setFocused"
2026-09-08 17:17:24 +03:00
@dive="diveIntoStatus(status.id)"
@suspendable-state-change="onStatusSuspendStateChange"
2026-09-08 17:44:16 +03:00
@height-change="updateVirtualHeight"
/>
<div
2026-09-08 17:17:24 +03:00
v-if="shouldShowOtherRepliesButton && statusReplies.size > 1"
class="thread-ancestor-dive-box"
>
<div
class="thread-ancestor-dive-box-inner"
>
<i18n-t
tag="button"
scope="global"
keypath="status.ancestor_follow_with_icon"
class="button-unstyled -link thread-tree-show-replies-button"
@click.prevent="diveIntoStatus(status.id)"
>
<template #icon>
<FAIcon
icon="angle-double-right"
/>
</template>
<template #text>
<span>
2026-09-08 17:17:24 +03:00
{{ $t('status.ancestor_follow', { numReplies: statusReplies.size - 1 }) }}
</span>
</template>
</i18n-t>
</div>
</div>
</article>
</div>
<ThreadTree
2026-09-08 17:17:24 +03:00
:status-id="status.id"
:depth="0"
@goto="setFocused"
2026-06-30 06:00:41 +03:00
@dive="diveIntoStatus"
@toggle-expanded="toggleExpanded"
@show-thread-recursively="showThreadRecursively"
@suspendable-state-change="onStatusSuspendStateChange"
2026-09-08 17:44:16 +03:00
@height-change="updateVirtualHeight"
2021-08-08 12:40:17 -04:00
/>
</div>
2026-09-08 17:21:06 +03:00
<div
v-else-if="isLinearView"
2021-08-08 12:40:17 -04:00
class="thread-body"
>
2026-09-08 17:21:06 +03:00
<article
v-for="element in heightChartLinear"
2026-09-08 17:21:06 +03:00
class="panel-body"
:key="element.id ?? element.ids"
2026-09-08 17:21:06 +03:00
>
<div
v-if="element.type === 'spacer'"
class="virtual-spacer"
:style="{ height: element.height + 'px' }"
/>
2026-09-08 17:21:06 +03:00
<Status
v-if="element.type === 'status'"
2026-09-08 17:21:06 +03:00
class="conversation-status"
:class="getStatusClasses(status)"
:status-id="element.status.id"
2026-09-08 17:21:06 +03:00
:replies="getReplies(status.id)"
2026-02-15 21:31:52 +02:00
:focused="focused === element.id || focused === element.status.retweeted_status?.id"
2026-09-08 17:21:06 +03:00
@goto="setFocused"
@toggle-expanded="toggleExpanded"
@suspendable-state-change="onStatusSuspendStateChange"
2026-09-08 17:44:16 +03:00
@height-change="updateVirtualHeight"
2026-09-08 17:21:06 +03:00
/>
</article>
</div>
</div>
</div>
</template>
<script src="./conversation.js"></script>
<style src="./conversation.scss" />