-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create course,lessons,| display course,lessons
- Loading branch information
1 parent
1460079
commit 161add7
Showing
54 changed files
with
2,261 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
interface ILinks { | ||
text: string, | ||
link: string, | ||
} | ||
|
||
|
||
export const instructorLinksData = [ | ||
{ | ||
link: "/instructor/course/create", | ||
text: "Create Course" | ||
}, | ||
{ | ||
link: "/instructor", | ||
text: "Dashboard" | ||
} | ||
] as ILinks[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { instructorLinksData } from '@/data/linksData' | ||
import { useRouter } from 'next/router' | ||
import React from 'react' | ||
interface InstructorLayoutProps { | ||
children: React.ReactElement | ||
} | ||
|
||
|
||
export const InstructorLayout = ({ children }: InstructorLayoutProps) => { | ||
const router = useRouter() | ||
return ( | ||
<div> | ||
{ | ||
instructorLinksData.map((link, i) => ( | ||
<span | ||
className='bg-blue-600 text-white p-2 rounded-md m-3 cursor-pointer' | ||
key={i} onClick={() => router.push(link.link)} | ||
> | ||
{link.text} | ||
</span> | ||
)) | ||
} | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './InstructorLayout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './UserPages' | ||
export * from './UserPages' | ||
export * from './InstructorLayout' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import AWS from 'aws-sdk' | ||
|
||
AWS.config.update({ | ||
apiVersion: "us-east-1", | ||
credentials: { | ||
accessKeyId: process.env.AWS_ACCESS_KEY as string, | ||
secretAccessKey: process.env.AWS_SECRET_KEY as string | ||
} | ||
}) | ||
|
||
|
||
export const S3 = new AWS.S3() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Lesson } from '@prisma/client' | ||
import React from 'react' | ||
import { SingleLessonItem } from '../SingleLessonItem' | ||
interface CourseLessonsListProps { | ||
lessons: Lesson[] | ||
onPreviewClicked?: (video: string) => void | ||
} | ||
export const CourseLessonsList = ({ lessons, onPreviewClicked }: CourseLessonsListProps) => { | ||
const onClickItem = (video: string) => { | ||
onPreviewClicked && onPreviewClicked(video) | ||
} | ||
return ( | ||
<div className='space-y-2 p-2'> | ||
<h1 className='font-bold text-xl'>{lessons.length} Lessons</h1> | ||
{ | ||
lessons.map((l, li) => ( | ||
<SingleLessonItem onClick={() => { | ||
if(l.free_preview){ | ||
onClickItem(l.video) | ||
} | ||
} | ||
} index={li} lesson={l} key={li} /> | ||
)) | ||
} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './CourseLessonsList' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import { Course } from '@prisma/client' | ||
import Image from 'next/image' | ||
import { useRouter } from 'next/router' | ||
interface CourseCardProps extends Course { | ||
|
||
} | ||
export const CourseCard = ({ category, description, id, imagePreview, name, paid, price, userId }: CourseCardProps) => { | ||
const router = useRouter() | ||
return ( | ||
<div onClick={() => { router.push(`/instructor/course/${id}`) }} className='cursor-pointer relative border p-2 shadow-md rounded-[16px] flex items-center gap-x-4'> | ||
<div className='relative w-[100px] h-[100px] overflow-hidden'> | ||
<Image quality={100} src={imagePreview} alt='' className='object-contain' fill /> | ||
</div> | ||
<div> | ||
<h1 className='text-blue-700 text-xl font-bold'>{name}</h1> | ||
<p>{description}</p> | ||
<h1>type:{paid}</h1> | ||
<h1>price: {price}</h1> | ||
<h1>category:{category}</h1> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './InstructorCourseCard' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Course } from '@prisma/client' | ||
import Image from 'next/image' | ||
import React, { useState } from 'react' | ||
import { MdOutlineLanguage, MdSubtitles } from 'react-icons/md' | ||
import ReactPlayer from 'react-player' | ||
interface SingleCourseJumboTronProps { | ||
course: (Course & { | ||
Lesson: { | ||
video: string; | ||
}[]; | ||
user: { | ||
id: string; | ||
name: string | null; | ||
}; | ||
}) | ||
|
||
onClickPreview?: (video: string) => void | ||
} | ||
export const SingleCourseJumboTron = ({ | ||
course: { | ||
category, | ||
description, | ||
id, | ||
imagePreview, | ||
name, | ||
paid, | ||
price, | ||
userId, | ||
user, | ||
Lesson | ||
}, | ||
onClickPreview | ||
}: SingleCourseJumboTronProps) => { | ||
const [allowPlayer, setallowPlayer] = React.useState(false) | ||
React.useEffect(() => { | ||
if (typeof window !== "undefined") { | ||
setallowPlayer(true) | ||
} | ||
}, []) | ||
return ( | ||
<div className='min-h-[400px] bg-[#1C1D1F] flex gap-x-5 pl-28 pr-10 py-10'> | ||
<div className='flex-[0.7] flex justify-center flex-col flex-shrink-0 '> | ||
<h1 className='font-bold text-white text-4xl'>{name}</h1> | ||
<p className='text-white text-xl mt-5 line-clamp-3'>{description}</p> | ||
<div className='mt-4 text-white text-xs'>Created by <span className='text-[#89A4F5] underline underline-offset-2'>{user.name}</span></div> | ||
<div className='flex items-center gap-x-3 mt-3'> | ||
<div className='flex items-center gap-x-1'> | ||
<MdOutlineLanguage className='!text-white' color='white' size={20} /><span className='text-white text-xs'>English</span> | ||
</div> | ||
<div className='flex items-center gap-x-1'> | ||
<MdSubtitles className='!text-white' color='white' size={20} /><span className='text-white text-xs'>English [Auto]</span> | ||
</div> | ||
</div> | ||
</div> | ||
<div className='flex-[0.3] float-right flex items-center justify-center'> | ||
{ | ||
(Lesson.length > 0 && allowPlayer) && | ||
< div className='w-[100%] aspect-video cursor-pointer' onClick={() => { | ||
onClickPreview && onClickPreview(Lesson[0].video) | ||
}}> | ||
<ReactPlayer style={{ | ||
pointerEvents: "none" | ||
}} playing={false} light={imagePreview} url={Lesson[0].video} width={"100%"} height={"100%"} /> | ||
</div> | ||
}{ | ||
(Lesson.length === 0) && | ||
<div className='relative w-[100%] aspect-video'> | ||
<Image src={imagePreview} alt='' fill className='object-cover' /> | ||
</div> | ||
} | ||
</div> | ||
</div > | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './SingleCourseJumboTron' |
Oops, something went wrong.