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 7, 2024
1 parent d2427e7 commit 8dbc3e9
Show file tree
Hide file tree
Showing 2 changed files with 49 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
67 changes: 46 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,10 +62,16 @@
<script lang="ts">
import { computed, onMounted, ref } from 'vue';
import User from '../../models/User';
<<<<<<< HEAD
import { DbService, USER_DATABASE } from '@/services/db.service';
=======
import { getUserAvatarLink } from '../../utils/urls';
import Avatar from '@/components/Avatar.vue';
>>>>>>> feat(detailsTooltip): add image to the side
export default defineComponent({
name: 'UserDetailsTooltip',
components: { Avatar },
props: {
user: {
type: Number,
Expand Down Expand Up @@ -102,6 +125,8 @@ export default defineComponent({
return {
asyncUser,
userItem,
getUserAvatarLink,
Avatar,
};
},
});
Expand Down

0 comments on commit 8dbc3e9

Please sign in to comment.