diff --git a/client/omnichannel/directory/OmnichannelDirectoryPage.js b/client/omnichannel/directory/OmnichannelDirectoryPage.js index a51e58b1b3e0d..ca151c17e01b0 100644 --- a/client/omnichannel/directory/OmnichannelDirectoryPage.js +++ b/client/omnichannel/directory/OmnichannelDirectoryPage.js @@ -50,7 +50,7 @@ const OmnichannelDirectoryPage = () => { const ContactContextualBar = () => {context === 'new' && {t('New_Contact')}} - {context === 'info' && {t('Contact_Profile')}} + {context === 'info' && {t('Contact_Info')}} {context === 'edit' && {t('Edit_Contact_Profile')}} diff --git a/client/omnichannel/directory/chats/contextualBar/ChatInfo.js b/client/omnichannel/directory/chats/contextualBar/ChatInfo.js index c1c93a24e4a8b..75265702e4604 100644 --- a/client/omnichannel/directory/chats/contextualBar/ChatInfo.js +++ b/client/omnichannel/directory/chats/contextualBar/ChatInfo.js @@ -38,15 +38,30 @@ const DepartmentField = ({ departmentId }) => { const ContactField = ({ contact, room }) => { const t = useTranslation(); - const { username, status } = contact; + const { status } = contact; const { fname, t: type } = room; const avatarUrl = roomTypes.getConfig(type).getAvatarPath(room); + const { value: data, phase: state, error } = useEndpointData(`livechat/visitors.info?visitorId=${ contact._id }`); + + if (state === AsyncStatePhase.LOADING) { + return ; + } + + if (error || !data || !data.visitor) { + return {t('Contact_not_found')}; + } + + const { visitor: { username, name } } = data; + + const displayName = name || username; + return <> - } /> + } /> + {username && name && ({username})} ; }; @@ -60,13 +75,16 @@ const AgentField = ({ agent }) => { return ; } - const { user: { status } } = value || { user: { } }; + const { user: { name, status } } = value || { user: { } }; + + const displayName = name || username; return <> - } /> + } /> + {username && name && ({username})} ; }; diff --git a/client/omnichannel/directory/contacts/contextualBar/ContactInfo.js b/client/omnichannel/directory/contacts/contextualBar/ContactInfo.js index 8d9df80238976..27b39e4789a6d 100644 --- a/client/omnichannel/directory/contacts/contextualBar/ContactInfo.js +++ b/client/omnichannel/directory/contacts/contextualBar/ContactInfo.js @@ -14,6 +14,8 @@ import { hasPermission } from '../../../../../app/authorization'; import { useFormatDate } from '../../../../hooks/useFormatDate'; import { AsyncStatePhase } from '../../../../hooks/useAsyncState'; import { ContactManagerInfo } from '../../../../../ee/client/omnichannel/ContactManager'; +import UserAvatar from '../../../../components/avatar/UserAvatar'; +import { UserStatus } from '../../../../components/UserStatus'; const wordBreak = css` @@ -85,12 +87,18 @@ export function ContactInfo({ id }) { FlowRouter.go(`/live/${ _id }/contact-chat-history`); }; + const displayName = name || username; + return <> - {username && username !== name && <> + {displayName && <> - {`${ name }/${ username }`} + + + } /> + {username && name && ({username})} + } {visitorEmails && visitorEmails.length && <> diff --git a/client/omnichannel/directory/contacts/contextualBar/index.js b/client/omnichannel/directory/contacts/contextualBar/index.js index 3cff82c52a54a..36e21c970177f 100644 --- a/client/omnichannel/directory/contacts/contextualBar/index.js +++ b/client/omnichannel/directory/contacts/contextualBar/index.js @@ -21,7 +21,7 @@ const ContactsContextualBar = ({ id }) => { return <> - {t('Contact_Profile')} + {t('Contact_Info')} diff --git a/client/views/room/lib/Toolbox/defaultActions.ts b/client/views/room/lib/Toolbox/defaultActions.ts index b82a0fd0efece..966fc710dde06 100644 --- a/client/views/room/lib/Toolbox/defaultActions.ts +++ b/client/views/room/lib/Toolbox/defaultActions.ts @@ -26,7 +26,7 @@ addAction('user-info', { addAction('contact-profile', { groups: ['live'], id: 'contact-profile', - title: 'Contact_Profile', + title: 'Contact_Info', icon: 'user', template: lazy(() => import('../../../../omnichannel/directory/contacts/contextualBar')), order: 5, diff --git a/packages/rocketchat-i18n/i18n/en.i18n.json b/packages/rocketchat-i18n/i18n/en.i18n.json index 2f5c536139f69..be75d95e71873 100644 --- a/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/packages/rocketchat-i18n/i18n/en.i18n.json @@ -926,6 +926,7 @@ "Contact_Manager": "Contact Manager", "Contact_not_found": "Contact not found", "Contact_Profile": "Contact Profile", + "Contact_Info": "Contact Information", "Content": "Content", "Continue": "Continue", "Continuous_sound_notifications_for_new_livechat_room": "Continuous sound notifications for new omnichannel room", @@ -3371,7 +3372,7 @@ "Room_has_been_archived": "Room has been archived", "Room_has_been_deleted": "Room has been deleted", "Room_has_been_unarchived": "Room has been unarchived", - "Room_Info": "Room Info", + "Room_Info": "Room Information", "room_is_blocked": "This room is blocked", "room_is_read_only": "This room is read only", "room_name": "room name",