From d20a12a04906dd12107439a646f87d512f90cdc7 Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Mon, 16 Oct 2023 10:24:02 +0100 Subject: [PATCH] course slug improvement --- README.md | 3 +-- src/lib/utils/functions/generateSlug.js | 2 +- src/lib/utils/services/courses/index.ts | 2 -- .../courses/[id]/lessons/[...lessonParams]/+page.svelte | 7 ++++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b9c03a08..22fcaa3d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ The tool every classroom use in collaborating in and outside the class. ## Why the name? -Initially I set out to build a customizable version of Google Classroom and I knew I wanted this to be a teaching software that can be used anywhere therefore I needed Classroom in the name just like Google Classroom. As for `IO`, I followed the Google IO conference so closely and, the wording really sounded well to me plus, IO sounded more techy which made me feel that adding it to the name would mean `A Classroom driven by technology`. This made me consider calling it `Classroom` + `IO`, however the domain for classroom.io was taken so I made the IO part of the name thereby giving birth to `ClassroomIO.com` +Initially I set out to build a customizable version of Google Classroom and I knew I wanted this to be a teaching software that can be used anywhere therefore I needed Classroom in the name just like Google Classroom. As for `IO`, I followed the Google IO conference so closely and, the wording really sounded well to me plus, IO sounded more techy which made me feel that adding it to the name would mean `A Classroom driven by technology`. This made me consider calling it `Classroom` + `IO`, however the domain for classroom.io was taken so I made the IO part of the name thereby giving birth to `ClassroomIO.com` ## Why build another LMS? @@ -40,7 +40,6 @@ Note: Make sure you are using Node 18 PUBLIC_SUPABASE_ANON_KEY= PUBLIC_SUPABASE_URL= NETLIFY_API_KEY= -MIXPANEL_TOKEN= OPENAI_API_KEY= CLOUDFLARE_TOKEN_VALUE= CLOUDFLARE_ACCESS_KEY= diff --git a/src/lib/utils/functions/generateSlug.js b/src/lib/utils/functions/generateSlug.js index 631aa239..891597ae 100644 --- a/src/lib/utils/functions/generateSlug.js +++ b/src/lib/utils/functions/generateSlug.js @@ -1,7 +1,7 @@ function generateSlug(title) { return title .match(/[^\W\s\d]*/g, '') - .join('') + .join('-') .toLowerCase() .concat(`-${new Date().getTime()}`); } diff --git a/src/lib/utils/services/courses/index.ts b/src/lib/utils/services/courses/index.ts index 7eee787c..ccfe0e28 100644 --- a/src/lib/utils/services/courses/index.ts +++ b/src/lib/utils/services/courses/index.ts @@ -13,8 +13,6 @@ import type { import { STATUS } from '$lib/utils/constants/course'; import type { PostgrestSingleResponse } from '@supabase/supabase-js'; -import htmlElements from '$lib/mocks/html/001_html_elements'; - export async function fetchCourse(courseId?: Course['id'], slug?: Course['slug']) { let match: { slug?: string; id?: string; status?: string } = {}; diff --git a/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte b/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte index 2c71ea56..2787b816 100644 --- a/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte +++ b/src/routes/courses/[id]/lessons/[...lessonParams]/+page.svelte @@ -191,7 +191,8 @@ note: lessonData.note, slide_url: lessonData.slide_url }, - lesson_completion + lesson_completion, + exercises: [] })); } @@ -204,7 +205,7 @@ mode = mode === MODES.edit ? MODES.view : MODES.edit; } - function handleAppClick(appName) { + function handleAppClick(appName: string) { $apps.selectedApp = appName; $apps.open = true; } @@ -232,7 +233,7 @@ }, { label: 'Exercises', - badgeValue: $lesson.exercises.length, + badgeValue: data.isMaterialsTabActive ? $lesson.totalExercises : $lesson.exercises.length, isActive: !data.isMaterialsTabActive, href: `${path}/exercises` }