diff --git a/frontend/edu-connect/src/app/_partials/CommunitySection.tsx b/frontend/edu-connect/src/app/_partials/CommunitySection.tsx index 69e4724..0647476 100644 --- a/frontend/edu-connect/src/app/_partials/CommunitySection.tsx +++ b/frontend/edu-connect/src/app/_partials/CommunitySection.tsx @@ -6,8 +6,10 @@ import useSWR from 'swr' const CommunitySection = () => { - const {data : AuthorCount} = useSWR(APP_BASE_URL+'' , defaultFetcher); - const { data : TotalCourses } = useSWR(APP_BASE_URL + '' , defaultFetcher) + const {data : AuthorCount} = useSWR(APP_BASE_URL+'/api/public/stats/total-authors' , defaultFetcher); + const { data : TotalCourses } = useSWR(APP_BASE_URL + '/api/public/stats/total-courses' , defaultFetcher) + + console.log(AuthorCount , TotalCourses) return(
@@ -19,11 +21,11 @@ const CommunitySection = () => {

-

{}+

+

{AuthorCount?.totalAuthors}+

Expert Contributors

-

1000+

+

{TotalCourses?.totalCourses}+

Research-Based Courses

diff --git a/frontend/edu-connect/src/app/_partials/HeroSection.tsx b/frontend/edu-connect/src/app/_partials/HeroSection.tsx index 6888b7e..eb8d7bb 100644 --- a/frontend/edu-connect/src/app/_partials/HeroSection.tsx +++ b/frontend/edu-connect/src/app/_partials/HeroSection.tsx @@ -5,7 +5,8 @@ import Image from 'next/image'; import useSWR from "swr" const HeroSection: React.FC = () => { - const {data : TotalUserCount } = useSWR(APP_BASE_URL + '/api/user/count' , defaultFetcher) + const {data : TotalUserCount } = useSWR(APP_BASE_URL + '/api/public/stats/total-users' , defaultFetcher) + console.log(TotalUserCount) return (
@@ -40,7 +41,7 @@ const HeroSection: React.FC = () => { />
-

{}+

+

{TotalUserCount?.totalUsers}+

Active Learners

diff --git a/frontend/edu-connect/src/app/auth/login/_partials/LoginForm.tsx b/frontend/edu-connect/src/app/auth/login/_partials/LoginForm.tsx index bf2a3dc..b7d959f 100644 --- a/frontend/edu-connect/src/app/auth/login/_partials/LoginForm.tsx +++ b/frontend/edu-connect/src/app/auth/login/_partials/LoginForm.tsx @@ -3,7 +3,7 @@ import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/com import { Label } from "@/components/ui/label"; import { Input } from "@/components/ui/input"; import { Button } from "@/components/ui/button"; -import { EyeIcon, EyeOffIcon } from 'lucide-react'; +import { EyeIcon, EyeOffIcon, Loader } from 'lucide-react'; import Link from 'next/link'; import { routes } from '@/lib/routes'; import { useToast } from '@/hooks/use-toast'; @@ -82,8 +82,8 @@ export default function LoginForm() { },[router]) return ( -
- +
+ Login @@ -127,7 +127,14 @@ export default function LoginForm() { type="submit" className="w-full h-11 bg-purple-600 hover:bg-purple-700 text-white font-semibold" > - Login + { + loading ? + <> + + Login + + : 'Login' + }
diff --git a/frontend/edu-connect/src/app/courses/page.tsx b/frontend/edu-connect/src/app/courses/page.tsx new file mode 100644 index 0000000..a15be68 --- /dev/null +++ b/frontend/edu-connect/src/app/courses/page.tsx @@ -0,0 +1,46 @@ +'use client' +import { PageHeading } from "@/components/(dashboard)/ui/title" +import CommonContainer from "@/components/elements/CommonContainer" +import CourseCard from "@/components/elements/CourseCard" +import AppContextProvider from "@/helpers/context/AppContextProvider" +import { defaultFetcher } from "@/helpers/fetch.helper" +import { APP_BASE_URL } from "@/utils/constants" +import CommonView from "@/views/CommonView" +import React from "react" +import useSWR from "swr" + +const AllCourseList : React.FC = () => { + const { data } = useSWR(APP_BASE_URL + '/api/course/listAll' , defaultFetcher) + + console.log(data) + return( + + + + All Courses +
+ { + data?.data?.length && data?.data?.map((course) => { + return( + + ) + }) + } +
+
+
+
+ ) +} + +export default AllCourseList \ No newline at end of file diff --git a/frontend/edu-connect/src/app/my-courses/_partials/EnrolledCourseList.tsx b/frontend/edu-connect/src/app/my-courses/_partials/EnrolledCourseList.tsx index 35a480b..397d94f 100644 --- a/frontend/edu-connect/src/app/my-courses/_partials/EnrolledCourseList.tsx +++ b/frontend/edu-connect/src/app/my-courses/_partials/EnrolledCourseList.tsx @@ -5,7 +5,7 @@ import Image from "next/image" import useSWR from "swr" const EnrolledCourseTabContent : React.FC = () => { - const { data } = useSWR(APP_BASE_URL + '/' , defaultFetcher); + const { data } = useSWR(APP_BASE_URL + '/api/course/enrolled' , defaultFetcher); return ( <> diff --git a/frontend/edu-connect/src/app/my-courses/_partials/MyCoursesListTabContent.tsx b/frontend/edu-connect/src/app/my-courses/_partials/MyCoursesListTabContent.tsx index 278663f..f777952 100644 --- a/frontend/edu-connect/src/app/my-courses/_partials/MyCoursesListTabContent.tsx +++ b/frontend/edu-connect/src/app/my-courses/_partials/MyCoursesListTabContent.tsx @@ -1,3 +1,4 @@ +import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" import { defaultFetcher } from "@/helpers/fetch.helper" import { APP_BASE_URL } from "@/utils/constants" @@ -5,7 +6,8 @@ import Image from "next/image" import useSWR from "swr" const MyCoursesListTabContent = () => { - const { data } = useSWR(APP_BASE_URL + '/' , defaultFetcher); + const { data } = useSWR(APP_BASE_URL + '/api/course/myCourses' , defaultFetcher); + console.log(data) return ( <> @@ -20,7 +22,7 @@ const MyCoursesListTabContent = () => { <>
@@ -30,7 +32,7 @@ const MyCoursesListTabContent = () => {

- {course.title} + {course.name}

{course.description}

@@ -38,25 +40,35 @@ const MyCoursesListTabContent = () => {
- Published: - {course.publishedDate} - - - Enrolled: - - {course.enrolledStudent} students + { + course.publishedDate == '1' + ? Published + : course.publishedDate == '1' + ? Pending + : Rejected + } + +
+ +
- Active Discussions: - - {course.activeDiscussionCount} + Enrolled: + + {course.totalEnrolled ?? 0} students + + + + + + {course.activeDiscussionCount ?? 0} discussions + + + + Published by: + {course?.author?.firstName ?? '-'} - - - Published by: - {course.publishedBy} -
diff --git a/frontend/edu-connect/src/app/my-courses/_partials/myCoursesTabWrapper.tsx b/frontend/edu-connect/src/app/my-courses/_partials/myCoursesTabWrapper.tsx index 1ad4f93..b135dd2 100644 --- a/frontend/edu-connect/src/app/my-courses/_partials/myCoursesTabWrapper.tsx +++ b/frontend/edu-connect/src/app/my-courses/_partials/myCoursesTabWrapper.tsx @@ -20,7 +20,7 @@ const MyCoursesWrapper = () => { value="enrolled" className="justify-start w-full px-3 py-2 text-left data-[state=active]:bg-gray-50 data-[state=active]:border data-[state=active]:border-purple-700/50 rounded-md" > - Enrolled Course List + Enrolled Course {
{/* Logo */} -
+ {'brand_logo'}

- EDU CONNECT + EduCONNECT

-
+
diff --git a/frontend/edu-connect/src/components/elements/CourseCard.tsx b/frontend/edu-connect/src/components/elements/CourseCard.tsx index 9da799e..9261799 100644 --- a/frontend/edu-connect/src/components/elements/CourseCard.tsx +++ b/frontend/edu-connect/src/components/elements/CourseCard.tsx @@ -8,10 +8,10 @@ interface CourseInterface { id : string , image :string | null title : string - category : string - lessons : string - duration : string - instructor : { + category ?: string + lessons ?: string + duration? : string + instructor ?: { image : string name : string } @@ -28,20 +28,23 @@ const CourseCard : React.FC = ({ }) => { return( -
- - {title} - - {category} - - {/* */} -
+ + +
+ + {title} + + {category} + + {/* */} +
+
diff --git a/frontend/edu-connect/src/lib/routes.ts b/frontend/edu-connect/src/lib/routes.ts index 011951d..1a53bf6 100644 --- a/frontend/edu-connect/src/lib/routes.ts +++ b/frontend/edu-connect/src/lib/routes.ts @@ -5,7 +5,8 @@ export const routes = { DASHBOARD_ROUTE : '/admin/dashboard', PROFILE_ROUTE : '/user/profile', MY_COURSES_INDEX : '/my-courses', - USER_INDEX_PAGE : '/admin/users' + USER_INDEX_PAGE : '/admin/users', + COURSE_INDIVIDUAL_PAGE : '/course/show/:id' } export const privateRoutes = ['/user/profile']