From be7b1ee5b5c539f77a7607557999ead67b2beaae Mon Sep 17 00:00:00 2001 From: swve Date: Thu, 12 Oct 2023 20:03:06 +0200 Subject: [PATCH] feat: redesign some parts of course page --- .../(withmenu)/course/[courseid]/course.tsx | 99 +++++++++++++++---- 1 file changed, 78 insertions(+), 21 deletions(-) diff --git a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx index a39c6865..dcd32aac 100644 --- a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx +++ b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx @@ -1,18 +1,15 @@ "use client"; -import { EyeOpenIcon, Pencil2Icon } from "@radix-ui/react-icons"; import { removeCourse, startCourse } from "@services/courses/activity"; import Link from "next/link"; import React, { use } from "react"; -import styled from "styled-components"; -import { getAPIUrl, getBackendUrl, getUriWithOrg } from "@services/config/config"; -import useSWR, { mutate } from "swr"; -import ToolTip from "@components/StyledElements/Tooltip/Tooltip"; +import { getUriWithOrg } from "@services/config/config"; import PageLoading from "@components/Objects/Loaders/PageLoading"; import { revalidateTags } from "@services/utils/ts/requests"; import ActivityIndicators from "@components/Pages/Courses/ActivityIndicators"; import { useRouter } from "next/navigation"; import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper"; import { getCourseThumbnailMediaDirectory } from "@services/media/media"; +import { ArrowRight, File, Sparkles, Star, Video } from "lucide-react"; const CourseClient = (props: any) => { const courseid = props.courseid; @@ -36,9 +33,6 @@ const CourseClient = (props: any) => { // Mutate course await revalidateTags(['courses'], orgslug); router.refresh(); - - // refresh page (FIX for Next.js BUG) - //window.location.reload(); } @@ -57,7 +51,6 @@ const CourseClient = (props: any) => {
-
@@ -70,38 +63,102 @@ const CourseClient = (props: any) => {

What you will learn

- - -

{course.learnings == ![] ? "no data" : course.learnings}

-
+
+ {course.course.learnings.map((learning: any) => { + return ( +
+
+ +
+

{learning}

+
+ ); + } + )} +

Course Lessons

- +
{course.chapters.map((chapter: any) => { return (
-

{chapter.name}

+
+

{chapter.name}

+

+ {chapter.activities.length} Activities +

+
{chapter.activities.map((activity: any) => { return ( <>

- {activity.name} - - - {" "} +

+
+
+ {activity.type === "dynamic" && +
+ +
+ } + {activity.type === "video" && +
+
+ } + {activity.type === "documentpdf" && +
+ +
+ } + +
+ +

{activity.name}

+ +
+ {activity.type === "dynamic" && + <> + +
+

Page

+
+ + + } + {activity.type === "video" && + <> + +
+

Video

+
+ + + } + {activity.type === "documentpdf" && + <> + +
+

Document

+
+ + + } +
+
); })}
); })} - +