Skip to content

Commit

Permalink
Merge pull request #24 from iceljc/bugfix/fix-conv-dropdown
Browse files Browse the repository at this point in the history
Bugfix/fix conv dropdown
  • Loading branch information
Oceania2018 authored Jan 24, 2024
2 parents 03889ab + 3c3e700 commit c51bab4
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
49 changes: 26 additions & 23 deletions src/lib/common/LiveChatEntry.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,44 @@
let chatUrl = PUBLIC_LIVECHAT_HOST;
onMount(async () => {
const agentSettings = await getSettingDetail("Agent");
chatUrl = `${PUBLIC_LIVECHAT_HOST}/chat/${agentSettings.hostAgentId}`;
showChatIcon = true;
const agentSettings = await getSettingDetail("Agent");
chatUrl = `${PUBLIC_LIVECHAT_HOST}/chat/${agentSettings.hostAgentId}`;
showChatIcon = true;
});
// Handle event from iframe
window.onmessage = async function(e) {
if (e.data.action == 'close') {
showChatIcon = true;
showChatBox = false;
}
};
function handleChatBox() {
showChatIcon = false;
showChatBox = true;
// Handle event from iframe
window.onmessage = async function(e) {
if (e.data.action == 'close') {
showChatIcon = true;
showChatBox = false;
}
};
function handleChatBox() {
showChatIcon = false;
showChatBox = true;
}
</script>

<div class="fixed-bottom float-bottom-right">
{#if showChatBox}
<div transition:fade={{ delay: 250, duration: 300 }}>
<iframe src={chatUrl}
width="380px"
height="650px"
class="border border-2 rounded-3 m-3 float-end"
title="live chat"></iframe>
<iframe
src={chatUrl}
width="380px"
height="650px"
class="border border-2 rounded-3 m-3 float-end"
title="live chat"
>
</iframe>
</div>
{/if}

{#if showChatIcon}
<div class="mb-3 float-end wave-effect" transition:fade={{ delay: 1500, duration: 500 }}>
<button class="btn btn-transparent" on:click={handleChatBox}>
<img alt="live chat" class="avatar-md rounded-circle" src={PUBLIC_LIVECHAT_ENTRY_ICON} />
</button>
<div class="mb-3 float-end wave-effect" transition:fade={{ delay: 100, duration: 500 }}>
<button class="btn btn-transparent" on:click={handleChatBox}>
<img alt="live chat" class="avatar-md rounded-circle" src={PUBLIC_LIVECHAT_ENTRY_ICON} />
</button>
</div>
{/if}
</div>
Expand Down
8 changes: 6 additions & 2 deletions src/lib/scss/custom/pages/_chat.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,12 @@
.dropdown-menu {
box-shadow: $box-shadow;
border: 1px solid var(--#{$prefix}border-color);

li:first-child {
@media (max-width: 575.98px) {
display: none;
}
}
}
}
}
Expand Down Expand Up @@ -298,5 +304,3 @@
}
}



2 changes: 0 additions & 2 deletions src/routes/chat/[agentId]/[conversationId]/chat-box.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@
</DropdownToggle>
<DropdownMenu class="dropdown-menu-end">
<DropdownItem on:click={viewFullLogHandler} >View Log</DropdownItem>
</DropdownMenu>
<DropdownMenu class="dropdown-menu-end">
<DropdownItem on:click={newConversationHandler} >New Conversation</DropdownItem>
</DropdownMenu>
</Dropdown>
Expand Down

0 comments on commit c51bab4

Please sign in to comment.