2023-01-02 15:00:11 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { UpdateCredentialsParams } from 'masto'
|
|
|
|
|
|
|
|
const { form } = defineModel<{
|
|
|
|
form: {
|
|
|
|
fieldsAttributes: NonNullable<UpdateCredentialsParams['fieldsAttributes']>
|
|
|
|
}
|
|
|
|
}>()
|
2023-01-02 21:09:15 +00:00
|
|
|
const dropdown = $ref<any>()
|
2023-01-02 15:00:11 +00:00
|
|
|
|
|
|
|
const fieldIcons = computed(() =>
|
|
|
|
Array.from({ length: 4 }, (_, i) =>
|
|
|
|
getAccountFieldIcon(form.value.fieldsAttributes[i].name),
|
|
|
|
),
|
|
|
|
)
|
2023-01-02 21:09:15 +00:00
|
|
|
|
|
|
|
const chooseIcon = (i: number, text: string) => {
|
|
|
|
form.value.fieldsAttributes[i].name = text
|
|
|
|
dropdown[i]?.hide()
|
|
|
|
}
|
2023-01-02 15:00:11 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div flex="~ col gap4">
|
|
|
|
<div v-for="i in 4" :key="i" flex="~ gap3" items-center>
|
2023-01-02 21:09:15 +00:00
|
|
|
<CommonDropdown ref="dropdown" placement="left">
|
2023-01-02 15:00:11 +00:00
|
|
|
<CommonTooltip content="Pick a icon">
|
2023-01-03 10:13:48 +00:00
|
|
|
<button type="button" btn-action-icon>
|
2023-01-02 15:00:11 +00:00
|
|
|
<div :class="fieldIcons[i - 1] || 'i-ri:question-mark'" />
|
|
|
|
</button>
|
|
|
|
</CommonTooltip>
|
|
|
|
<template #popper>
|
|
|
|
<div flex="~ wrap gap-1" max-w-50 m2>
|
|
|
|
<CommonTooltip
|
|
|
|
v-for="(icon, text) in accountFieldIcons"
|
|
|
|
:key="icon"
|
|
|
|
:content="text"
|
|
|
|
>
|
|
|
|
<template v-if="text !== 'Joined'">
|
2023-01-03 10:13:48 +00:00
|
|
|
<button type="button" btn-action-icon @click="chooseIcon(i - 1, text)">
|
2023-01-02 15:00:11 +00:00
|
|
|
<div text-xl :class="icon" />
|
2023-01-03 10:13:48 +00:00
|
|
|
</button>
|
2023-01-02 15:00:11 +00:00
|
|
|
</template>
|
|
|
|
</CommonTooltip>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</CommonDropdown>
|
|
|
|
<input
|
|
|
|
v-model="form.fieldsAttributes[i - 1].name"
|
2023-01-04 10:47:19 +00:00
|
|
|
type="text" placeholder="Label"
|
|
|
|
input-base
|
2023-01-02 15:00:11 +00:00
|
|
|
>
|
|
|
|
<input
|
|
|
|
v-model="form.fieldsAttributes[i - 1].value"
|
2023-01-04 10:47:19 +00:00
|
|
|
type="text" placeholder="Content"
|
|
|
|
input-base
|
2023-01-02 15:00:11 +00:00
|
|
|
>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|