From bbe6e78f88dd44fb3abdbae25889d72c98856867 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Mon, 11 Dec 2023 21:18:31 +0300 Subject: [PATCH] chore: login/signup improvements --- .gitignore | 4 +++- apps/dashboard/src/routes/+layout.server.ts | 5 +++-- apps/dashboard/src/routes/+layout.svelte | 8 +++++--- .../src/routes/courses/[id]/submissions/+page.svelte | 4 ++-- apps/dashboard/src/routes/login/+page.svelte | 1 - apps/dashboard/src/routes/signup/+page.svelte | 1 - 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 6ea11cca..e3e2e2eb 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,6 @@ yarn-error.log* .turbo # vercel -.vercel \ No newline at end of file +.vercel + +vite.config.ts*.mjs \ No newline at end of file diff --git a/apps/dashboard/src/routes/+layout.server.ts b/apps/dashboard/src/routes/+layout.server.ts index 77f39f10..91f94307 100644 --- a/apps/dashboard/src/routes/+layout.server.ts +++ b/apps/dashboard/src/routes/+layout.server.ts @@ -1,3 +1,4 @@ +import { dev } from '$app/environment'; import { redirect } from '@sveltejs/kit'; import { blockedSubdomain } from '$lib/utils/constants/app'; import { getCurrentOrg } from '$lib/utils/services/org'; @@ -37,12 +38,12 @@ export const load = async ({ url, cookies }): Promise => { response.orgSiteName = debugMode ? _orgSiteName : subdomain; response.org = (await getCurrentOrg(response.orgSiteName, true)) || null; - if (!response.org) { + if (!response.org && !dev) { throw redirect(301, 'https://app.classroomio.com/404?type=org'); } } else if (subdomain === 'play' || debugPlay === 'true') { response.skipAuth = true; - } else if (subdomain !== 'app') { + } else if (subdomain !== 'app' && !dev) { throw redirect(301, 'https://app.classroomio.com'); } diff --git a/apps/dashboard/src/routes/+layout.svelte b/apps/dashboard/src/routes/+layout.svelte index d0c39e35..9e711ff1 100644 --- a/apps/dashboard/src/routes/+layout.svelte +++ b/apps/dashboard/src/routes/+layout.svelte @@ -4,7 +4,7 @@ import { fly } from 'svelte/transition'; import { derived } from 'svelte/store'; import { goto } from '$app/navigation'; - import { browser } from '$app/environment'; + import { browser, dev } from '$app/environment'; import { page, navigating } from '$app/stores'; import isEmpty from 'lodash/isEmpty'; import { Theme, ToastNotification, Loading } from 'carbon-components-svelte'; @@ -56,6 +56,10 @@ // Set up posthog initPosthog(); + + if (!dev) { + injectSpeedInsights(); + } } function setAnalyticsUser() { @@ -216,8 +220,6 @@ setupAnalytics(); - injectSpeedInsights(); - handleResize(); if (!isSupabaseTokenInLocalStorage() && !isPublicRoute($page.url?.pathname)) { diff --git a/apps/dashboard/src/routes/courses/[id]/submissions/+page.svelte b/apps/dashboard/src/routes/courses/[id]/submissions/+page.svelte index 7eca71e3..29caec4c 100644 --- a/apps/dashboard/src/routes/courses/[id]/submissions/+page.svelte +++ b/apps/dashboard/src/routes/courses/[id]/submissions/+page.svelte @@ -108,8 +108,8 @@ const content = `

Hello ${fullname},

The status of your submitted exercise on ${title} has been updated to ${ - submissionStatus[status_id] - }

+ submissionStatus[status_id] + }

${ status_id == 3 ? `

Your score was ${totalMark}/${maxMark}

diff --git a/apps/dashboard/src/routes/login/+page.svelte b/apps/dashboard/src/routes/login/+page.svelte index 5e8188e9..c00def26 100644 --- a/apps/dashboard/src/routes/login/+page.svelte +++ b/apps/dashboard/src/routes/login/+page.svelte @@ -42,7 +42,6 @@ }); } catch (error) { submitError = error.error_description || error.message; - } finally { loading = false; } } diff --git a/apps/dashboard/src/routes/signup/+page.svelte b/apps/dashboard/src/routes/signup/+page.svelte index 7c7a9655..2d941dad 100644 --- a/apps/dashboard/src/routes/signup/+page.svelte +++ b/apps/dashboard/src/routes/signup/+page.svelte @@ -103,7 +103,6 @@ fields = Object.assign({}, SIGNUP_FIELDS); } catch (error) { submitError = error?.error_description || error?.message; - } finally { loading = false; } }