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