From 122627f6ce9a1d44fc06d53324cf19017e2c122c Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sat, 31 Jul 2021 18:53:12 +0100 Subject: [PATCH] :egg: Console banner --- src/App.vue | 2 ++ src/utils/CoolConsole.js | 14 ++++++++++++++ src/utils/ErrorHandler.js | 4 ++++ 3 files changed, 20 insertions(+) create mode 100644 src/utils/CoolConsole.js diff --git a/src/App.vue b/src/App.vue index 7d7faee4..80135d8f 100644 --- a/src/App.vue +++ b/src/App.vue @@ -13,6 +13,7 @@ import Footer from '@/components/PageStrcture/Footer.vue'; import LoadingScreen from '@/components/PageStrcture/LoadingScreen.vue'; import { componentVisibility } from '@/utils/ConfigHelpers'; import ConfigAccumulator from '@/utils/ConfigAccumalator'; +import { welcomeMsg } from '@/utils/CoolConsole'; import { localStorageKeys, splashScreenTime, @@ -103,6 +104,7 @@ export default { const cleanedCss = this.appConfig.customCss.replace(/<\/?[^>]+(>|$)/g, ''); this.injectCustomStyles(cleanedCss); } + welcomeMsg(); }, }; diff --git a/src/utils/CoolConsole.js b/src/utils/CoolConsole.js new file mode 100644 index 00000000..4bd32bd6 --- /dev/null +++ b/src/utils/CoolConsole.js @@ -0,0 +1,14 @@ +/* eslint no-console: ["error", { allow: ["log"] }] */ + +export const welcomeMsg = () => { + const v = process.env.VUE_APP_VERSION ? `V${process.env.VUE_APP_VERSION}` : ''; + console.log(`%cDashy ${v} 🚀`, 'color:#00af87; background:#0b1021; font-size:36px; padding: 0.5rem 0.5rem 0; margin: 1rem auto; font-family: Rockwell; border: 2px solid #00af87; border-radius: 4px;font-weight: bold; text-shadow: 1px 1px 1px #00af87bf;'); +}; + +export const warningMsg = () => { + console.log('%c⚠️ Error ⚠️', "background:#21bbca; color:#0b1021; font-size:20px; padding:0.25rem 0.5rem; margin: 1rem auto 0.25rem; font-family: 'Trebuchet MS', Helvetica; border: 2px solid yellow; border-radius: 4px; font-weight: bold;"); +}; + +export const raiseBug = () => { + console.log('%c🐛If you have found a bug, raise an issue on GitHub, at:\nhttps://git.io/JnqPR', "color:#dddd10; font-size: 14px; font-family: 'Trebuchet MS', Helvetica;"); +}; diff --git a/src/utils/ErrorHandler.js b/src/utils/ErrorHandler.js index 15e27769..eb37160b 100644 --- a/src/utils/ErrorHandler.js +++ b/src/utils/ErrorHandler.js @@ -1,11 +1,15 @@ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ +import { warningMsg, raiseBug } from '@/utils/CoolConsole'; + /** * Function called when an error happens * If you wish to use an error logging service, put code for it here */ const ErrorHandler = function handler(msg) { + warningMsg(); console.warn(msg); + raiseBug(); }; export default ErrorHandler;