2022-12-19 18:44:14 +03:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { UserLogin } from '~/types'
|
|
|
|
|
|
|
|
const all = useUsers()
|
|
|
|
const router = useRouter()
|
2023-01-15 11:38:02 +03:00
|
|
|
|
2023-03-30 22:01:24 +03:00
|
|
|
function clickUser(user: UserLogin) {
|
2023-01-29 18:58:32 +03:00
|
|
|
if (user.account.acct === currentUser.value?.account.acct)
|
2022-12-19 18:44:14 +03:00
|
|
|
router.push(getAccountRoute(user.account))
|
|
|
|
else
|
2023-01-15 11:38:02 +03:00
|
|
|
switchUser(user)
|
2022-12-19 18:44:14 +03:00
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2022-12-27 23:07:19 +03: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">
|
2023-01-12 08:39:39 +03:00
|
|
|
<CommonTooltip :distance="8" :delay="{ show: 300, hide: 100 }">
|
|
|
|
<button
|
|
|
|
flex rounded
|
|
|
|
cursor-pointer
|
|
|
|
aria-label="Switch user"
|
2023-01-29 18:58:32 +03:00
|
|
|
:class="user.account.acct === currentUser?.account.acct ? '' : 'op25 grayscale'"
|
2023-01-12 08:39:39 +03:00
|
|
|
hover="filter-none op100"
|
2023-01-15 11:38:02 +03:00
|
|
|
@click="clickUser(user)"
|
2023-01-12 08:39:39 +03:00
|
|
|
>
|
|
|
|
<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-27 23:07:19 +03:00
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
<div flex items-center justify-center w-13 h-13>
|
|
|
|
<UserDropdown />
|
|
|
|
</div>
|
2022-12-19 18:44:14 +03:00
|
|
|
</div>
|
|
|
|
</template>
|