Skip to content

Commit

Permalink
Merge pull request #131 from iceljc/features/refine-chat-window
Browse files Browse the repository at this point in the history
use full name
  • Loading branch information
Oceania2018 authored May 15, 2024
2 parents e11bd8f + 947ab68 commit 64d82bc
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/lib/scss/custom/pages/_chat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
flex: 2%;
}

.log-content {
.log-body {
flex: 96%
}

Expand Down
1 change: 1 addition & 0 deletions src/lib/services/api-endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const endpoints = {
conversationDeletionUrl: `${host}/conversation/{conversationId}`,
conversationDetailUrl: `${host}/conversation/{conversationId}`,
conversationAttachmentUrl: `${host}/conversation/{conversationId}/files/{messageId}`,
conversationUserUrl: `${host}/conversation/{conversationId}/user`,
dialogsUrl: `${host}/conversation/{conversationId}/dialogs`,
conversationMessageDeletionUrl: `${host}/conversation/{conversationId}/message/{messageId}`,

Expand Down
11 changes: 11 additions & 0 deletions src/lib/services/conversation-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ export async function getConversation(id) {
return response.data;
}

/**
* Get conversation user
* @param {string} id
* @returns {Promise<import('$types').UserModel>}
*/
export async function getConversationUser(id) {
let url = replaceUrl(endpoints.conversationUserUrl, {conversationId: id});
const response = await axios.get(url);
return response.data;
}

/**
* Get conversation list
* @param {import('$types').ConversationFilter} filter
Expand Down
9 changes: 7 additions & 2 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
sendMessageToHub,
GetDialogs,
deleteConversationMessage,
getConversationFiles
getConversationFiles,
getConversationUser
} from '$lib/services/conversation-service.js';
import 'overlayscrollbars/overlayscrollbars.css';
import { OverlayScrollbars } from 'overlayscrollbars';
Expand Down Expand Up @@ -107,6 +108,9 @@
/** @type {import('$types').UserStateDetailModel[]} */
let userAddStates = [];
/** @type {import('$types').UserModel} */
let conversationUser;
/** @type {boolean} */
let isLoadContentLog = false;
let isLoadStateLog = false;
Expand Down Expand Up @@ -137,6 +141,7 @@
onMount(async () => {
autoScrollLog = true;
dialogs = await GetDialogs(params.conversationId);
conversationUser = await getConversationUser(params.conversationId);
initUserSentMessages(dialogs);
initChatView();
Expand Down Expand Up @@ -875,7 +880,7 @@
<div class="col-md-4 col-7 head-left">
<div class="m-1">{agent?.name}</div>
<div class="text-muted mb-0">
<i class="mdi mdi-circle text-success align-middle me-1" /> {currentUser?.user_name || ''}
<i class="mdi mdi-circle text-success align-middle me-1" /> {conversationUser?.full_name || ''}
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@
</div>
</div>

<div class="content-log-scrollbar log-list padding-side log-content" class:hide={selectedTab !== contentLogTab}>
<div class="content-log-scrollbar log-list padding-side log-body" class:hide={selectedTab !== contentLogTab}>
<ul>
{#each contentLogs as log}
<ContentLogElement data={log} />
{/each}
</ul>
</div>

<div class="queue-change-log-scrollbar log-list log-content" class:hide={selectedTab !== agentQueueLogTab}>
<div class="queue-change-log-scrollbar log-list log-body" class:hide={selectedTab !== agentQueueLogTab}>
<ul>
{#each agentQueueLogs as log}
<AgentQueueLogElement data={log} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
</button>
</div>
</div>
<div class="conv-state-log-scrollbar log-list padding-side log-content" class:hide={selectedTab !== convStateLogTab}>
<div class="conv-state-log-scrollbar log-list padding-side log-body" class:hide={selectedTab !== convStateLogTab}>
<ul>
{#each convStateLogs as log}
<ConversationStateLogElement data={log} />
{/each}
</ul>
</div>

<div class="msg-state-log-scrollbar log-list padding-side log-content" class:hide={selectedTab !== msgStateLogTab}>
<div class="msg-state-log-scrollbar log-list padding-side log-body" class:hide={selectedTab !== msgStateLogTab}>
<ul>
{#each msgStateLogs as log}
<MessageStateLogElement data={log} />
Expand Down

0 comments on commit 64d82bc

Please sign in to comment.