diff --git a/.vscode/settings.json b/.vscode/settings.json
index 7a73a41b..359ff4e4 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,2 +1,10 @@
{
-}
\ No newline at end of file
+ "prettier.jsxSingleQuote": true,
+ "prettier.singleQuote": true,
+ "svelte.plugin.svelte.format.config.singleQuote": true,
+ "editor.formatOnPaste": false,
+ "[svelte]": {
+ "editor.defaultFormatter": "svelte.svelte-vscode"
+},
+"editor.formatOnSave": true,
+}
diff --git a/src/components/CourseLandingPage/components/Editor/ReviewFormEditor.svelte b/src/components/CourseLandingPage/components/Editor/ReviewFormEditor.svelte
new file mode 100644
index 00000000..aca1f629
--- /dev/null
+++ b/src/components/CourseLandingPage/components/Editor/ReviewFormEditor.svelte
@@ -0,0 +1,99 @@
+
+
+
+
{#if selectedSection.key === 1}
{:else if selectedSection.key === 2}
@@ -156,10 +171,18 @@
{:else if selectedSection.key === 4}
{:else if selectedSection.key === 5}
-
+
{:else if selectedSection.key === 6}
+
+ {:else if selectedSection.key === 7}
{/if}
{/if}
+
+
diff --git a/src/components/CourseLandingPage/constants.ts b/src/components/CourseLandingPage/constants.ts
index 8207d4d8..ad331c4f 100644
--- a/src/components/CourseLandingPage/constants.ts
+++ b/src/components/CourseLandingPage/constants.ts
@@ -4,6 +4,7 @@ export const SECTION_KEYS = {
DESCRIPTION: '#description',
GOALS: '#goals',
LESSONS: '#lessons',
+ REVIEWS: '#reviews',
INSTRUCTOR: '#instructor',
};
@@ -24,6 +25,10 @@ export const NAV_ITEMS = [
key: SECTION_KEYS.LESSONS,
label: 'Lessons',
},
+ {
+ key: SECTION_KEYS.REVIEWS,
+ label: 'Reviews',
+ },
{
key: SECTION_KEYS.INSTRUCTOR,
label: 'Instructor',
diff --git a/src/components/CourseLandingPage/index.svelte b/src/components/CourseLandingPage/index.svelte
index e122830b..56984f9d 100644
--- a/src/components/CourseLandingPage/index.svelte
+++ b/src/components/CourseLandingPage/index.svelte
@@ -4,6 +4,8 @@
import { onMount } from 'svelte';
import pluralize from 'pluralize';
import { stores } from '@sapper/app';
+ import dayjs from 'dayjs';
+ import relativeTime from 'dayjs/plugin/relativeTime';
import Notebook from 'carbon-icons-svelte/lib/Notebook16/Notebook16.svelte'; //note
import PresentationFile from 'carbon-icons-svelte/lib/PresentationFile16/PresentationFile16.svelte'; // exercise
import Video from 'carbon-icons-svelte/lib/Video16/Video16.svelte'; //video
@@ -13,17 +15,37 @@
import PricingSection from './components/PricingSection.svelte';
import { getLectureNo } from '../Course/function';
import { NAV_ITEMS } from './constants';
+ import Avatar from '../../components/Avatar/index.svelte';
import Chip from '../Chip/index.svelte';
import { getEmbedId } from '../../utils/functions/formatYoutubeVideo';
- import type { Course, Lesson } from '../../utils/types';
+ import type { Course, Lesson, Review } from '../../utils/types';
+ import Modal from '../Modal/index.svelte';
+ import { reviewsModalStore } from './store';
+ import { VARIANTS } from './../PrimaryButton/constants';
+
+ dayjs.extend(relativeTime);
export let courseData: Course = {
id: '',
title: '',
description: '',
};
+ const ratingsImg = [
+ '/images/rating-1.svg',
+ '/images/rating-2.svg',
+ '/images/rating-3.svg',
+ '/images/rating-4.svg',
+ '/images/rating-5.svg',
+ ];
+
let lessons: Array
= [];
+ let reviews: Review[] = [];
let player: any;
+ let averageRating = 0;
+ let totalRatings = 0;
+
+ // initialize the expandDescription array with 'false' values for each review.
+ let expandDescription = Array(reviews.length).fill(false);
const { page } = stores();
// const paystackApi = paystack('');
@@ -59,6 +81,10 @@
window.player = plyr;
}
+ function toggleDescription(id: number) {
+ expandDescription[id] = !expandDescription[id];
+ }
+
onMount(() => {
window.onhashchange = locationHashChanged;
});
@@ -67,6 +93,14 @@
$: lessons = get(courseData, 'lessons', []);
$: instructor = courseData?.metadata?.instructor || {};
$: initPlyr(player, video);
+ $: {
+ reviews = get(courseData, 'metadata.reviews') || [];
+ totalRatings = reviews?.reduce(
+ (acc = 0, review) => acc + (review?.rating || 0),
+ 0
+ );
+ averageRating = totalRatings / reviews?.length;
+ }
@@ -75,7 +109,7 @@
-