Files
econom/resources/js/components/UserInfo.vue
brusnitsyn fb2e6c58e3
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled
first commit
2026-04-06 00:06:00 +09:00

45 lines
1.2 KiB
Vue

<script setup lang="ts">
import { computed } from 'vue';
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { useInitials } from '@/composables/useInitials';
import type { Team, User } from '@/types';
type Props = {
user: User;
showEmail?: boolean;
team?: Team | null;
};
const props = withDefaults(defineProps<Props>(), {
showEmail: false,
team: null,
});
const { getInitials } = useInitials();
const showAvatar = computed(
() => props.user.avatar && props.user.avatar !== '',
);
</script>
<template>
<Avatar class="h-8 w-8 overflow-hidden rounded-lg">
<AvatarImage v-if="showAvatar" :src="user.avatar!" :alt="user.name" />
<AvatarFallback class="rounded-lg text-black dark:text-white">
{{ getInitials(user.name) }}
</AvatarFallback>
</Avatar>
<div class="grid flex-1 text-left text-sm leading-tight">
<span class="truncate font-medium">{{ user.name }}</span>
<span v-if="team" class="truncate text-xs text-muted-foreground">{{
team.name
}}</span>
<span
v-else-if="showEmail"
class="truncate text-xs text-muted-foreground"
>{{ user.email }}</span
>
</div>
</template>