Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/Courses/CourseCardUpcoming.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ const CourseCardUpcoming: React.FC<Props> = ({ course }) => {

return (
<div className="max-w-sm flex flex-col rounded overflow-hidden shadow-lg">
<div className="h-56 bg-green-400 text-blue-900 font-bold text-xl flex-none flex justify-center items-center">
<span>{t('upcomingCourse.courseComingSoon')}</span>
<div className="h-56 bg-green-400 text-blue-900 font-bold text-xl flex-none flex flex-col justify-center items-center">
<div>{t('upcomingCourse.courseComingSoon')}</div>
<div>{course.publish_date}</div>
</div>
<div className="flex-grow px-6 py-4">
<div className="title text-xl mb-2">{title}</div>
Expand Down
27 changes: 20 additions & 7 deletions src/components/LecturesList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from './styles'
import { ALLOWED_LECTURES_WHEN_NOT_LOGGED_IN } from '../../common/constants'
import { Lecture } from '../../types/api.types'
import Badge from '../General/Badge'

const StyledButton = styled.button<{ isRtl: boolean }>`
background: none;
Expand Down Expand Up @@ -61,7 +62,9 @@ const LectureList: React.FC<LectureListProps> = ({
return <StyledLockIcon />
}
const canWatch = (index: number) =>
isLoggedIn || (!isLoggedIn && index < ALLOWED_LECTURES_WHEN_NOT_LOGGED_IN)
isLoggedIn ||
(!isLoggedIn && index < ALLOWED_LECTURES_WHEN_NOT_LOGGED_IN) ||
!sortedLectures[index].upcoming
return (
<>
<StyledLectureList>
Expand All @@ -87,12 +90,22 @@ const LectureList: React.FC<LectureListProps> = ({
</StyledCount>

<StyledListBody>
<p className={`${isRtl ? 'rtl' : 'ltr'}`}>
<span className="text-gray-700">{lecture.title}</span>
</p>
<StyledDuration>
{formatDuration(lecture.duration)}
</StyledDuration>
<div className="flex">
<div className="flex flex-1 flex-col">
<p className={`${isRtl ? 'rtl' : 'ltr'}`}>
<span className="text-gray-700">{lecture.title}</span>
</p>
<StyledDuration>
{formatDuration(lecture.duration)}
</StyledDuration>
</div>
{lecture.upcoming && (
<div className="flex">
<Badge text="upcoming" color="green-500" />
<Badge text={lecture.publish_date} color="pink-600" />
</div>
)}
</div>
</StyledListBody>

<div>{lectureIcon(index)}</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/LecturesList/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const StyledCount = styled.div`
`
export const StyledListBody = styled.div`
position: relative;
padding: 16px 130px 16px 105px;
padding: 16px 16px 16px 105px;
:hover {
background-color: #fff;
}
Expand Down
1 change: 1 addition & 0 deletions src/pages/courses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const pageQuery = graphql`
slug
level
status
publish_date
tags {
tagName
}
Expand Down
2 changes: 2 additions & 0 deletions src/templates/LectureView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@ export const pageQuery = graphql`
duration
url
created_at
upcoming
publish_date
}
resources {
type
Expand Down
3 changes: 3 additions & 0 deletions src/types/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ export type Lecture = {
position: number
slug: string
created_at: string
upcoming: boolean | null
publish_date: string
}

export type Course = {
Expand All @@ -142,4 +144,5 @@ export type Course = {
resources: Resource[]
price: number
thumbnail: string | null
publish_date: string
}