diff --git a/src/renderer/components/ft-toast/ft-toast.css b/src/renderer/components/ft-toast/ft-toast.css index 3540f99c..1e95bb60 100644 --- a/src/renderer/components/ft-toast/ft-toast.css +++ b/src/renderer/components/ft-toast/ft-toast.css @@ -9,8 +9,10 @@ .toast { display: flex; padding: 10px; + margin: 5px; overflow-y: auto; - background-color: var(--primary-input-color); + background-color: rgba(0, 0, 0, 0.7); + color: white; opacity: 0; border-radius: 20px; cursor: pointer; diff --git a/src/renderer/components/ft-toast/ft-toast.js b/src/renderer/components/ft-toast/ft-toast.js index 431ea3ee..d8ea4487 100644 --- a/src/renderer/components/ft-toast/ft-toast.js +++ b/src/renderer/components/ft-toast/ft-toast.js @@ -19,31 +19,32 @@ export default Vue.extend({ FtToastEvents.$on('toast.open', this.open) }, methods: { - performAction: function (index) { - this.toasts[index].action() - this.close(index) + performAction: function (toast) { + toast.action() + this.close(toast) }, - close: function (index) { - clearTimeout(this.toasts[index].timeout); - this.toasts[index].isOpen = false + close: function (toast) { + clearTimeout(toast.timeout); + toast.isOpen = false if(this.queue.length !== 0) { - const toast = this.queue.shift() - this.open(toast.message, toast.action) + const nexToast = this.queue.shift() + this.open(nexToast.message, nexToast.action) } }, open: function (message, action) { for(let i = this.toasts.length - 1; i >= 0 ; i--){ - if (!this.toasts[i].isOpen) { - return this.showToast(message, action, i) + const toast = this.toasts[i] + if (!toast.isOpen) { + return this.showToast(message, action, toast) } } this.queue.push({ message: message, action: action }) }, - showToast: function(message, action, index) { - this.toasts[index].message = message - this.toasts[index].action = action || (() => {}) - this.toasts[index].isOpen = true - this.toasts[index].timeout = setTimeout(this.close, 2000, index) + showToast: function(message, action, toast) { + toast.message = message + toast.action = action || (() => {}) + toast.isOpen = true + toast.timeout = setTimeout(this.close, 2000, toast) } }, beforeDestroy: function () { diff --git a/src/renderer/components/ft-toast/ft-toast.vue b/src/renderer/components/ft-toast/ft-toast.vue index b0e33953..5159cf9e 100644 --- a/src/renderer/components/ft-toast/ft-toast.vue +++ b/src/renderer/components/ft-toast/ft-toast.vue @@ -5,7 +5,7 @@ :key="'toast-' + index" class="toast" :class="{ closed: !toast.isOpen, open: toast.isOpen }" - @click="performAction(index)" + @click="performAction(toast)" >

{{ toast.message }}