akkoma-fe/src/components/settings_modal/tabs/profile_tab.vue

260 lines
6.8 KiB
Vue
Raw Normal View History

2020-05-03 14:36:12 +00:00
<template>
2020-05-25 00:43:55 +00:00
<div class="profile-tab">
<div class="setting-item">
<h2>{{ $t('settings.name_bio') }}</h2>
<p>{{ $t('settings.name') }}</p>
<EmojiInput
2020-05-03 14:36:12 +00:00
v-model="newName"
2020-05-25 00:43:55 +00:00
enable-emoji-picker
:suggest="emojiSuggestor"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
<input
id="username"
v-model="newName"
classname="name-changer"
>
</EmojiInput>
<p>{{ $t('settings.bio') }}</p>
<EmojiInput
2020-05-03 14:36:12 +00:00
v-model="newBio"
2020-05-25 00:43:55 +00:00
enable-emoji-picker
:suggest="emojiUserSuggestor"
>
<textarea
v-model="newBio"
classname="bio"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
</EmojiInput>
<p>
<Checkbox v-model="newLocked">
{{ $t('settings.lock_account_description') }}
</Checkbox>
</p>
<div>
<label for="default-vis">{{ $t('settings.default_vis') }}</label>
<div
id="default-vis"
class="visibility-tray"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
<scope-selector
:show-all="true"
:user-default="newDefaultScope"
:initial-scope="newDefaultScope"
:on-scope-change="changeVis"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
</div>
2020-05-03 14:36:12 +00:00
</div>
2020-05-25 00:43:55 +00:00
<p>
<Checkbox v-model="newNoRichText">
{{ $t('settings.no_rich_text_description') }}
</Checkbox>
</p>
<p>
<Checkbox v-model="hideFollows">
{{ $t('settings.hide_follows_description') }}
</Checkbox>
</p>
<p class="setting-subitem">
<Checkbox
v-model="hideFollowsCount"
:disabled="!hideFollows"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
{{ $t('settings.hide_follows_count_description') }}
</Checkbox>
</p>
<p>
<Checkbox v-model="hideFollowers">
{{ $t('settings.hide_followers_description') }}
</Checkbox>
</p>
<p class="setting-subitem">
<Checkbox
v-model="hideFollowersCount"
:disabled="!hideFollowers"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
{{ $t('settings.hide_followers_count_description') }}
</Checkbox>
</p>
<p>
<Checkbox v-model="allowFollowingMove">
{{ $t('settings.allow_following_move') }}
</Checkbox>
</p>
<p v-if="role === 'admin' || role === 'moderator'">
<Checkbox v-model="showRole">
<template v-if="role === 'admin'">
{{ $t('settings.show_admin_badge') }}
</template>
<template v-if="role === 'moderator'">
{{ $t('settings.show_moderator_badge') }}
</template>
</Checkbox>
</p>
<p>
<Checkbox v-model="discoverable">
{{ $t('settings.discoverable') }}
</Checkbox>
</p>
2020-06-09 18:24:55 +00:00
<div v-if="maxFields > 0">
<p>{{ $t('settings.profile_fields.label') }}</p>
<div
v-for="(_, i) in newFields"
:key="i"
class="profile-fields"
>
<EmojiInput
v-model="newFields[i].name"
:suggest="emojiSuggestor"
hide-emoji-button
>
<input
v-model="newFields[i].name"
:placeholder="$t('settings.profile_fields.name')"
>
</EmojiInput>
<EmojiInput
v-model="newFields[i].value"
:suggest="emojiSuggestor"
hide-emoji-button
>
<input
v-model="newFields[i].value"
:placeholder="$t('settings.profile_fields.value')"
>
</EmojiInput>
<div
class="icon-container"
>
<i
v-show="newFields.length > 1"
class="icon-cancel"
@click="deleteField(i)"
/>
</div>
</div>
<a
v-if="newFields.length < maxFields"
class="add-field faint"
@click="addField"
>
<i class="icon-plus" />
{{ $t("settings.profile_fields.add_field") }}
</a>
</div>
2020-05-25 00:43:55 +00:00
<button
:disabled="newName && newName.length === 0"
class="btn btn-default"
@click="updateProfile"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
{{ $t('general.submit') }}
</button>
</div>
<div class="setting-item">
<h2>{{ $t('settings.avatar') }}</h2>
<p class="visibility-notice">
{{ $t('settings.avatar_size_instruction') }}
</p>
<p>{{ $t('settings.current_avatar') }}</p>
<img
:src="user.profile_image_url_original"
class="current-avatar"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
<p>{{ $t('settings.set_new_avatar') }}</p>
<button
v-show="pickAvatarBtnVisible"
id="pick-avatar"
class="btn"
type="button"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
{{ $t('settings.upload_a_photo') }}
</button>
<image-cropper
trigger="#pick-avatar"
:submit-handler="submitAvatar"
@open="pickAvatarBtnVisible=false"
@close="pickAvatarBtnVisible=true"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
</div>
<div class="setting-item">
<h2>{{ $t('settings.profile_banner') }}</h2>
<p>{{ $t('settings.current_profile_banner') }}</p>
<img
:src="user.cover_photo"
class="banner"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
<p>{{ $t('settings.set_new_profile_banner') }}</p>
<img
v-if="bannerPreview"
class="banner"
:src="bannerPreview"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
<div>
<input
type="file"
@change="uploadFile('banner', $event)"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
</div>
<i
v-if="bannerUploading"
class=" icon-spin4 animate-spin uploading"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
<button
v-else-if="bannerPreview"
class="btn btn-default"
@click="submitBanner"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
{{ $t('general.submit') }}
</button>
<div
v-if="bannerUploadError"
class="alert error"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
Error: {{ bannerUploadError }}
<i
class="button-icon icon-cancel"
@click="clearUploadError('banner')"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
</div>
2020-05-03 14:36:12 +00:00
</div>
2020-05-25 00:43:55 +00:00
<div class="setting-item">
<h2>{{ $t('settings.profile_background') }}</h2>
<p>{{ $t('settings.set_new_profile_background') }}</p>
<img
v-if="backgroundPreview"
class="bg"
:src="backgroundPreview"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
<div>
<input
type="file"
@change="uploadFile('background', $event)"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
</div>
<i
v-if="backgroundUploading"
class=" icon-spin4 animate-spin uploading"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
<button
v-else-if="backgroundPreview"
class="btn btn-default"
@click="submitBg"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
{{ $t('general.submit') }}
</button>
<div
v-if="backgroundUploadError"
class="alert error"
2020-05-03 14:36:12 +00:00
>
2020-05-25 00:43:55 +00:00
Error: {{ backgroundUploadError }}
<i
class="button-icon icon-cancel"
@click="clearUploadError('background')"
2020-05-03 14:36:12 +00:00
/>
2020-05-25 00:43:55 +00:00
</div>
2020-05-03 14:36:12 +00:00
</div>
</div>
</template>
<script src="./profile_tab.js"></script>
<style lang="scss" src="./profile_tab.scss"></style>