34 lines
849 B
Vue
34 lines
849 B
Vue
<script setup lang="ts">
|
|
import { computed } from 'vue';
|
|
import { useInitials } from '@/composables/useInitials';
|
|
import type { User } from '@/types';
|
|
import UserAvatar from '@/components/ui/avatar/UserAvatar.vue';
|
|
|
|
type Props = {
|
|
user: User;
|
|
showEmail?: boolean;
|
|
};
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
showEmail: false,
|
|
});
|
|
|
|
const { getInitials } = useInitials();
|
|
|
|
// Compute whether we should show the avatar image
|
|
const showAvatar = computed(
|
|
() => props.user.avatar && props.user.avatar !== '',
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<UserAvatar />
|
|
|
|
<div class="grid flex-1 text-left text-sm leading-tight">
|
|
<span class="truncate font-medium">{{ user.name }}</span>
|
|
<span v-if="showEmail" class="text-muted-foreground truncate text-xs">{{
|
|
user.email
|
|
}}</span>
|
|
</div>
|
|
</template>
|