Skip to content
This repository was archived by the owner on Oct 5, 2023. It is now read-only.

Commit c34a21d

Browse files
authored
Features (#1028)
* Features * update * update * update * update
1 parent 1c43998 commit c34a21d

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

packages/web/src/App.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@
55
top: 0px !important;
66
left: 0px !important;
77
}
8+
.title-hightlight {
9+
color: rgb(255, 200, 45);
10+
}

packages/web/src/modules/StudyingCourse/Components/ClassworkLessons/ClassworkLessons.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const ClassworkLessons: FC<ClassworkLessonsProps> = () => {
4949
},
5050
},
5151
})
52-
const classworkLessons = useMemo(
52+
const classworkLessonsProps = useMemo(
5353
() => dataClasswork?.lessons.lessons ?? [],
5454
[dataClasswork?.lessons.lessons],
5555
)
@@ -58,6 +58,28 @@ const ClassworkLessons: FC<ClassworkLessonsProps> = () => {
5858
() => dataClasswork?.lessons.count ?? 0,
5959
[dataClasswork?.lessons.count],
6060
)
61+
62+
const classworkLessons: ANY[] = useMemo(() => classworkLessonsProps.map((item: ANY, index: ANY) => {
63+
const current = new Date()
64+
const startTime = new Date(item.startTime)
65+
const beforeLessonStartTime = classworkLessonsProps[index - 1]
66+
? new Date(classworkLessonsProps[index - 1]?.startTime)
67+
: current
68+
if (
69+
startTime.getTime() > current.getTime() &&
70+
beforeLessonStartTime.getTime() <= current.getTime()
71+
) {
72+
return {
73+
...item,
74+
isNext: true,
75+
}
76+
}
77+
return {
78+
...item,
79+
isNext: false,
80+
}
81+
}), [classworkLessonsProps])
82+
6183
if (!courseId) {
6284
return <div>Course not found</div>
6385
}
@@ -84,8 +106,14 @@ const ClassworkLessons: FC<ClassworkLessonsProps> = () => {
84106
{
85107
label: 'Tiêu đề',
86108
render: (classworkLesson, index) => (
87-
<Typography variant="body1" fontWeight="bold">
109+
<Typography
110+
variant="body1"
111+
fontWeight="bold"
112+
>
88113
<Link
114+
className={
115+
classworkLesson.isNext ? 'title-hightlight' : ''
116+
}
89117
to={buildPath(
90118
STUDYING_COURSE_DETAIL_CLASSWORK_LESSON,
91119
{
@@ -94,7 +122,9 @@ const ClassworkLessons: FC<ClassworkLessonsProps> = () => {
94122
},
95123
)}
96124
>
97-
Buổi {page === 0 ? index + 1 : index + 1 + (page * perPage)}: {classworkLesson.description}
125+
Buổi{' '}
126+
{page === 0 ? index + 1 : index + 1 + page * perPage}:{' '}
127+
{classworkLesson.description}{classworkLesson.isNext ? ' (Buổi tiếp theo)' : ''}
98128
</Link>
99129
</Typography>
100130
),

0 commit comments

Comments
 (0)