diff --git a/src/lib/components/Courses/components/Card/index.svelte b/src/lib/components/Courses/components/Card/index.svelte index 592aadde..28a2eb65 100644 --- a/src/lib/components/Courses/components/Card/index.svelte +++ b/src/lib/components/Courses/components/Card/index.svelte @@ -17,8 +17,6 @@ export let isLMS = false; export let progressRate = 45; - $: console.log(progressRate); - $: formatter = getCurrencyFormatter(currency); diff --git a/src/lib/components/Courses/store.ts b/src/lib/components/Courses/store.ts index def11467..62c63fa0 100644 --- a/src/lib/components/Courses/store.ts +++ b/src/lib/components/Courses/store.ts @@ -1,7 +1,10 @@ -import { writable } from 'svelte/store'; +import { writable, derived } from 'svelte/store'; import type { Course } from '$lib/utils/types'; export const courses = writable([]); +export const courseInProgress = derived(courses, ($courses) => + $courses.length > 0 ? $courses.slice(0, 3) : [] +); export const courseMetaDeta = writable({ isLoading: true }); @@ -23,4 +26,5 @@ export const copyCourseModalInitialState = { isSaving: false, error: null }; + export const copyCourseModal = writable({ ...copyCourseModalInitialState }); diff --git a/src/lib/components/LMS/components/Completed.svelte b/src/lib/components/LMS/components/Completed.svelte deleted file mode 100644 index 0da8ae87..00000000 --- a/src/lib/components/LMS/components/Completed.svelte +++ /dev/null @@ -1,72 +0,0 @@ - - -
- {#if courseCompleted.length > 0} -
- {#each courseCompleted as data}s -
-
- course -
-
-

- {data.title} -

-

- {data.description} -

-

By {data.author}

- - -

{data.lessons} lessons

- {#if data.inProgress} -
-
-
-
-

{data.progressRate}%

-
- {/if} - - - -
-
- {/each} -
- {:else} - - -

No courses completed yet

-

- Courses you complete will appear here. We believe in you , finish hard 💪🏾. -

-
- {/if} -
diff --git a/src/lib/components/LMS/components/InProgress.svelte b/src/lib/components/LMS/components/InProgress.svelte deleted file mode 100644 index ebef63ae..00000000 --- a/src/lib/components/LMS/components/InProgress.svelte +++ /dev/null @@ -1,35 +0,0 @@ - - -
- {#if courseInProgress.length > 0} -
- {#each courseInProgress as data} - {#key data.id} - - {/key} - {/each} -
- {:else} - - -

No course progress yet

-

- Once you start a course, your progress will reflect here -

-
- {/if} -
diff --git a/src/lib/components/LMS/components/Learning.svelte b/src/lib/components/LMS/components/Learning.svelte index bddd12fc..6cbc6c8a 100644 --- a/src/lib/components/LMS/components/Learning.svelte +++ b/src/lib/components/LMS/components/Learning.svelte @@ -1,14 +1,13 @@ - @@ -17,27 +16,34 @@
- {#if courseInProgress.length > 0} + {#if $courseInProgress.length > 0}
- {#each courseInProgress as data, index} + {#each $courseInProgress as course}
- +
-

{data.title}

+

{course.title}

- {data.description} + {course.description}

gotoCourse(data.title)} + onClick={() => gotoCourse(course.id)} />
-
+
{/each} @@ -45,7 +51,7 @@ {:else}
-

No courses progress yet

+

No courses in progress yet

Once you start a course, your progress will reflect here

{/if} diff --git a/src/lib/components/LMS/components/Profile.svelte b/src/lib/components/LMS/components/Profile.svelte index de3f19b0..99c5c95a 100644 --- a/src/lib/components/LMS/components/Profile.svelte +++ b/src/lib/components/LMS/components/Profile.svelte @@ -14,7 +14,6 @@ async function logout() { const { error } = await supabase.auth.signOut(); - console.log('error logout', error); goto('/login'); } diff --git a/src/lib/components/LMS/components/Student.svelte b/src/lib/components/LMS/components/Schedule.svelte similarity index 98% rename from src/lib/components/LMS/components/Student.svelte rename to src/lib/components/LMS/components/Schedule.svelte index df33c87a..24146b58 100644 --- a/src/lib/components/LMS/components/Student.svelte +++ b/src/lib/components/LMS/components/Schedule.svelte @@ -23,8 +23,6 @@ } } }; - - // just copy and paste
diff --git a/src/lib/components/LMS/components/store.js b/src/lib/components/LMS/components/store.js deleted file mode 100644 index 38891821..00000000 --- a/src/lib/components/LMS/components/store.js +++ /dev/null @@ -1,45 +0,0 @@ -export const mockData = [ - { - id: '1', - title: 'Photo editing 101', - description: - 'Learn the different techniques to edit photos using Adobe Lightroom.Learn the basics of figma and start design web apps for the world ...Learn the basics of figma and start design web apps for the world ...', - author: 'Derrick Amenuvue', - lessons: 8, - inProgress: true, - completed: false, - src: '/digital.svg', - progress: 'w-[45%]', - progressRate: 45 - }, - { - id: '2', - title: 'Colorful digital painting', - description: - 'Learn the different techniques to edit photos using Adobe Lightroom.Learn the basics of figma and start design web apps for the world ...Learn the basics of figma and start design web apps for the world ...', - author: 'Derrick Amenuvue', - inProgress: true, - completed: false, - lessons: 5, - src: '/painting.svg', - progress: 'w-[30%]', - progressRate: 45 - }, - { - id: '3', - title: 'AI for dummys', - description: - 'Learn the different techniques to edit photos using Adobe Lightroom.Learn the basics of figma and start design web apps for the world ...Learn the basics of figma and start design web apps for the world ...', - author: 'Derrick Amenuvue', - inProgress: false, - completed: false, - lessons: 18, - src: '/digital.svg', - progress: 'w-[45%]', - progressRate: 45 - } -]; -export const courseInProgress = mockData.filter((course) => course.inProgress); -export const courseCompleted = mockData.filter((course) => course.completed); -export const totalCourses = mockData.length; -export const progressPercentage = Math.round((courseInProgress.length / totalCourses) * 100); diff --git a/src/routes/lms/+page.svelte b/src/routes/lms/+page.svelte index ccba2ca9..e122c6a2 100644 --- a/src/routes/lms/+page.svelte +++ b/src/routes/lms/+page.svelte @@ -1,14 +1,45 @@ - @@ -41,7 +72,7 @@
- +
@@ -58,12 +89,12 @@

Your Progress

- {#if courseInProgress.length > 0} + {#if totalLessons > 0}

- {courseInProgress.length}/{totalCourses} lessons in progress + {totalComPleted}/{totalLessons} lessons completed

{:else} -

No lessons started

+

No courses started

{/if}

diff --git a/src/routes/lms/mylearning/+page.svelte b/src/routes/lms/mylearning/+page.svelte index 35ec4614..6f859f8e 100644 --- a/src/routes/lms/mylearning/+page.svelte +++ b/src/routes/lms/mylearning/+page.svelte @@ -1,14 +1,9 @@
@@ -58,7 +35,7 @@ - +