logo

pleroma-fe

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

conversation.vue (10658B)


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