From ed67d43b2a4c582f3473a40d621dcb0da9a20ffd Mon Sep 17 00:00:00 2001 From: tunny17 Date: Sat, 15 Jul 2023 19:45:04 +0000 Subject: [PATCH] CLASSROOMIO-T-48: Error 500 Page This is for the readjustment of the error page. Co-authored-by: Rotimi Best Co-authored-by: Rotimi Best Co-authored-by: Tunji Adeyemi Co-authored-by: tunny17 Merge-request: CLASSROOMIO-MR-15 Merged-by: Best Admin --- src/client.js | 38 +++---- src/components/Icons/ErrorIcon.svelte | 98 ++++++++++++++++++ src/components/Icons/ErrorIconDarkMode.svelte | 99 +++++++++++++++++++ src/components/Modal/index.svelte | 2 + src/routes/_error.svelte | 86 +++++++--------- src/routes/_layout.svelte | 6 +- 6 files changed, 257 insertions(+), 72 deletions(-) create mode 100644 src/components/Icons/ErrorIcon.svelte create mode 100644 src/components/Icons/ErrorIconDarkMode.svelte diff --git a/src/client.js b/src/client.js index d44792cd..09e27ae6 100644 --- a/src/client.js +++ b/src/client.js @@ -1,27 +1,27 @@ import * as sapper from '@sapper/app'; -// import * as Sentry from '@sentry/browser'; -// import { Integrations } from '@sentry/tracing'; -// import { CaptureConsole } from '@sentry/integrations'; +import * as Sentry from '@sentry/browser'; +import { Integrations } from '@sentry/tracing'; +import { CaptureConsole } from '@sentry/integrations'; import config from './config'; console.log(`isProd`, config.isProd); -// if (config.isProd) { -// Sentry.init({ -// dsn: 'https://c966f7e8cb1d4306be20b26bb4f0cc96@o476906.ingest.sentry.io/5999999', -// integrations: [ -// new Integrations.BrowserTracing(), -// new CaptureConsole({ -// levels: ['error'], -// }), -// ], -// environment: config.isProd ? 'production' : 'development', -// // Set tracesSampleRate to 1.0 to capture 100% -// // of transactions for performance monitoring. -// // We recommend adjusting this value in production -// tracesSampleRate: 1.0, -// }); -// } +if (config.isProd) { + Sentry.init({ + dsn: 'https://c966f7e8cb1d4306be20b26bb4f0cc96@o476906.ingest.sentry.io/5999999', + integrations: [ + new Integrations.BrowserTracing(), + new CaptureConsole({ + levels: ['error'], + }), + ], + environment: config.isProd ? 'production' : 'development', + // Set tracesSampleRate to 1.0 to capture 100% + // of transactions for performance monitoring. + // We recommend adjusting this value in production + tracesSampleRate: 1.0, + }); +} sapper.start({ target: document.querySelector('#sapper'), diff --git a/src/components/Icons/ErrorIcon.svelte b/src/components/Icons/ErrorIcon.svelte new file mode 100644 index 00000000..c5b9e0c8 --- /dev/null +++ b/src/components/Icons/ErrorIcon.svelte @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/Icons/ErrorIconDarkMode.svelte b/src/components/Icons/ErrorIconDarkMode.svelte new file mode 100644 index 00000000..c496a621 --- /dev/null +++ b/src/components/Icons/ErrorIconDarkMode.svelte @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/Modal/index.svelte b/src/components/Modal/index.svelte index 96a56ae7..d71deef2 100644 --- a/src/components/Modal/index.svelte +++ b/src/components/Modal/index.svelte @@ -12,8 +12,10 @@ afterUpdate(() => { if (open) { + if (!document) return; document.getElementsByTagName('body')[0].style.overflow = 'hidden'; } else { + if (!document) return; document.getElementsByTagName('body')[0].style.overflow = 'auto'; } }); diff --git a/src/routes/_error.svelte b/src/routes/_error.svelte index e71025a0..ebf225fd 100644 --- a/src/routes/_error.svelte +++ b/src/routes/_error.svelte @@ -1,66 +1,52 @@ {status} -
-

Opps 😢

-

Something wen't wrong and it's our fault.

-

Please screenshot this page and send to me.

-
-    {errorContent}
-  
+
+
+

+ Something unexpected occured. +

+

+ Don't worry, your learning is safe. It isn't your fault, it is ours. We + have gotten the error notification and will push a fix ASAP. In the + meantime, take a short break and come back a bit later. +

+ Contact Us +
+ +
+ + {#if $appStore.isDark} + + {:else} + + {/if} +
- diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte index b46b3dd2..c2e90f33 100644 --- a/src/routes/_layout.svelte +++ b/src/routes/_layout.svelte @@ -9,7 +9,7 @@ import { derived } from 'svelte/store'; import { stores, goto } from '@sapper/app'; import isEmpty from 'lodash/isEmpty'; - // import * as Sentry from '@sentry/browser'; + import * as Sentry from '@sentry/browser'; import { Theme } from 'carbon-components-svelte'; import { Moon } from 'svelte-loading-spinners'; import Tailwindcss from '../components/Tailwindcss.svelte'; @@ -96,7 +96,7 @@ profile.set(data[0]); // Set user in sentry - // Sentry.setUser($profile); + Sentry.setUser($profile); if ($appStore.isStudentDomain) { const { data, error } = await supabase @@ -134,7 +134,7 @@ profile.set(profileData); // Set user in sentry - // Sentry.setUser($profile); + Sentry.setUser($profile); const orgRes = await getOrganizations($profile.id);