logo

pleroma-fe

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

profile_tab.vue (9950B)


  1. <template>
  2. <div class="profile-tab">
  3. <div class="setting-item">
  4. <h2>{{ $t('settings.name_bio') }}</h2>
  5. <p>{{ $t('settings.name') }}</p>
  6. <EmojiInput
  7. v-model="newName"
  8. enable-emoji-picker
  9. :suggest="emojiSuggestor"
  10. >
  11. <template #default="inputProps">
  12. <input
  13. id="username"
  14. v-model="newName"
  15. class="input name-changer"
  16. v-bind="propsToNative(inputProps)"
  17. >
  18. </template>
  19. </EmojiInput>
  20. <p>{{ $t('settings.bio') }}</p>
  21. <EmojiInput
  22. v-model="newBio"
  23. enable-emoji-picker
  24. :suggest="emojiUserSuggestor"
  25. >
  26. <template #default="inputProps">
  27. <textarea
  28. v-model="newBio"
  29. class="input bio resize-height"
  30. v-bind="propsToNative(inputProps)"
  31. />
  32. </template>
  33. </EmojiInput>
  34. <p v-if="role === 'admin' || role === 'moderator'">
  35. <Checkbox v-model="showRole">
  36. <template v-if="role === 'admin'">
  37. {{ $t('settings.show_admin_badge') }}
  38. </template>
  39. <template v-if="role === 'moderator'">
  40. {{ $t('settings.show_moderator_badge') }}
  41. </template>
  42. </Checkbox>
  43. </p>
  44. <div>
  45. <p>{{ $t('settings.birthday.label') }}</p>
  46. <input
  47. id="birthday"
  48. v-model="newBirthday"
  49. type="date"
  50. class="input birthday-input"
  51. >
  52. <Checkbox v-model="showBirthday">
  53. {{ $t('settings.birthday.show_birthday') }}
  54. </Checkbox>
  55. </div>
  56. <div v-if="maxFields > 0">
  57. <p>{{ $t('settings.profile_fields.label') }}</p>
  58. <div
  59. v-for="(_, i) in newFields"
  60. :key="i"
  61. class="profile-fields"
  62. >
  63. <EmojiInput
  64. v-model="newFields[i].name"
  65. enable-emoji-picker
  66. hide-emoji-button
  67. :suggest="userSuggestor"
  68. >
  69. <template #default="inputProps">
  70. <input
  71. v-model="newFields[i].name"
  72. :placeholder="$t('settings.profile_fields.name')"
  73. v-bind="propsToNative(inputProps)"
  74. class="input"
  75. >
  76. </template>
  77. </EmojiInput>
  78. <EmojiInput
  79. v-model="newFields[i].value"
  80. enable-emoji-picker
  81. hide-emoji-button
  82. :suggest="userSuggestor"
  83. >
  84. <template #default="inputProps">
  85. <input
  86. v-model="newFields[i].value"
  87. :placeholder="$t('settings.profile_fields.value')"
  88. v-bind="propsToNative(inputProps)"
  89. class="input"
  90. >
  91. </template>
  92. </EmojiInput>
  93. <button
  94. class="delete-field button-unstyled -hover-highlight"
  95. @click="deleteField(i)"
  96. >
  97. <!-- TODO something is wrong with v-show here -->
  98. <FAIcon
  99. v-if="newFields.length > 1"
  100. icon="times"
  101. />
  102. </button>
  103. </div>
  104. <button
  105. v-if="newFields.length < maxFields"
  106. class="add-field faint button-unstyled -hover-highlight"
  107. @click="addField"
  108. >
  109. <FAIcon icon="plus" />
  110. {{ $t("settings.profile_fields.add_field") }}
  111. </button>
  112. </div>
  113. <p>
  114. <label>
  115. {{ $t('settings.actor_type') }}
  116. <Select v-model="actorType">
  117. <option
  118. v-for="option in availableActorTypes"
  119. :key="option"
  120. :value="option"
  121. >
  122. {{ $t('settings.actor_type_' + option) }}
  123. </option>
  124. </Select>
  125. </label>
  126. </p>
  127. <div v-if="groupActorAvailable">
  128. <small>
  129. {{ $t('settings.actor_type_description') }}
  130. </small>
  131. </div>
  132. <p>
  133. <interface-language-switcher
  134. :prompt-text="$t('settings.email_language')"
  135. :language="emailLanguage"
  136. :set-language="val => emailLanguage = val"
  137. />
  138. </p>
  139. <button
  140. :disabled="newName && newName.length === 0"
  141. class="btn button-default"
  142. @click="updateProfile"
  143. >
  144. {{ $t('settings.save') }}
  145. </button>
  146. </div>
  147. <div class="setting-item">
  148. <h2>{{ $t('settings.avatar') }}</h2>
  149. <p class="visibility-notice">
  150. {{ $t('settings.avatar_size_instruction') }}
  151. </p>
  152. <div class="current-avatar-container">
  153. <img
  154. :src="user.profile_image_url_original"
  155. class="current-avatar"
  156. >
  157. <button
  158. v-if="!isDefaultAvatar && pickAvatarBtnVisible"
  159. :title="$t('settings.reset_avatar')"
  160. class="button-unstyled reset-button"
  161. @click="resetAvatar"
  162. >
  163. <FAIcon
  164. icon="times"
  165. type="button"
  166. />
  167. </button>
  168. </div>
  169. <p>{{ $t('settings.set_new_avatar') }}</p>
  170. <button
  171. v-show="pickAvatarBtnVisible"
  172. id="pick-avatar"
  173. class="button-default btn"
  174. type="button"
  175. >
  176. {{ $t('settings.upload_a_photo') }}
  177. </button>
  178. <image-cropper
  179. trigger="#pick-avatar"
  180. :submit-handler="submitAvatar"
  181. @open="pickAvatarBtnVisible=false"
  182. @close="pickAvatarBtnVisible=true"
  183. />
  184. </div>
  185. <div class="setting-item">
  186. <h2>{{ $t('settings.profile_banner') }}</h2>
  187. <div class="banner-background-preview">
  188. <img :src="user.cover_photo">
  189. <button
  190. v-if="!isDefaultBanner"
  191. class="button-unstyled reset-button"
  192. :title="$t('settings.reset_profile_banner')"
  193. @click="resetBanner"
  194. >
  195. <FAIcon
  196. icon="times"
  197. type="button"
  198. />
  199. </button>
  200. </div>
  201. <p>{{ $t('settings.set_new_profile_banner') }}</p>
  202. <img
  203. v-if="bannerPreview"
  204. class="banner-background-preview"
  205. :src="bannerPreview"
  206. >
  207. <div>
  208. <input
  209. type="file"
  210. class="input"
  211. @change="uploadFile('banner', $event)"
  212. >
  213. </div>
  214. <FAIcon
  215. v-if="bannerUploading"
  216. class="uploading"
  217. spin
  218. icon="circle-notch"
  219. />
  220. <button
  221. v-else-if="bannerPreview"
  222. class="btn button-default"
  223. @click="submitBanner(banner)"
  224. >
  225. {{ $t('settings.save') }}
  226. </button>
  227. </div>
  228. <div class="setting-item">
  229. <h2>{{ $t('settings.profile_background') }}</h2>
  230. <div class="banner-background-preview">
  231. <img :src="user.background_image">
  232. <button
  233. v-if="!isDefaultBackground"
  234. class="button-unstyled reset-button"
  235. :title="$t('settings.reset_profile_background')"
  236. @click="resetBackground"
  237. >
  238. <FAIcon
  239. icon="times"
  240. type="button"
  241. />
  242. </button>
  243. </div>
  244. <p>{{ $t('settings.set_new_profile_background') }}</p>
  245. <img
  246. v-if="backgroundPreview"
  247. class="banner-background-preview"
  248. :src="backgroundPreview"
  249. >
  250. <div>
  251. <input
  252. type="file"
  253. class="input"
  254. @change="uploadFile('background', $event)"
  255. >
  256. </div>
  257. <FAIcon
  258. v-if="backgroundUploading"
  259. class="uploading"
  260. spin
  261. icon="circle-notch"
  262. />
  263. <button
  264. v-else-if="backgroundPreview"
  265. class="btn button-default"
  266. @click="submitBackground(background)"
  267. >
  268. {{ $t('settings.save') }}
  269. </button>
  270. </div>
  271. <div class="setting-item">
  272. <h2>{{ $t('settings.account_privacy') }}</h2>
  273. <ul class="setting-list">
  274. <li>
  275. <BooleanSetting
  276. source="profile"
  277. path="locked"
  278. >
  279. {{ $t('settings.lock_account_description') }}
  280. </BooleanSetting>
  281. </li>
  282. <li>
  283. <BooleanSetting
  284. source="profile"
  285. path="discoverable"
  286. >
  287. {{ $t('settings.discoverable') }}
  288. </BooleanSetting>
  289. </li>
  290. <li>
  291. <BooleanSetting
  292. source="profile"
  293. path="allowFollowingMove"
  294. >
  295. {{ $t('settings.allow_following_move') }}
  296. </BooleanSetting>
  297. </li>
  298. <li>
  299. <BooleanSetting
  300. source="profile"
  301. path="hideFavorites"
  302. >
  303. {{ $t('settings.hide_favorites_description') }}
  304. </BooleanSetting>
  305. </li>
  306. <li>
  307. <BooleanSetting
  308. source="profile"
  309. path="hideFollowers"
  310. >
  311. {{ $t('settings.hide_followers_description') }}
  312. </BooleanSetting>
  313. <ul class="setting-list suboptions">
  314. <li>
  315. <BooleanSetting
  316. source="profile"
  317. path="hideFollowersCount"
  318. parent-path="hideFollowers"
  319. >
  320. {{ $t('settings.hide_followers_count_description') }}
  321. </BooleanSetting>
  322. </li>
  323. </ul>
  324. </li>
  325. <li>
  326. <BooleanSetting
  327. source="profile"
  328. path="hideFollows"
  329. >
  330. {{ $t('settings.hide_follows_description') }}
  331. </BooleanSetting>
  332. <ul class="setting-list suboptions">
  333. <li>
  334. <BooleanSetting
  335. source="profile"
  336. path="hideFollowsCount"
  337. parent-path="hideFollows"
  338. >
  339. {{ $t('settings.hide_follows_count_description') }}
  340. </BooleanSetting>
  341. </li>
  342. </ul>
  343. </li>
  344. </ul>
  345. </div>
  346. </div>
  347. </template>
  348. <script src="./profile_tab.js"></script>
  349. <style lang="scss" src="./profile_tab.scss"></style>