From be513a09527cd21e61030d2ca7d1514b66f2f41d Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 21 Apr 2024 22:29:32 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Shows=20error=20details,=20if=20a?= =?UTF-8?q?=20critical=20error=20happens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PageStrcture/CriticalError.vue | 97 +++++++++++++------ 1 file changed, 67 insertions(+), 30 deletions(-) diff --git a/src/components/PageStrcture/CriticalError.vue b/src/components/PageStrcture/CriticalError.vue index c8dc19d6..ce5b859a 100644 --- a/src/components/PageStrcture/CriticalError.vue +++ b/src/components/PageStrcture/CriticalError.vue @@ -1,24 +1,35 @@ @@ -28,24 +39,23 @@ import Keys from '@/utils/StoreMutations'; export default { name: 'CriticalError', - props: { - text: String, - }, - data() { - return { - - }; - }, computed: { + /* Determines if we should show this component. + * If error present AND user hasn't disabled */ shouldShow() { return this.$store.state.criticalError && !localStorage[localStorageKeys.DISABLE_CRITICAL_WARNING]; }, }, methods: { + /* Ignore all future errors, by putting a key in local storage */ ignoreWarning() { - this.$store.commit(Keys.CRITICAL_ERROR_MSG, null); localStorage.setItem(localStorageKeys.DISABLE_CRITICAL_WARNING, true); + this.close(); + }, + /* Close this dialog, by removing this error from the local store */ + close() { + this.$store.commit(Keys.CRITICAL_ERROR_MSG, null); }, }, }; @@ -55,10 +65,10 @@ export default { @import '@/styles/media-queries.scss'; .critical-error-wrap { position: absolute; - top: 30%; + top: 40%; left: 50%; transform: translate(-50%, -50%); - z-index: 2; + z-index: 3; background: var(--background-darker); padding: 1rem; border-radius: var(--curve-factor); @@ -67,33 +77,39 @@ export default { display: flex; flex-direction: column; justify-content: center; - opacity: 0.95; gap: 0.5rem; + transition: all 0.2s ease-in-out; @include tablet-down { top: 50%; width: 85vw; } - p, ul, h4 { + p, ul, h4, a { margin: 0; color: var(--white); } + pre { + color: var(--warning); + font-size: 0.8rem; + overflow: auto; + background: var(--transparent-white-10); + padding: 0.5rem; + border-radius: var(--curve-factor); + } h4 { - margin-top: 1rem; + margin: 0.5rem 0 0 0; + font-size: 1.2rem; } h3 { font-size: 2.2rem; text-align: center; background: var(--danger); - color: white; + color: var(--white); margin: -1rem -1rem 1rem -1rem; padding: 0.5rem; } ul { padding-left: 1rem; } - .the-error { - color: var(--danger); - } .user-doesnt-care { background: var(--background-darker); color: var(--white); @@ -111,5 +127,26 @@ export default { text-decoration: none; } } + .close { + position: absolute; + top: 1rem; + right: 1rem; + width: 1.5rem; + height: 1.5rem; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + font-size: 1rem; + background: var(--background); + color: var(--primary); + border: none; + border-radius: var(--curve-factor); + transition: all 0.2s ease-in-out; + &:hover { + background: var(--primary); + color: var(--background); + } + } }