change notification system to vue-toastification

This commit is contained in:
ArabCoders
2024-12-30 19:31:10 +03:00
parent ba4594a584
commit 0da19458e9
6 changed files with 863 additions and 929 deletions

View File

@@ -0,0 +1,3 @@
import {useToast} from "vue-toastification";
export default () => useToast()

View File

@@ -1,6 +1,6 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import path from "path";
import path from 'path'
export default defineNuxtConfig({
ssr: false,
@@ -32,7 +32,6 @@ export default defineNuxtConfig({
modules: [
'@vueuse/nuxt',
'floating-vue/nuxt',
'nuxt3-notifications',
],
nitro: {
@@ -41,6 +40,14 @@ export default defineNuxtConfig({
}
},
build: {
transpile: ['vue-toastification'],
},
css: [
'vue-toastification/dist/index.css'
],
telemetry: false,
compatibilityDate: "2024-12-28",
})

View File

@@ -22,10 +22,10 @@
"marked-base-url": "^1.1.3",
"moment": "^2.30.1",
"nuxt": "^3.11.2",
"nuxt3-notifications": "^1.2.0",
"plyr": "^3.7.8",
"vue": "^3.4.21",
"vue-router": "^4.3.0"
"vue-router": "^4.3.0",
"vue-toastification": "^2.0.0-rc.5"
},
"devDependencies": {}
}

View File

@@ -0,0 +1,9 @@
import Toast from 'vue-toastification'
export default defineNuxtPlugin(nuxtApp => nuxtApp.vueApp.use(Toast, {
transition: "Vue-Toastification__bounce",
maxToasts: 5,
closeOnClick: false,
newestOnTop: true,
showCloseButtonOnHover: true,
}))

View File

@@ -1,6 +1,4 @@
import {useNotification} from '@kyvg/vue3-notification'
const {notify} = useNotification();
const toast = useToast()
const AG_SEPARATOR = '.'
@@ -165,28 +163,29 @@ const ucFirst = (str) => {
* @returns {void}
*/
const notification = (type, title, text, duration = 3000) => {
let classes = ''
let method = '', options = {
timeout: duration,
}
switch (type.toLowerCase()) {
case 'info':
default:
classes = 'has-background-info has-text-white'
method = 'info'
break
case 'success':
classes = 'has-background-success has-text-white'
method = 'success'
break
case 'warning':
classes = 'has-background-warning has-text-white'
method = 'warning'
break
case 'error':
classes = 'has-background-danger has-text-white'
if (duration === 3000) {
duration = 10000
method = 'error'
if (3000 === duration) {
options.timeout = 10000
}
break
}
return notify({title, text, type: classes, duration})
toast[method](text, options)
}
/**

File diff suppressed because it is too large Load Diff