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 (11050B)


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