Update profile.vue

This commit is contained in:
syuilo 2025-02-22 21:03:41 +09:00
parent 4192d8b3c7
commit afc481d3db
1 changed files with 150 additions and 99 deletions

View File

@ -4,119 +4,170 @@ SPDX-License-Identifier: AGPL-3.0-only
--> -->
<template> <template>
<div class="_gaps_m"> <SearchMarker path="/settings/profile" :label="i18n.ts.profile" :keywords="['profile']" icon="ti ti-user">
<div class="_panel"> <div class="_gaps_m">
<div :class="$style.banner" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }"> <div class="_panel">
<MkButton primary rounded :class="$style.bannerEdit" @click="changeBanner">{{ i18n.ts._profile.changeBanner }}</MkButton> <div :class="$style.banner" :style="{ backgroundImage: $i.bannerUrl ? `url(${ $i.bannerUrl })` : null }">
</div> <MkButton primary rounded :class="$style.bannerEdit" @click="changeBanner">{{ i18n.ts._profile.changeBanner }}</MkButton>
<div :class="$style.avatarContainer"> </div>
<MkAvatar :class="$style.avatar" :user="$i" forceShowDecoration @click="changeAvatar"/> <div :class="$style.avatarContainer">
<div class="_buttonsCenter"> <MkAvatar :class="$style.avatar" :user="$i" forceShowDecoration @click="changeAvatar"/>
<MkButton primary rounded @click="changeAvatar">{{ i18n.ts._profile.changeAvatar }}</MkButton> <div class="_buttonsCenter">
<MkButton primary rounded link to="/settings/avatar-decoration">{{ i18n.ts.decorate }} <i class="ti ti-sparkles"></i></MkButton> <MkButton primary rounded @click="changeAvatar">{{ i18n.ts._profile.changeAvatar }}</MkButton>
<MkButton primary rounded link to="/settings/avatar-decoration">{{ i18n.ts.decorate }} <i class="ti ti-sparkles"></i></MkButton>
</div>
</div> </div>
</div> </div>
</div>
<SearchMarker> <SearchMarker
<MkInput v-model="profile.name" :max="30" manualSave :mfmAutocomplete="['emoji']"> :label="i18n.ts._profile.name"
<template #label>{{ i18n.ts._profile.name }}</template> :keywords="['name']"
</MkInput> >
</SearchMarker> <MkInput v-model="profile.name" :max="30" manualSave :mfmAutocomplete="['emoji']">
<template #label>{{ i18n.ts._profile.name }}</template>
</MkInput>
</SearchMarker>
<SearchMarker> <SearchMarker
<MkTextarea v-model="profile.description" :max="500" tall manualSave mfmAutocomplete :mfmPreview="true"> :label="i18n.ts._profile.description"
<template #label>{{ i18n.ts._profile.description }}</template> :keywords="['description', 'bio']"
<template #caption>{{ i18n.ts._profile.youCanIncludeHashtags }}</template> >
</MkTextarea> <MkTextarea v-model="profile.description" :max="500" tall manualSave mfmAutocomplete :mfmPreview="true">
</SearchMarker> <template #label>{{ i18n.ts._profile.description }}</template>
<template #caption>{{ i18n.ts._profile.youCanIncludeHashtags }}</template>
</MkTextarea>
</SearchMarker>
<MkInput v-model="profile.location" manualSave> <SearchMarker
<template #label>{{ i18n.ts.location }}</template> :label="i18n.ts.location"
<template #prefix><i class="ti ti-map-pin"></i></template> :keywords="['location', 'locale']"
</MkInput> >
<MkInput v-model="profile.location" manualSave>
<template #label>{{ i18n.ts.location }}</template>
<template #prefix><i class="ti ti-map-pin"></i></template>
</MkInput>
</SearchMarker>
<MkInput v-model="profile.birthday" type="date" manualSave> <SearchMarker
<template #label>{{ i18n.ts.birthday }}</template> :label="i18n.ts.birthday"
<template #prefix><i class="ti ti-cake"></i></template> :keywords="['birthday', 'birthdate', 'age']"
</MkInput> >
<MkInput v-model="profile.birthday" type="date" manualSave>
<template #label>{{ i18n.ts.birthday }}</template>
<template #prefix><i class="ti ti-cake"></i></template>
</MkInput>
</SearchMarker>
<MkSelect v-model="profile.lang"> <SearchMarker
<template #label>{{ i18n.ts.language }}</template> :label="i18n.ts.language"
<option v-for="x in Object.keys(langmap)" :key="x" :value="x">{{ langmap[x].nativeName }}</option> :keywords="['language', 'locale']"
</MkSelect> >
<MkSelect v-model="profile.lang">
<template #label>{{ i18n.ts.language }}</template>
<option v-for="x in Object.keys(langmap)" :key="x" :value="x">{{ langmap[x].nativeName }}</option>
</MkSelect>
</SearchMarker>
<FormSlot> <SearchMarker
<MkFolder> :label="i18n.ts._profile.metadataEdit"
<template #icon><i class="ti ti-list"></i></template> :keywords="['metadata']"
<template #label>{{ i18n.ts._profile.metadataEdit }}</template> >
<template #footer> <FormSlot>
<div class="_buttons"> <MkFolder>
<MkButton primary @click="saveFields"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton> <template #icon><i class="ti ti-list"></i></template>
<MkButton :disabled="fields.length >= 16" @click="addField"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton> <template #label>{{ i18n.ts._profile.metadataEdit }}</template>
<MkButton v-if="!fieldEditMode" :disabled="fields.length <= 1" danger @click="fieldEditMode = !fieldEditMode"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton> <template #footer>
<MkButton v-else @click="fieldEditMode = !fieldEditMode"><i class="ti ti-arrows-sort"></i> {{ i18n.ts.rearrange }}</MkButton> <div class="_buttons">
</div> <MkButton primary @click="saveFields"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
</template> <MkButton :disabled="fields.length >= 16" @click="addField"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton>
<MkButton v-if="!fieldEditMode" :disabled="fields.length <= 1" danger @click="fieldEditMode = !fieldEditMode"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
<div :class="$style.metadataRoot" class="_gaps_s"> <MkButton v-else @click="fieldEditMode = !fieldEditMode"><i class="ti ti-arrows-sort"></i> {{ i18n.ts.rearrange }}</MkButton>
<MkInfo>{{ i18n.ts._profile.verifiedLinkDescription }}</MkInfo>
<Sortable
v-model="fields"
class="_gaps_s"
itemKey="id"
:animation="150"
:handle="'.' + $style.dragItemHandle"
@start="e => e.item.classList.add('active')"
@end="e => e.item.classList.remove('active')"
>
<template #item="{element, index}">
<div v-panel :class="$style.fieldDragItem">
<button v-if="!fieldEditMode" class="_button" :class="$style.dragItemHandle" tabindex="-1"><i class="ti ti-menu"></i></button>
<button v-if="fieldEditMode" :disabled="fields.length <= 1" class="_button" :class="$style.dragItemRemove" @click="deleteField(index)"><i class="ti ti-x"></i></button>
<div :class="$style.dragItemForm">
<FormSplit :minWidth="200">
<MkInput v-model="element.name" small :placeholder="i18n.ts._profile.metadataLabel">
</MkInput>
<MkInput v-model="element.value" small :placeholder="i18n.ts._profile.metadataContent">
</MkInput>
</FormSplit>
</div>
</div> </div>
</template> </template>
</Sortable>
</div>
</MkFolder>
<template #caption>{{ i18n.ts._profile.metadataDescription }}</template>
</FormSlot>
<MkInput v-model="profile.followedMessage" :max="200" manualSave :mfmPreview="false"> <div :class="$style.metadataRoot" class="_gaps_s">
<template #label>{{ i18n.ts._profile.followedMessage }}<span class="_beta">{{ i18n.ts.beta }}</span></template> <MkInfo>{{ i18n.ts._profile.verifiedLinkDescription }}</MkInfo>
<template #caption>
<div>{{ i18n.ts._profile.followedMessageDescription }}</div>
<div>{{ i18n.ts._profile.followedMessageDescriptionForLockedAccount }}</div>
</template>
</MkInput>
<MkSelect v-model="reactionAcceptance"> <Sortable
<template #label>{{ i18n.ts.reactionAcceptance }}</template> v-model="fields"
<option :value="null">{{ i18n.ts.all }}</option> class="_gaps_s"
<option value="likeOnlyForRemote">{{ i18n.ts.likeOnlyForRemote }}</option> itemKey="id"
<option value="nonSensitiveOnly">{{ i18n.ts.nonSensitiveOnly }}</option> :animation="150"
<option value="nonSensitiveOnlyForLocalLikeOnlyForRemote">{{ i18n.ts.nonSensitiveOnlyForLocalLikeOnlyForRemote }}</option> :handle="'.' + $style.dragItemHandle"
<option value="likeOnly">{{ i18n.ts.likeOnly }}</option> @start="e => e.item.classList.add('active')"
</MkSelect> @end="e => e.item.classList.remove('active')"
>
<template #item="{element, index}">
<div v-panel :class="$style.fieldDragItem">
<button v-if="!fieldEditMode" class="_button" :class="$style.dragItemHandle" tabindex="-1"><i class="ti ti-menu"></i></button>
<button v-if="fieldEditMode" :disabled="fields.length <= 1" class="_button" :class="$style.dragItemRemove" @click="deleteField(index)"><i class="ti ti-x"></i></button>
<div :class="$style.dragItemForm">
<FormSplit :minWidth="200">
<MkInput v-model="element.name" small :placeholder="i18n.ts._profile.metadataLabel">
</MkInput>
<MkInput v-model="element.value" small :placeholder="i18n.ts._profile.metadataContent">
</MkInput>
</FormSplit>
</div>
</div>
</template>
</Sortable>
</div>
</MkFolder>
<template #caption>{{ i18n.ts._profile.metadataDescription }}</template>
</FormSlot>
</SearchMarker>
<MkFolder> <SearchMarker
<template #label>{{ i18n.ts.advancedSettings }}</template> :label="i18n.ts._profile.followedMessage"
:keywords="['follow', 'message', i18n.ts._profile.followedMessageDescription]"
>
<MkInput v-model="profile.followedMessage" :max="200" manualSave :mfmPreview="false">
<template #label>{{ i18n.ts._profile.followedMessage }}<span class="_beta">{{ i18n.ts.beta }}</span></template>
<template #caption>
<div>{{ i18n.ts._profile.followedMessageDescription }}</div>
<div>{{ i18n.ts._profile.followedMessageDescriptionForLockedAccount }}</div>
</template>
</MkInput>
</SearchMarker>
<div class="_gaps_m"> <SearchMarker
<MkSwitch v-model="profile.isCat">{{ i18n.ts.flagAsCat }}<template #caption>{{ i18n.ts.flagAsCatDescription }}</template></MkSwitch> :label="i18n.ts.reactionAcceptance"
<MkSwitch v-model="profile.isBot">{{ i18n.ts.flagAsBot }}<template #caption>{{ i18n.ts.flagAsBotDescription }}</template></MkSwitch> :keywords="['reaction']"
</div> >
</MkFolder> <MkSelect v-model="reactionAcceptance">
</div> <template #label>{{ i18n.ts.reactionAcceptance }}</template>
<option :value="null">{{ i18n.ts.all }}</option>
<option value="likeOnlyForRemote">{{ i18n.ts.likeOnlyForRemote }}</option>
<option value="nonSensitiveOnly">{{ i18n.ts.nonSensitiveOnly }}</option>
<option value="nonSensitiveOnlyForLocalLikeOnlyForRemote">{{ i18n.ts.nonSensitiveOnlyForLocalLikeOnlyForRemote }}</option>
<option value="likeOnly">{{ i18n.ts.likeOnly }}</option>
</MkSelect>
</SearchMarker>
<SearchMarker :label="i18n.ts.advancedSettings">
<MkFolder>
<template #label>{{ i18n.ts.advancedSettings }}</template>
<div class="_gaps_m">
<SearchMarker
:label="i18n.ts.flagAsCat"
:keywords="['cat', i18n.ts.flagAsCatDescription]"
>
<MkSwitch v-model="profile.isCat">{{ i18n.ts.flagAsCat }}<template #caption>{{ i18n.ts.flagAsCatDescription }}</template></MkSwitch>
</SearchMarker>
<SearchMarker
:label="i18n.ts.flagAsBot"
:keywords="['bot', i18n.ts.flagAsBotDescription]"
>
<MkSwitch v-model="profile.isBot">{{ i18n.ts.flagAsBot }}<template #caption>{{ i18n.ts.flagAsBotDescription }}</template></MkSwitch>
</SearchMarker>
</div>
</MkFolder>
</SearchMarker>
</div>
</SearchMarker>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>