1
0
mirror of https://github.com/elk-zone/elk synced 2024-12-12 21:58:05 +09:00
elk/components/user/UserPicker.vue

47 lines
1.3 KiB
Vue
Raw Normal View History

<script setup lang="ts">
import type { UserLogin } from '~/types'
const all = useUsers()
const router = useRouter()
2023-01-15 17:38:02 +09:00
function clickUser(user: UserLogin) {
if (user.account.acct === currentUser.value?.account.acct)
router.push(getAccountRoute(user.account))
else
2023-01-15 17:38:02 +09:00
switchUser(user)
}
</script>
<template>
2022-12-28 05:07:19 +09:00
<div flex justify-start items-end px-2 gap-5>
<div flex="~ wrap-reverse" gap-5>
<template v-for="user of all" :key="user.id">
<CommonTooltip :distance="8" :delay="{ show: 300, hide: 100 }">
<button
flex rounded
cursor-pointer
:aria-label="$t('action.switch_account')"
:class="user.account.acct === currentUser?.account.acct ? '' : 'op25 grayscale'"
hover="filter-none op100"
2023-01-15 17:38:02 +09:00
@click="clickUser(user)"
>
<AccountAvatar w-13 h-13 :account="user.account" square />
</button>
<template #popper>
<div text-center>
<span text-4>
<AccountDisplayName :account="user.account" />
</span>
<AccountHandle :account="user.account" />
</div>
</template>
</CommonTooltip>
2022-12-28 05:07:19 +09:00
</template>
</div>
<div flex items-center justify-center w-13 h-13>
<UserDropdown />
</div>
</div>
</template>