diff --git a/package.json b/package.json
index bf03aecc..cd28d32a 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"@types/paystack": "^2.0.1",
"@types/pluralize": "0.0.30",
"ai": "^2.1.31",
+ "axios": "^1.5.1",
"body-parser": "^1.20.2",
"canvas-confetti": "^1.6.0",
"cookie-parser": "^1.4.6",
diff --git a/src/lib/components/Course/components/Navigation/NavExpandable.svelte b/src/lib/components/Course/components/Navigation/NavExpandable.svelte
index fd1e1dec..45de3018 100644
--- a/src/lib/components/Course/components/Navigation/NavExpandable.svelte
+++ b/src/lib/components/Course/components/Navigation/NavExpandable.svelte
@@ -5,12 +5,14 @@
import IconButton from '$lib/components/IconButton/index.svelte';
import { NavClasses } from '$lib/utils/constants/reusableClass';
import NavIcons from './NavIcons.svelte';
+ import { SkeletonPlaceholder, SkeletonText } from 'carbon-components-svelte';
export let handleClick = () => {};
export let label = '';
export let isGroupActive = false;
export let isExpanded = true;
export let total = 0;
+ export let isLoading = true;
// export let subMenuItems = [];
function onClick() {
@@ -23,32 +25,39 @@
-
- {#if isExpanded}
-
-
+ {#if isLoading}
+
+
+ {:else}
+
+ {#if isExpanded}
+
+
+
+ {/if}
{/if}
diff --git a/src/lib/components/Course/components/Navigation/index.svelte b/src/lib/components/Course/components/Navigation/index.svelte
index 8932b047..5c6c4176 100644
--- a/src/lib/components/Course/components/Navigation/index.svelte
+++ b/src/lib/components/Course/components/Navigation/index.svelte
@@ -255,6 +255,7 @@
isGroupActive={(path || $page.url.pathname) === navItem.to}
isExpanded={isLessonActive}
total={navItem.isLecture ? ($lessons || []).length : 0}
+ isLoading={!$course.id}
>
{#if navItem.isLecture}
{#each $lessons as item, index}
diff --git a/src/lib/components/Course/components/People/InviationModal.svelte b/src/lib/components/Course/components/People/InviationModal.svelte
index 1957f44f..9eac8e72 100644
--- a/src/lib/components/Course/components/People/InviationModal.svelte
+++ b/src/lib/components/Course/components/People/InviationModal.svelte
@@ -12,10 +12,12 @@
import { currentOrg } from '$lib/utils/store/org';
import { getOrgTeam } from '$lib/utils/services/org';
import type { OrgTeamMember } from '$lib/utils/types/org';
- import { sendTeacherCourseWelcome } from './utils';
- import type { Course } from '$lib/utils/types';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import { getStudentInviteLink } from '$lib/utils/functions/course';
+ import {
+ triggerSendEmail,
+ NOTIFICATION_NAME
+ } from '$lib/utils/services/notification/notification';
interface Tutor {
id: number;
@@ -52,7 +54,7 @@
role_id: ROLE.TUTOR
});
- sendTeacherCourseWelcome({
+ triggerSendEmail(NOTIFICATION_NAME.WELCOME_TEACHER_TO_COURSE, {
to: tutor.email,
name: tutor.text,
orgName: $currentOrg.name,
diff --git a/src/lib/components/Course/components/People/utils.ts b/src/lib/components/Course/components/People/utils.ts
deleted file mode 100644
index 5b2e9f39..00000000
--- a/src/lib/components/Course/components/People/utils.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { supabase } from '$lib/utils/functions/supabase';
-
-export async function sendTeacherCourseWelcome(params: {
- to: string;
- name: string;
- orgName: string;
- orgSiteName: string;
- courseName: string;
-}) {
- const { data } = await supabase.auth.getSession();
- const accessToken = data.session?.access_token || '';
-
- try {
- const response = await fetch('/api/email/course/teacher_welcome', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- Authorization: accessToken
- },
- body: JSON.stringify(params)
- });
- if (!response.ok) {
- throw new Error(await response.text());
- }
- const result = await response.json();
-
- console.log('Sent invite email', result);
- } catch (error) {
- console.error('Error sending invite email', error);
- }
-}
diff --git a/src/lib/components/CourseLandingPage/components/PaymentModal.svelte b/src/lib/components/CourseLandingPage/components/PaymentModal.svelte
index 25c778ef..d42a8c88 100644
--- a/src/lib/components/CourseLandingPage/components/PaymentModal.svelte
+++ b/src/lib/components/CourseLandingPage/components/PaymentModal.svelte
@@ -4,8 +4,11 @@
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { coursePaymentValidation } from '$lib/utils/functions/validator';
import { Link } from 'carbon-components-svelte';
- import { sendTeacherStudentJoinRequest, sendStudentRequestReceipt } from './utils';
import { currentOrg } from '$lib/utils/store/org';
+ import {
+ triggerSendEmail,
+ NOTIFICATION_NAME
+ } from '$lib/utils/services/notification/notification';
export let open = false;
export let paymentLink = '';
@@ -41,7 +44,7 @@
step = STEPS.STEP_2;
// Send email to first added teacher of student wanting to join
- sendTeacherStudentJoinRequest({
+ triggerSendEmail(NOTIFICATION_NAME.SEND_TEACHER_STUDENT_BUY_REQUEST, {
to: teacherEmail,
courseName,
studentEmail: fields.email,
@@ -54,7 +57,7 @@
function onClickPaymentLink() {
// Send email to student to send proof of payment to teacher
- sendStudentRequestReceipt({
+ triggerSendEmail(NOTIFICATION_NAME.STUDENT_PROOVE_COURSE_PAYMENT, {
to: fields.email,
courseName,
teacherEmail,
diff --git a/src/lib/components/CourseLandingPage/components/utils.ts b/src/lib/components/CourseLandingPage/components/utils.ts
deleted file mode 100644
index 282ab3e7..00000000
--- a/src/lib/components/CourseLandingPage/components/utils.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { supabase } from '$lib/utils/functions/supabase';
-
-export async function sendTeacherStudentJoinRequest(params: {
- to: string;
- courseName: string;
- studentEmail: string;
- studentFullname: string;
-}) {
- const { data } = await supabase.auth.getSession();
- const accessToken = data.session?.access_token || '';
-
- try {
- const response = await fetch('/api/email/course/teacher_student_buycourse', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- Authorization: accessToken
- },
- body: JSON.stringify(params)
- });
- if (!response.ok) {
- throw new Error(await response.text());
- }
- const result = await response.json();
-
- console.log('Sent invite email', result);
- } catch (error) {
- console.error('Error sending invite email', error);
- }
-}
-
-export async function sendStudentRequestReceipt(params: {
- to: string;
- courseName: string;
- orgName: string;
- studentFullname: string;
- teacherEmail: string;
-}) {
- const { data } = await supabase.auth.getSession();
- const accessToken = data.session?.access_token || '';
-
- try {
- const response = await fetch('/api/email/course/student_prove_payment', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json',
- Authorization: accessToken
- },
- body: JSON.stringify(params)
- });
- if (!response.ok) {
- throw new Error(await response.text());
- }
- const result = await response.json();
-
- console.log('Sent invite email', result);
- } catch (error) {
- console.error('Error sending invite email', error);
- }
-}
diff --git a/src/lib/components/Navigation/lms.svelte b/src/lib/components/Navigation/lms.svelte
index 6a50d8e9..20b6d1f7 100644
--- a/src/lib/components/Navigation/lms.svelte
+++ b/src/lib/components/Navigation/lms.svelte
@@ -1,4 +1,4 @@
-