logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://anongit.hacktivis.me/git/pleroma-fe.git/

conversation.vue (11074B)


  1. <template>
  2. <div
  3. v-if="!hideStatus"
  4. :style="hiddenStyle"
  5. class="Conversation"
  6. :class="{ '-expanded' : isExpanded, 'panel' : isExpanded }"
  7. >
  8. <div
  9. v-if="isExpanded"
  10. class="panel-heading conversation-heading -sticky"
  11. >
  12. <h1 class="title">
  13. {{ $t('timeline.conversation') }}
  14. </h1>
  15. <button
  16. v-if="collapsable"
  17. class="button-unstyled -link"
  18. @click.prevent="toggleExpanded"
  19. >
  20. {{ $t('timeline.collapse') }}
  21. </button>
  22. <QuickFilterSettings
  23. v-if="!collapsable && mobileLayout"
  24. :conversation="true"
  25. class="rightside-button"
  26. />
  27. <QuickViewSettings
  28. v-if="!collapsable"
  29. :conversation="true"
  30. class="rightside-button"
  31. />
  32. </div>
  33. <div
  34. v-if="isPage && !status"
  35. class="conversation-body"
  36. :class="{ 'panel-body': isExpanded }"
  37. >
  38. <p v-if="!loadStatusError">
  39. <FAIcon
  40. spin
  41. icon="circle-notch"
  42. />
  43. {{ $t('status.loading') }}
  44. </p>
  45. <p v-else>
  46. {{ $t('status.load_error', { error: loadStatusError }) }}
  47. </p>
  48. </div>
  49. <div
  50. v-else
  51. class="conversation-body"
  52. :class="{ 'panel-body': isExpanded }"
  53. >
  54. <div
  55. v-if="isTreeView"
  56. class="thread-body"
  57. >
  58. <div
  59. v-if="shouldShowAllConversationButton"
  60. class="conversation-dive-to-top-level-box"
  61. >
  62. <i18n-t
  63. keypath="status.show_all_conversation_with_icon"
  64. tag="button"
  65. class="button-unstyled -link"
  66. scope="global"
  67. @click.prevent="diveToTopLevel"
  68. >
  69. <template #icon>
  70. <FAIcon
  71. icon="angle-double-left"
  72. />
  73. </template>
  74. <template #text>
  75. <span>
  76. {{ $t('status.show_all_conversation', { numStatus: otherTopLevelCount }, otherTopLevelCount) }}
  77. </span>
  78. </template>
  79. </i18n-t>
  80. </div>
  81. <div
  82. v-if="shouldShowAncestors"
  83. class="thread-ancestors"
  84. >
  85. <article
  86. v-for="status in ancestorsOf(diveRoot)"
  87. :key="status.id"
  88. class="thread-ancestor"
  89. :class="{'thread-ancestor-has-other-replies': getReplies(status.id).length > 1, '-faded': shouldFadeAncestors}"
  90. >
  91. <status
  92. ref="statusComponent"
  93. :inline-expanded="collapsable && isExpanded"
  94. :statusoid="status"
  95. :expandable="!isExpanded"
  96. :show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
  97. :focused="focused(status.id)"
  98. :in-conversation="isExpanded"
  99. :highlight="getHighlight()"
  100. :replies="getReplies(status.id)"
  101. :in-profile="inProfile"
  102. :profile-user-id="profileUserId"
  103. class="conversation-status status-fadein panel-body"
  104. :simple-tree="treeViewIsSimple"
  105. :toggle-thread-display="toggleThreadDisplay"
  106. :thread-display-status="threadDisplayStatus"
  107. :show-thread-recursively="showThreadRecursively"
  108. :total-reply-count="totalReplyCount"
  109. :total-reply-depth="totalReplyDepth"
  110. :show-other-replies-as-button="showOtherRepliesButtonInsideStatus"
  111. :dive="() => diveIntoStatus(status.id)"
  112. :controlled-showing-tall="statusContentProperties[status.id].showingTall"
  113. :controlled-expanding-subject="statusContentProperties[status.id].expandingSubject"
  114. :controlled-showing-long-subject="statusContentProperties[status.id].showingLongSubject"
  115. :controlled-replying="statusContentProperties[status.id].replying"
  116. :controlled-media-playing="statusContentProperties[status.id].mediaPlaying"
  117. :controlled-toggle-showing-tall="() => toggleStatusContentProperty(status.id, 'showingTall')"
  118. :controlled-toggle-expanding-subject="() => toggleStatusContentProperty(status.id, 'expandingSubject')"
  119. :controlled-toggle-showing-long-subject="() => toggleStatusContentProperty(status.id, 'showingLongSubject')"
  120. :controlled-toggle-replying="() => toggleStatusContentProperty(status.id, 'replying')"
  121. :controlled-set-media-playing="(newVal) => toggleStatusContentProperty(status.id, 'mediaPlaying', newVal)"
  122. @goto="setHighlight"
  123. @toggleExpanded="toggleExpanded"
  124. />
  125. <div
  126. v-if="showOtherRepliesButtonBelowStatus && getReplies(status.id).length > 1"
  127. class="thread-ancestor-dive-box"
  128. >
  129. <div
  130. class="thread-ancestor-dive-box-inner"
  131. >
  132. <i18n-t
  133. tag="button"
  134. scope="global"
  135. keypath="status.ancestor_follow_with_icon"
  136. class="button-unstyled -link thread-tree-show-replies-button"
  137. @click.prevent="diveIntoStatus(status.id)"
  138. >
  139. <template #icon>
  140. <FAIcon
  141. icon="angle-double-right"
  142. />
  143. </template>
  144. <template #text>
  145. <span>
  146. {{ $t('status.ancestor_follow', { numReplies: getReplies(status.id, getReplies(status.id).length - 1).length - 1 }) }}
  147. </span>
  148. </template>
  149. </i18n-t>
  150. </div>
  151. </div>
  152. </article>
  153. </div>
  154. <thread-tree
  155. v-for="status in showingTopLevel"
  156. :key="status.id"
  157. ref="statusComponent"
  158. :depth="0"
  159. :status="status"
  160. :in-profile="inProfile"
  161. :conversation="conversation"
  162. :collapsable="collapsable"
  163. :is-expanded="isExpanded"
  164. :pinned-status-ids-object="pinnedStatusIdsObject"
  165. :profile-user-id="profileUserId"
  166. :focused="focused"
  167. :get-replies="getReplies"
  168. :highlight="maybeHighlight"
  169. :set-highlight="setHighlight"
  170. :toggle-expanded="toggleExpanded"
  171. :simple="treeViewIsSimple"
  172. :toggle-thread-display="toggleThreadDisplay"
  173. :thread-display-status="threadDisplayStatus"
  174. :show-thread-recursively="showThreadRecursively"
  175. :total-reply-count="totalReplyCount"
  176. :total-reply-depth="totalReplyDepth"
  177. :status-content-properties="statusContentProperties"
  178. :set-status-content-property="setStatusContentProperty"
  179. :toggle-status-content-property="toggleStatusContentProperty"
  180. :dive="canDive ? diveIntoStatus : undefined"
  181. />
  182. </div>
  183. <div
  184. v-if="isLinearView"
  185. class="thread-body"
  186. >
  187. <article>
  188. <status
  189. v-for="status in conversation"
  190. :key="status.id"
  191. ref="statusComponent"
  192. :inline-expanded="collapsable && isExpanded"
  193. :statusoid="status"
  194. :expandable="!isExpanded"
  195. :show-pinned="pinnedStatusIdsObject && pinnedStatusIdsObject[status.id]"
  196. :focused="focused(status.id)"
  197. :in-conversation="isExpanded"
  198. :highlight="getHighlight()"
  199. :replies="getReplies(status.id)"
  200. :in-profile="inProfile"
  201. :profile-user-id="profileUserId"
  202. class="conversation-status status-fadein panel-body"
  203. :toggle-thread-display="toggleThreadDisplay"
  204. :thread-display-status="threadDisplayStatus"
  205. :show-thread-recursively="showThreadRecursively"
  206. :total-reply-count="totalReplyCount"
  207. :total-reply-depth="totalReplyDepth"
  208. :status-content-properties="statusContentProperties"
  209. :set-status-content-property="setStatusContentProperty"
  210. :toggle-status-content-property="toggleStatusContentProperty"
  211. @goto="setHighlight"
  212. @toggleExpanded="toggleExpanded"
  213. />
  214. </article>
  215. </div>
  216. </div>
  217. </div>
  218. <div
  219. v-else
  220. class="Conversation -hidden"
  221. :style="hiddenStyle"
  222. />
  223. </template>
  224. <script src="./conversation.js"></script>
  225. <style lang="scss">
  226. .Conversation {
  227. z-index: 1;
  228. &.-hidden {
  229. background: var(--__panel-background);
  230. backdrop-filter: var(--__panel-backdrop-filter);
  231. }
  232. .conversation-dive-to-top-level-box {
  233. padding: var(--status-margin);
  234. border-bottom: 1px solid var(--border);
  235. border-radius: 0;
  236. /* Make the button stretch along the whole row */
  237. display: flex;
  238. align-items: stretch;
  239. flex-direction: column;
  240. }
  241. .thread-ancestors {
  242. margin-left: var(--status-margin);
  243. border-left: 2px solid var(--border);
  244. }
  245. .thread-ancestor.-faded .RichContent {
  246. /* stylelint-disable declaration-no-important */
  247. --text: var(--textFaint) !important;
  248. --link: var(--linkFaint) !important;
  249. --funtextGreentext: var(--funtextGreentextFaint) !important;
  250. --funtextCyantext: var(--funtextCyantextFaint) !important;
  251. /* stylelint-enable declaration-no-important */
  252. }
  253. .thread-ancestor-dive-box {
  254. padding-left: var(--status-margin);
  255. border-bottom: 1px solid var(--border);
  256. border-radius: 0;
  257. /* Make the button stretch along the whole row */
  258. &,
  259. &-inner {
  260. display: flex;
  261. align-items: stretch;
  262. flex-direction: column;
  263. }
  264. }
  265. .thread-ancestor-dive-box-inner {
  266. padding: var(--status-margin);
  267. }
  268. .conversation-status {
  269. border-bottom: 1px solid var(--border);
  270. border-radius: 0;
  271. }
  272. .thread-ancestor-has-other-replies .conversation-status,
  273. &:last-child:not(.-expanded) .conversation-status,
  274. &.-expanded .conversation-status:last-child,
  275. .thread-ancestor:last-child .conversation-status,
  276. .thread-ancestor:last-child .thread-ancestor-dive-box,
  277. &.-expanded .thread-tree .conversation-status {
  278. border-bottom: none;
  279. }
  280. .thread-ancestors + .thread-tree > .conversation-status {
  281. border-top: 1px solid var(--border);
  282. }
  283. /* expanded conversation in timeline */
  284. &.status-fadein.-expanded .thread-body {
  285. border-left: 4px solid var(--cRed);
  286. border-radius: var(--roundness);
  287. border-top-left-radius: 0;
  288. border-top-right-radius: 0;
  289. border-bottom: 1px solid var(--border);
  290. }
  291. &.-expanded.status-fadein {
  292. --___margin: calc(var(--status-margin) / 2);
  293. background: var(--background);
  294. margin: var(--___margin);
  295. &::before {
  296. z-index: -1;
  297. content: "";
  298. display: block;
  299. position: absolute;
  300. top: calc(var(--___margin) * -1);
  301. bottom: calc(var(--___margin) * -1);
  302. left: calc(var(--___margin) * -1);
  303. right: calc(var(--___margin) * -1);
  304. background: var(--background);
  305. backdrop-filter: var(--__panel-backdrop-filter);
  306. }
  307. }
  308. }
  309. </style>