From 3593acbc68742c58747cffb35a767a0a11272539 Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 22 Jan 2024 14:39:46 -0600 Subject: [PATCH 1/3] refine ui elements --- src/lib/common/LoadingToResult.svelte | 24 ++++++ src/lib/scss/app.scss | 2 +- src/lib/scss/custom/pages/_conversation.scss | 6 ++ .../[conversationId]/chat-box.svelte | 20 ++++- src/routes/page/conversation/+page.svelte | 80 ++++--------------- .../[conversationId]/+page.svelte | 1 + src/routes/page/mongodb/+page.svelte | 18 +---- 7 files changed, 68 insertions(+), 83 deletions(-) create mode 100644 src/lib/common/LoadingToResult.svelte create mode 100644 src/lib/scss/custom/pages/_conversation.scss diff --git a/src/lib/common/LoadingToResult.svelte b/src/lib/common/LoadingToResult.svelte new file mode 100644 index 00000000..53ef7ae5 --- /dev/null +++ b/src/lib/common/LoadingToResult.svelte @@ -0,0 +1,24 @@ + + +{#if isLoading} + +{/if} + +{#if isComplete} + +
Update completed!
+
+{/if} + +{#if isError} + +
Error!
+
+{/if} \ No newline at end of file diff --git a/src/lib/scss/app.scss b/src/lib/scss/app.scss index b4512012..1873c1bd 100644 --- a/src/lib/scss/app.scss +++ b/src/lib/scss/app.scss @@ -83,7 +83,7 @@ File: Main Css File @import "custom/pages/timeline"; @import "custom/pages/extras-pages"; @import "custom/pages/jobs"; - +@import "custom/pages/conversation"; //RTL // @import "custom/rtl/bootstrap-rtl"; diff --git a/src/lib/scss/custom/pages/_conversation.scss b/src/lib/scss/custom/pages/_conversation.scss new file mode 100644 index 00000000..972693ee --- /dev/null +++ b/src/lib/scss/custom/pages/_conversation.scss @@ -0,0 +1,6 @@ +.conv-delete-modal { + button { + outline: none !important; + box-shadow: none !important; + } +} \ No newline at end of file diff --git a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte index 547c9c30..07681614 100644 --- a/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte +++ b/src/routes/chat/[agentId]/[conversationId]/chat-box.svelte @@ -19,6 +19,8 @@ import RcQuickReply from './rc-quick-reply.svelte'; import { PUBLIC_LIVECHAT_ENTRY_ICON } from '$env/static/public'; import ContentLog from './content-log.svelte'; + import Swal from 'sweetalert2/dist/sweetalert2.js'; + import "sweetalert2/src/sweetalert2.scss"; const options = { scrollbars: { @@ -139,8 +141,20 @@ await sendMessageToHub(params.agentId, params.conversationId, text); } - function close() { - window.parent.postMessage({ action: "close" }, "*"); + function endChat() { + Swal.fire({ + title: 'Are you sure?', + text: "You will exit this conversation.", + icon: 'warning', + customClass: 'conv-delete-modal', + showCancelButton: true, + confirmButtonText: 'Yes', + cancelButtonText: 'No' + }).then((result) => { + if (result.value) { + window.close(); + } + }); } function closeLog() { @@ -176,7 +190,7 @@ {/if}
  • diff --git a/src/routes/page/conversation/+page.svelte b/src/routes/page/conversation/+page.svelte index 52a63b69..0b5dcca1 100644 --- a/src/routes/page/conversation/+page.svelte +++ b/src/routes/page/conversation/+page.svelte @@ -1,4 +1,5 @@ - - toggle()} -> - Delete Conversation - - Are you sure you want to delete this conversation? - - - - - - - -{#if isLoading} - -{/if} - -{#if isComplete} - -
    Update completed!
    -
    -{/if} - -{#if isError} - -
    Error!
    -
    -{/if} + @@ -273,9 +229,7 @@ - - diff --git a/src/routes/page/conversation/[conversationId]/+page.svelte b/src/routes/page/conversation/[conversationId]/+page.svelte index 42dc6f2e..24ed7833 100644 --- a/src/routes/page/conversation/[conversationId]/+page.svelte +++ b/src/routes/page/conversation/[conversationId]/+page.svelte @@ -26,6 +26,7 @@ text: "You won't be able to revert this!", icon: 'warning', showCancelButton: true, + customClass: 'conv-delete-modal', confirmButtonText: 'Yes, delete it!' }).then(async (result) => { if (result.value) { diff --git a/src/routes/page/mongodb/+page.svelte b/src/routes/page/mongodb/+page.svelte index dfe4754a..60abed56 100644 --- a/src/routes/page/mongodb/+page.svelte +++ b/src/routes/page/mongodb/+page.svelte @@ -4,6 +4,7 @@ import HeadTitle from '$lib/common/HeadTitle.svelte'; import { refreshAgents } from '$lib/services/agent-service'; import Loader from '$lib/common/Loader.svelte'; + import LoadingToResult from '$lib/common/LoadingToResult.svelte'; let isLoading = false; let isComplete = false; @@ -32,22 +33,7 @@ - -{#if isLoading} - -{/if} - -{#if isComplete} - -
    Update completed!
    -
    -{/if} - -{#if isError} - -
    Error!
    -
    -{/if} +

    Migrate agents from file repository to MongoDB