From a2c8edc07129ce06fa2a9f5d8f5f6e39ce55a1eb Mon Sep 17 00:00:00 2001 From: Sensational Code Date: Wed, 31 Jul 2024 13:32:35 -0700 Subject: [PATCH] Standardize toast duration to 5 seconds --- .../pages/data-sources/create.vue | 1 + src/ui/UserPortal/components/ChatInput.vue | 50 +++++++++++-------- src/ui/UserPortal/components/NavBar.vue | 4 +- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/src/ui/ManagementPortal/pages/data-sources/create.vue b/src/ui/ManagementPortal/pages/data-sources/create.vue index 47c2f1b152..92f3c9639c 100644 --- a/src/ui/ManagementPortal/pages/data-sources/create.vue +++ b/src/ui/ManagementPortal/pages/data-sources/create.vue @@ -573,6 +573,7 @@ export default { return this.$toast.add({ severity: 'error', detail: error?.response?._data || error, + life: 5000, }); } diff --git a/src/ui/UserPortal/components/ChatInput.vue b/src/ui/UserPortal/components/ChatInput.vue index 2e525642b8..906ac7291b 100644 --- a/src/ui/UserPortal/components/ChatInput.vue +++ b/src/ui/UserPortal/components/ChatInput.vue @@ -170,9 +170,9 @@ export default { agentListOpen: false, showFileUploadDialog: false, primaryButtonBg: this.$appConfigStore.primaryButtonBg, - primaryButtonText: this.$appConfigStore.primaryButtonText, + primaryButtonText: this.$appConfigStore.primaryButtonText, secondaryButtonBg: this.$appConfigStore.secondaryButtonBg, - secondaryButtonText: this.$appConfigStore.secondaryButtonText, + secondaryButtonText: this.$appConfigStore.secondaryButtonText, }; }, @@ -243,10 +243,20 @@ export default { const objectId = await this.$appStore.uploadAttachment(formData, this.$appStore.currentSession.sessionId); console.log(`File uploaded: ObjectId: ${objectId}`); - this.$toast.add({ severity: 'success', summary: 'Success', detail: 'File uploaded successfully.' }); + this.$toast.add({ + severity: 'success', + summary: 'Success', + detail: 'File uploaded successfully.', + life: 5000, + }); this.showFileUploadDialog = false; } catch (error) { - this.$toast.add({ severity: 'error', summary: 'Error', detail: `File upload failed. ${error.message}` }); + this.$toast.add({ + severity: 'error', + summary: 'Error', + detail: `File upload failed. ${error.message}`, + life: 5000, + }); } }, @@ -293,19 +303,19 @@ export default { }, formatSize(bytes) { - const k = 1024; - const dm = 3; - const sizes = this.$primevue.config.locale.fileSizeTypes; + const k = 1024; + const dm = 3; + const sizes = this.$primevue.config.locale.fileSizeTypes; - if (bytes === 0) { - return `0 ${sizes[0]}`; - } + if (bytes === 0) { + return `0 ${sizes[0]}`; + } - const i = Math.floor(Math.log(bytes) / Math.log(k)); - const formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); + const i = Math.floor(Math.log(bytes) / Math.log(k)); + const formattedSize = parseFloat((bytes / Math.pow(k, i)).toFixed(dm)); - return `${formattedSize} ${sizes[i]}`; - } + return `${formattedSize} ${sizes[i]}`; + }, }, }; @@ -335,7 +345,7 @@ export default { } .chat-input .input-wrapper { - display: flex; + display: flex; align-items: stretch; width: 100%; } @@ -411,10 +421,10 @@ export default { .attached-files { display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - flex-wrap: nowrap; + flex-direction: row; + align-items: center; + justify-content: space-between; + flex-wrap: nowrap; } .file-remove { @@ -455,6 +465,6 @@ export default { width: 100%; text-align: center; font-size: 5rem; - color: #000; + color: #000; } diff --git a/src/ui/UserPortal/components/NavBar.vue b/src/ui/UserPortal/components/NavBar.vue index cd6c88d1d9..8c0d734600 100644 --- a/src/ui/UserPortal/components/NavBar.vue +++ b/src/ui/UserPortal/components/NavBar.vue @@ -163,7 +163,7 @@ export default { this.$toast.add({ severity: 'success', detail: 'Chat link copied!', - life: 2000, + life: 5000, }); }, @@ -176,7 +176,7 @@ export default { this.$toast.add({ severity: 'success', detail: message, - life: 2000, + life: 5000, }); },