This commit is contained in:
syuilo 2024-10-04 19:09:46 +09:00
parent b36d13d90c
commit fa06c59eae

View file

@ -46,14 +46,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkFolder> <MkFolder>
<template #icon><i class="ti ti-list"></i></template> <template #icon><i class="ti ti-list"></i></template>
<template #label>{{ i18n.ts._profile.metadataEdit }}</template> <template #label>{{ i18n.ts._profile.metadataEdit }}</template>
<template #footer>
<div :class="$style.metadataRoot"> <div class="_buttons">
<div :class="$style.metadataMargin"> <MkButton primary @click="saveFields"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
<MkButton :disabled="fields.length >= 16" inline style="margin-right: 8px;" @click="addField"><i class="ti ti-plus"></i> {{ i18n.ts.add }}</MkButton> <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" inline danger style="margin-right: 8px;" @click="fieldEditMode = !fieldEditMode"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton> <MkButton v-if="!fieldEditMode" :disabled="fields.length <= 1" danger @click="fieldEditMode = !fieldEditMode"><i class="ti ti-trash"></i> {{ i18n.ts.delete }}</MkButton>
<MkButton v-else inline style="margin-right: 8px;" @click="fieldEditMode = !fieldEditMode"><i class="ti ti-arrows-sort"></i> {{ i18n.ts.rearrange }}</MkButton> <MkButton v-else @click="fieldEditMode = !fieldEditMode"><i class="ti ti-arrows-sort"></i> {{ i18n.ts.rearrange }}</MkButton>
<MkButton inline primary @click="saveFields"><i class="ti ti-check"></i> {{ i18n.ts.save }}</MkButton>
</div> </div>
</template>
<div :class="$style.metadataRoot" class="_gaps_s">
<MkInfo>{{ i18n.ts._profile.verifiedLinkDescription }}</MkInfo>
<Sortable <Sortable
v-model="fields" v-model="fields"
@ -65,24 +68,20 @@ SPDX-License-Identifier: AGPL-3.0-only
@end="e => e.item.classList.remove('active')" @end="e => e.item.classList.remove('active')"
> >
<template #item="{element, index}"> <template #item="{element, index}">
<div :class="$style.fieldDragItem"> <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" 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> <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"> <div :class="$style.dragItemForm">
<FormSplit :minWidth="200"> <FormSplit :minWidth="200">
<MkInput v-model="element.name" small> <MkInput v-model="element.name" small :placeholder="i18n.ts._profile.metadataLabel">
<template #label>{{ i18n.ts._profile.metadataLabel }}</template>
</MkInput> </MkInput>
<MkInput v-model="element.value" small> <MkInput v-model="element.value" small :placeholder="i18n.ts._profile.metadataContent">
<template #label>{{ i18n.ts._profile.metadataContent }}</template>
</MkInput> </MkInput>
</FormSplit> </FormSplit>
</div> </div>
</div> </div>
</template> </template>
</Sortable> </Sortable>
<MkInfo>{{ i18n.ts._profile.verifiedLinkDescription }}</MkInfo>
</div> </div>
</MkFolder> </MkFolder>
<template #caption>{{ i18n.ts._profile.metadataDescription }}</template> <template #caption>{{ i18n.ts._profile.metadataDescription }}</template>
@ -310,19 +309,11 @@ definePageMetadata(() => ({
container-type: inline-size; container-type: inline-size;
} }
.metadataMargin {
margin-bottom: 1.5em;
}
.fieldDragItem { .fieldDragItem {
display: flex; display: flex;
padding-bottom: .75em; padding: 10px;
align-items: flex-end; align-items: flex-end;
border-bottom: solid 0.5px var(--divider); border-radius: 6px;
&:last-child {
border-bottom: 0;
}
/* (drag button) 32px + (drag button margin) 8px + (input width) 200px * 2 + (input gap) 12px = 452px */ /* (drag button) 32px + (drag button margin) 8px + (input width) 200px * 2 + (input gap) 12px = 452px */
@container (max-width: 452px) { @container (max-width: 452px) {