logo

pleroma-fe

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

user_profile.vue (5796B)


  1. <template>
  2. <div>
  3. <div
  4. v-if="user"
  5. class="user-profile panel panel-default"
  6. >
  7. <div class="panel-body">
  8. <UserCard
  9. :user-id="userId"
  10. :switcher="true"
  11. :selected="timeline.viewing"
  12. avatar-action="zoom"
  13. rounded="top"
  14. :has-note-editor="true"
  15. />
  16. <span
  17. v-if="!!user.birthday"
  18. class="user-birthday"
  19. >
  20. <FAIcon
  21. class="fa-old-padding"
  22. icon="birthday-cake"
  23. />
  24. {{ $t('user_card.birthday', { birthday: formattedBirthday }) }}
  25. </span>
  26. <div
  27. v-if="user.fields_html && user.fields_html.length > 0"
  28. class="user-profile-fields"
  29. >
  30. <dl
  31. v-for="(field, index) in user.fields_html"
  32. :key="index"
  33. class="user-profile-field"
  34. >
  35. <dt
  36. :title="user.fields_text[index].name"
  37. class="user-profile-field-name"
  38. >
  39. <RichContent
  40. :html="field.name"
  41. :emoji="user.emoji"
  42. />
  43. </dt>
  44. <dd
  45. :title="user.fields_text[index].value"
  46. class="user-profile-field-value"
  47. >
  48. <RichContent
  49. :html="field.value"
  50. :emoji="user.emoji"
  51. />
  52. </dd>
  53. </dl>
  54. </div>
  55. </div>
  56. <tab-switcher
  57. :active-tab="tab"
  58. :render-only-focused="true"
  59. :on-switch="onTabSwitch"
  60. >
  61. <Timeline
  62. key="statuses"
  63. :label="$t('user_card.statuses')"
  64. :count="user.statuses_count"
  65. :embedded="true"
  66. :title="$t('user_profile.timeline_title')"
  67. :timeline="timeline"
  68. timeline-name="user"
  69. :user-id="userId"
  70. :pinned-status-ids="user.pinnedStatusIds"
  71. :in-profile="true"
  72. :footer-slipgate="footerRef"
  73. />
  74. <div
  75. v-if="followsTabVisible"
  76. key="followees"
  77. class="panel-body"
  78. :label="$t('user_card.followees')"
  79. :disabled="!user.friends_count"
  80. >
  81. <FriendList
  82. :user-id="userId"
  83. :non-interactive="true"
  84. >
  85. <template #item="{item}">
  86. <FollowCard :user="item" />
  87. </template>
  88. </FriendList>
  89. </div>
  90. <div
  91. v-if="followersTabVisible"
  92. key="followers"
  93. class="panel-body"
  94. :label="$t('user_card.followers')"
  95. :disabled="!user.followers_count"
  96. >
  97. <FollowerList
  98. :user-id="userId"
  99. :non-interactive="true"
  100. >
  101. <template #item="{item}">
  102. <FollowCard
  103. :user="item"
  104. :no-follows-you="isUs"
  105. />
  106. </template>
  107. </FollowerList>
  108. </div>
  109. <Timeline
  110. key="media"
  111. :label="$t('user_card.media')"
  112. :disabled="!media.visibleStatuses.length"
  113. :embedded="true"
  114. :title="$t('user_card.media')"
  115. timeline-name="media"
  116. :timeline="media"
  117. :user-id="userId"
  118. :in-profile="true"
  119. :footer-slipgate="footerRef"
  120. />
  121. <Timeline
  122. v-if="favoritesTabVisible"
  123. key="favorites"
  124. :label="$t('user_card.favorites')"
  125. :disabled="!favorites.visibleStatuses.length"
  126. :embedded="true"
  127. :title="$t('user_card.favorites')"
  128. timeline-name="favorites"
  129. :timeline="favorites"
  130. :user-id="isUs ? undefined : userId"
  131. :in-profile="true"
  132. :footer-slipgate="footerRef"
  133. />
  134. </tab-switcher>
  135. <div
  136. :ref="setFooterRef"
  137. class="panel-footer"
  138. />
  139. </div>
  140. <div
  141. v-else
  142. class="panel user-profile-placeholder"
  143. >
  144. <div class="panel-heading">
  145. <div class="title">
  146. {{ $t('settings.profile_tab') }}
  147. </div>
  148. </div>
  149. <div>
  150. <span v-if="error">{{ error }}</span>
  151. <FAIcon
  152. v-else
  153. spin
  154. icon="circle-notch"
  155. />
  156. </div>
  157. </div>
  158. </div>
  159. </template>
  160. <script src="./user_profile.js"></script>
  161. <style lang="scss">
  162. .user-profile {
  163. flex: 2;
  164. flex-basis: 500px;
  165. // No sticky header on user profile
  166. --currentPanelStack: 1;
  167. .user-birthday {
  168. margin: 0 0.75em 0.5em;
  169. }
  170. .user-profile-fields {
  171. margin: 0 0.5em;
  172. img {
  173. object-fit: contain;
  174. vertical-align: middle;
  175. max-width: 100%;
  176. max-height: 400px;
  177. &.emoji {
  178. width: 18px;
  179. height: 18px;
  180. }
  181. }
  182. .user-profile-field {
  183. display: flex;
  184. margin: 0.25em;
  185. border: 1px solid var(--border);
  186. border-radius: var(--roundness);
  187. .user-profile-field-name {
  188. flex: 0 1 30%;
  189. font-weight: 500;
  190. text-align: right;
  191. color: var(--lightText);
  192. min-width: 120px;
  193. border-right: 1px solid var(--border);
  194. }
  195. .user-profile-field-value {
  196. flex: 1 1 70%;
  197. color: var(--text);
  198. margin: 0 0 0 0.25em;
  199. }
  200. .user-profile-field-name,
  201. .user-profile-field-value {
  202. line-height: 1.3;
  203. text-overflow: ellipsis;
  204. white-space: nowrap;
  205. overflow: hidden;
  206. padding: 0.5em 1.5em;
  207. box-sizing: border-box;
  208. }
  209. }
  210. }
  211. .userlist-placeholder {
  212. display: flex;
  213. justify-content: center;
  214. align-items: middle;
  215. padding: 2em;
  216. }
  217. }
  218. .user-profile-placeholder {
  219. .panel-body {
  220. display: flex;
  221. justify-content: center;
  222. align-items: middle;
  223. padding: 7em;
  224. }
  225. }
  226. </style>