2023-09-29 09:25:32 +01:00
|
|
|
<script lang="ts">
|
2023-08-10 12:23:10 +00:00
|
|
|
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
|
2023-08-15 14:28:51 +00:00
|
|
|
import { goto } from '$app/navigation';
|
2023-08-10 12:23:10 +00:00
|
|
|
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
|
|
|
|
|
import CoursesEmptyIcon from '$lib/components/Icons/CoursesEmptyIcon.svelte';
|
2023-09-30 09:56:42 +01:00
|
|
|
import { coursesInProgress } from '$lib/components/Courses/store';
|
2023-08-10 12:23:10 +00:00
|
|
|
|
2023-09-29 09:25:32 +01:00
|
|
|
const gotoCourse = (id: string | undefined) => {
|
|
|
|
|
if (!id) return;
|
2024-04-16 08:51:53 +01:00
|
|
|
goto(`/courses/${id}/lessons?next=true`);
|
2023-08-15 14:28:51 +00:00
|
|
|
};
|
2023-08-10 12:23:10 +00:00
|
|
|
</script>
|
|
|
|
|
|
2023-09-30 09:56:42 +01:00
|
|
|
<section class="h-full">
|
2023-08-10 12:23:10 +00:00
|
|
|
<p class="text-base font-semibold text-[#040F2D] pb-3 dark:text-white">Currently Learning</p>
|
2023-08-15 14:28:51 +00:00
|
|
|
<div
|
2023-11-07 08:51:49 +00:00
|
|
|
class="flex items-center flex-col border border-[#EAEAEA] dark:bg-neutral-800 gap-2 rounded w-full lg:h-[40vh] p-3"
|
2023-08-11 17:11:19 +00:00
|
|
|
>
|
2023-09-30 09:56:42 +01:00
|
|
|
{#if $coursesInProgress.length > 0}
|
|
|
|
|
<div class="w-full h-full flex flex-col justify-start overflow-y-auto">
|
|
|
|
|
{#each $coursesInProgress as course}
|
2023-08-10 12:23:10 +00:00
|
|
|
<div class="p-5">
|
2023-11-07 08:51:49 +00:00
|
|
|
<span class="flex flex-col lg:flex-row gap-3 items-start pb-5">
|
2023-09-29 09:25:32 +01:00
|
|
|
<img
|
|
|
|
|
src={course.logo || '/images/classroomio-course-img-template.jpg'}
|
|
|
|
|
alt="course"
|
2023-11-07 08:51:49 +00:00
|
|
|
class="hidden lg:block lg:w-[60px] lg:h-[60px]"
|
2023-09-29 09:25:32 +01:00
|
|
|
/>
|
2023-08-10 12:23:10 +00:00
|
|
|
<div class="w-full">
|
2023-09-29 09:25:32 +01:00
|
|
|
<p class="text-base font-semibold dark:text-white">{course.title}</p>
|
2023-08-15 14:28:51 +00:00
|
|
|
<p class="line-clamp-2 text-xs font-normal text-[#656565] dark:text-white">
|
2023-09-29 09:25:32 +01:00
|
|
|
{course.description}
|
2023-08-15 14:28:51 +00:00
|
|
|
</p>
|
2023-08-10 12:23:10 +00:00
|
|
|
</div>
|
|
|
|
|
<PrimaryButton
|
2023-08-15 14:28:51 +00:00
|
|
|
label="Continue"
|
2023-08-10 12:23:10 +00:00
|
|
|
variant={VARIANTS.OUTLINED}
|
|
|
|
|
className="rounded-none text-[#0233BD]"
|
2023-09-29 09:25:32 +01:00
|
|
|
onClick={() => gotoCourse(course.id)}
|
2023-08-10 12:23:10 +00:00
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
<div class="relative bg-[#EAEAEA] w-full h-1">
|
2023-09-29 09:25:32 +01:00
|
|
|
<div
|
2024-04-16 08:51:53 +01:00
|
|
|
style="width: {Math.round(
|
|
|
|
|
((course?.progress_rate ?? 0) / (course?.total_lessons ?? 0)) * 100
|
|
|
|
|
) || 0}%"
|
2023-09-29 09:25:32 +01:00
|
|
|
class={`absolute top-0 left-0 bg-primary-700 h-full`}
|
|
|
|
|
/>
|
2023-08-10 12:23:10 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
{/each}
|
|
|
|
|
</div>
|
2023-08-15 14:28:51 +00:00
|
|
|
{:else}
|
|
|
|
|
<div class="flex flex-col items-center">
|
|
|
|
|
<CoursesEmptyIcon />
|
2023-09-29 09:25:32 +01:00
|
|
|
<h3 class="text-center">No courses in progress yet</h3>
|
2023-08-15 14:28:51 +00:00
|
|
|
<p class="w-[75%] text-center">Once you start a course, your progress will reflect here</p>
|
|
|
|
|
</div>
|
2023-08-10 12:23:10 +00:00
|
|
|
{/if}
|
2023-08-15 14:28:51 +00:00
|
|
|
</div>
|
2023-08-10 12:23:10 +00:00
|
|
|
</section>
|