Skip to content

Commit

Permalink
feat(detailsTooltip): add image to the side
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo014 committed Oct 1, 2024
1 parent aa61335 commit 970166d
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 22 deletions.
4 changes: 3 additions & 1 deletion src/components/chat/Chat.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
:custom-size="{ width: '40px', height: '40px' }"
inner-classes="shadow"
/>
<UserDetailsTooltip :user="user.id" :user-object="user" />
<UserDetailsTooltip :user="user.id" :user-object="user">
<div>test</div>
</UserDetailsTooltip>
<div v-if="mobileOnlineUsers.includes(user.id)">
<font-awesome-icon
icon="mobile-screen"
Expand Down
64 changes: 43 additions & 21 deletions src/components/user/DetailsTooltip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,45 @@
<slot
/></base-text>
<template #popper>
<div class="tooltip-content p-2">
<div v-if="userItem" class="text-base">
{{ `${userItem.first_name} ${userItem.last_name}` }}
<div class="flex">
<div v-if="userItem" class="flex items-center justify-center">
<Avatar
:initials="userItem.first_name"
:url="
userItem.profilePictureUrl
? userItem.profilePictureUrl
: getUserAvatarLink(userItem.first_name)
"
:custom-size="{ width: '40px', height: '40px' }"
inner-classes="shadow"
/>
</div>
<div
v-if="userItem"
class="text-xs"
data-testid="testUserOrganizationDiv"
>
{{ userItem.organization.name }}
</div>
<div v-if="userItem" class="mt-2" data-testid="testUserEmailDiv">
<font-awesome-icon icon="envelope" :alt="$t('actions.email')" />
<a :href="`mailto:${userItem.email}`" class="ml-1">{{
userItem.email
}}</a>
</div>
<div v-if="userItem && userItem.mobile" data-testid="testUserMobileDiv">
<font-awesome-icon icon="phone" :alt="$t('actions.call')" />
<a :href="`tel:${userItem.mobile}`" class="ml-1">{{
userItem.mobile
}}</a>
<div class="tooltip-content p-2">
<div v-if="userItem" class="text-base">
{{ `${userItem.first_name} ${userItem.last_name}` }}
</div>
<div
v-if="userItem"
class="text-xs"
data-testid="testUserOrganizationDiv"
>
{{ userItem.organization.name }}
</div>
<div v-if="userItem" class="mt-2" data-testid="testUserEmailDiv">
<font-awesome-icon icon="envelope" :alt="$t('actions.email')" />
<a :href="`mailto:${userItem.email}`" class="ml-1">{{
userItem.email
}}</a>
</div>
<div
v-if="userItem && userItem.mobile"
data-testid="testUserMobileDiv"
>
<font-awesome-icon icon="phone" :alt="$t('actions.call')" />
<a :href="`tel:${userItem.mobile}`" class="ml-1">{{
userItem.mobile
}}</a>
</div>
</div>
</div>
</template>
Expand All @@ -45,9 +62,12 @@
<script lang="ts">
import { computed, onMounted, ref } from 'vue';
import User from '../../models/User';
import { getUserAvatarLink } from '../../utils/urls';
import Avatar from '@/components/Avatar.vue';
export default defineComponent({
name: 'UserDetailsTooltip',
components: { Avatar },
props: {
user: {
type: Number,
Expand Down Expand Up @@ -83,6 +103,8 @@ export default defineComponent({
return {
asyncUser,
userItem,
getUserAvatarLink,
Avatar,
};
},
});
Expand Down

0 comments on commit 970166d

Please sign in to comment.