diff --git a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx index 3aa08cec..f4ceb215 100644 --- a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx +++ b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/course.tsx @@ -1,7 +1,7 @@ "use client"; import { removeCourse, startCourse } from "@services/courses/activity"; import Link from "next/link"; -import React, { use } from "react"; +import React, { use, useEffect, useState } from "react"; import { getUriWithOrg } from "@services/config/config"; import PageLoading from "@components/Objects/Loaders/PageLoading"; import { revalidateTags } from "@services/utils/ts/requests"; @@ -10,13 +10,25 @@ import { useRouter } from "next/navigation"; import GeneralWrapperStyled from "@components/StyledElements/Wrappers/GeneralWrapper"; import { getCourseThumbnailMediaDirectory } from "@services/media/media"; import { ArrowRight, Check, File, Sparkles, Star, Video } from "lucide-react"; +import Avvvatars from "avvvatars-react"; +import { getUser } from "@services/users/users"; const CourseClient = (props: any) => { + const [user, setUser] = useState({}); const courseid = props.courseid; const orgslug = props.orgslug; const course = props.course; const router = useRouter(); + + + async function getUserUI() { + let user_id = course.course.authors[0]; + const user = await getUser(user_id); + setUser(user); + console.log(user); + } + async function startCourseUI() { // Create activity await startCourse("course_" + courseid, orgslug); @@ -35,6 +47,10 @@ const CourseClient = (props: any) => { router.refresh(); } + useEffect(() => { + getUserUI(); + } + , []); return ( <> @@ -58,9 +74,9 @@ const CourseClient = (props: any) => {

Description

- -

{course.course.description}

-
+
+

{course.course.description}

+

What you will learn

@@ -101,7 +117,7 @@ const CourseClient = (props: any) => {

-
+
{activity.type === "dynamic" &&
@@ -119,7 +135,7 @@ const CourseClient = (props: any) => { }
- +

{activity.name}

@@ -161,13 +177,25 @@ const CourseClient = (props: any) => {
-
+
+ { user && +
+
+ +
+
+
Author
+
{user.full_name}
+
+
+ } + {course.trail.status == "ongoing" ? ( - ) : ( - + )}
diff --git a/front/services/users/users.ts b/front/services/users/users.ts new file mode 100644 index 00000000..798079ab --- /dev/null +++ b/front/services/users/users.ts @@ -0,0 +1,8 @@ +import { getAPIUrl } from "@services/config/config"; +import { RequestBody, errorHandling } from "@services/utils/ts/requests"; + +export async function getUser(user_id: string) { + const result = await fetch(`${getAPIUrl()}users/user_id/${user_id}`, RequestBody("GET", null, null)); + const res = await errorHandling(result); + return res; +} \ No newline at end of file