Use Toastify instead of jquery.growl for notifications

This commit is contained in:
Andreas Nedbal 2022-01-09 19:42:08 +01:00 committed by Andreas Nedbal
parent 2de4980fd8
commit f4d32c5cd1
4 changed files with 21 additions and 7 deletions

View File

@ -0,0 +1,5 @@
.toastify {
@include media-breakpoint-up('md') {
transform: translateY(56px) !important;
}
}

View File

@ -1,7 +1,16 @@
require('toastify-js/src/toastify.css');
import Toastify from 'toastify-js';
export function showErrorNotification(text: string): void { export function showErrorNotification(text: string): void {
showNotification(text, false); showNotification(text, false);
} }
export function showNotification(text: string, status = true): void { export function showNotification(text: string, status = true): void {
window['showNotification'](text, status); Toastify({
text: text,
style: {
color: status ? 'rgb(var(--success-text))' : 'rgb(var(--danger-text))',
background: status ? 'var(--success)' : 'var(--danger)'
}
}).showToast();
} }

View File

@ -14,7 +14,6 @@
"i18n-js": "^3.8.0", "i18n-js": "^3.8.0",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"jquery-ujs": "^1.2.2", "jquery-ujs": "^1.2.2",
"jquery.growl": "^1.3.5",
"jquery.turbolinks": "^2.1.0", "jquery.turbolinks": "^2.1.0",
"js-cookie": "2.2.1", "js-cookie": "2.2.1",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
@ -23,6 +22,7 @@
"regenerator-runtime": "^0.13.7", "regenerator-runtime": "^0.13.7",
"sweetalert": "1.1.3", "sweetalert": "1.1.3",
"tinycolor2": "^1.4.2", "tinycolor2": "^1.4.2",
"toastify-js": "^1.11.2",
"turbolinks": "^5.2.0", "turbolinks": "^5.2.0",
"typescript": "^4.1.3" "typescript": "^4.1.3"
}, },

View File

@ -4502,11 +4502,6 @@ jquery-ujs@^1.2.2:
dependencies: dependencies:
jquery ">=1.8.0" jquery ">=1.8.0"
jquery.growl@^1.3.5:
version "1.3.5"
resolved "https://registry.yarnpkg.com/jquery.growl/-/jquery.growl-1.3.5.tgz#fa1c4d758e0d7686551e15896b1aaac2bb1af7f1"
integrity sha1-+hxNdY4NdoZVHhWJaxqqwrsa9/E=
jquery.turbolinks@^2.1.0: jquery.turbolinks@^2.1.0:
version "2.1.0" version "2.1.0"
resolved "https://registry.yarnpkg.com/jquery.turbolinks/-/jquery.turbolinks-2.1.0.tgz#36036bb997c48d53bceb345521fbdf7da887a62c" resolved "https://registry.yarnpkg.com/jquery.turbolinks/-/jquery.turbolinks-2.1.0.tgz#36036bb997c48d53bceb345521fbdf7da887a62c"
@ -7848,6 +7843,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
regex-not "^1.0.2" regex-not "^1.0.2"
safe-regex "^1.1.0" safe-regex "^1.1.0"
toastify-js@^1.11.2:
version "1.11.2"
resolved "https://registry.yarnpkg.com/toastify-js/-/toastify-js-1.11.2.tgz#5c66cb05cee30b09e5bd8961ab809e41a3ce716c"
integrity sha512-bMBNKhZLPX/sDhpwM7KHIRUTtqCylQeoZDiEWy5zE7iDUJ92XmP8AKgDAp9rXx6pR5GXGFtQHHoH62toahbHgQ==
toidentifier@1.0.0: toidentifier@1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"