Skip to content

Commit faec34e

Browse files
authored
Merge pull request #234 from iceljc/features/refine-chat-window
Features/refine chat window
2 parents e9207c4 + a9d4f95 commit faec34e

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

src/lib/common/LiveChatEntry.svelte

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,23 @@
2828
}
2929
</script>
3030

31-
<div class="fixed-bottom float-bottom-right">
32-
{#if $chatBotStore.showChatBox}
33-
<div transition:fade={{ delay: 250, duration: 300 }}>
34-
<iframe
35-
src={chatUrl}
36-
width="380px"
37-
height="650px"
38-
class={`border border-2 rounded-3 m-3 float-end chat-iframe`}
39-
title="live chat"
40-
id={CHAT_FRAME_ID}
41-
/>
42-
</div>
43-
{/if}
31+
<div class="chatbot-container fixed-bottom float-bottom-right">
32+
<iframe
33+
src={chatUrl}
34+
width={`${$chatBotStore.showChatBox ? '380px' : '0px'}`}
35+
height={`${$chatBotStore.showChatBox ? '650px' : '0px'}`}
36+
class={`border border-2 rounded-3 m-3 float-end ${$chatBotStore.showChatBox ? 'chat-iframe' : ''}`}
37+
title="live chat"
38+
id={CHAT_FRAME_ID}
39+
/>
4440

4541
{#if !$chatBotStore.showChatBox}
46-
<div class="mb-3 float-end wave-effect" transition:fade={{ delay: 100, duration: 500 }}>
42+
<div
43+
class="chatbot-icon mb-3 float-end wave-effect"
44+
transition:fade={{ delay: 50, duration: 200 }}
45+
>
4746
<button class="btn btn-transparent" on:click={() => openChatBox()}>
4847
<img alt="live chat" class="avatar-md rounded-circle" src={PUBLIC_LIVECHAT_ENTRY_ICON} />
49-
<iframe
50-
src={chatUrl}
51-
width="0px"
52-
height="0px"
53-
title="live chat"
54-
id={CHAT_FRAME_ID}
55-
/>
5648
</button>
5749
</div>
5850
{/if}
@@ -89,4 +81,14 @@
8981
margin-right: 0px;
9082
margin-left: auto;
9183
}
84+
85+
.chatbot-container {
86+
display: flex;
87+
flex-direction: column;
88+
}
89+
90+
.chatbot-icon {
91+
display: flex;
92+
justify-content: flex-end;
93+
}
9294
</style>

src/routes/chat/[agentId]/[conversationId]/chat-box.svelte

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,12 @@
221221
isCreatingNewConv = false;
222222
if (conv && !!e.data.text) {
223223
isLoading = true;
224+
openFrame();
224225
sendChatMessage(e.data.text, e.data.data || null, conv.id).then(() => {
225226
isLoading = false;
226-
openFrame();
227227
redirectToNewConversation(conv);
228228
}).catch(() => {
229229
isLoading = false;
230-
openFrame();
231230
});
232231
} else {
233232
openFrame();
@@ -241,11 +240,8 @@
241240
/** @param {any} e */
242241
function handleChatAction(e) {
243242
if (!!e.data.text && !isThinking && !isSendingMsg) {
244-
sendChatMessage(e.data.text, e.data.data || null).then(() => {
245-
openFrame();
246-
}).catch(() => {
247-
openFrame();
248-
});
243+
openFrame();
244+
sendChatMessage(e.data.text, e.data.data || null);
249245
}
250246
}
251247

0 commit comments

Comments
 (0)