Skip to content

Commit 43c94df

Browse files
committed
feat: add dates and update cell text align
1 parent 7c5f46f commit 43c94df

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

src/app/types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ export type CorporateCourse = {
2121
id: string;
2222
catalogId: number;
2323
position: number;
24+
enrollments: number;
25+
certified: number;
26+
completionRate: number;
2427
courseRun: {
2528
id: string;
2629
displayName: string;
27-
}
30+
start: string | null;
31+
end: string | null;
32+
enrollmentStart: string | null;
33+
enrollmentEnd: string | null; }
2834
};
2935

3036
export type CorporateCatalog = {

src/courses/components/CoursesList.tsx

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@ const CoursesList = ({ partnerId, catalogId }: CoursesListProps) => {
3131
pageCount,
3232
isLoading,
3333
} = useCatalogCourses(partnerId, catalogId, pageIndex + 1, pageSize);
34-
const positions = Array.from({ length: count + 1 || 0 }, (_, i) => i);
3534
const deleteCatalogCourse = useDeleteCatalogCourse();
3635

36+
const positions = Array.from({ length: count + 1 || 0 }, (_, i) => i);
37+
const formatDate = (date: string | null) => {
38+
if (!date) return '';
39+
return intl.formatDate(date);
40+
};
41+
3742
const tableActions = [{
3843
type: 'view',
3944
action: (course) => navigate(paths.courseDetail.buildPath(partnerId, catalogId, course.courseRun.id)),
@@ -116,10 +121,28 @@ const CoursesList = ({ partnerId, catalogId }: CoursesListProps) => {
116121
{
117122
Header: intl.formatMessage(messages.headerCourseDates),
118123
accessor: 'courseDates',
124+
// eslint-disable-next-line react/no-unstable-nested-components
125+
Cell: ({ row }: CoursesCell) => {
126+
const { start, end } = row.original.courseRun;
127+
return (
128+
<>
129+
{`${formatDate(start)} - ${formatDate(end)}`}
130+
</>
131+
)
132+
}
119133
},
120134
{
121135
Header: intl.formatMessage(messages.headerEnrollmentDates),
122136
accessor: 'enrollmentDates',
137+
// eslint-disable-next-line react/no-unstable-nested-components
138+
Cell: ({ row }: CoursesCell) => {
139+
const { enrollmentStart, enrollmentEnd } = row.original.courseRun;
140+
return (
141+
<>
142+
{`${formatDate(enrollmentStart)} - ${formatDate(enrollmentEnd)}`}
143+
</>
144+
)
145+
}
123146
},
124147
{
125148
Header: intl.formatMessage(messages.headerEnrollment),
@@ -132,6 +155,11 @@ const CoursesList = ({ partnerId, catalogId }: CoursesListProps) => {
132155
{
133156
Header: intl.formatMessage(messages.headerCompletion),
134157
accessor: 'completionRate',
158+
Cell: ({ row }: CoursesCell) => (
159+
<>
160+
{row.original.completionRate}%
161+
</>
162+
),
135163
},
136164
]}
137165
>

src/index.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,16 @@
33

44
.course-name:hover {
55
text-decoration: none !important;
6+
}
7+
8+
button[aria-label="Copy description"] svg {
9+
width: 16px;
10+
height: 16px;
11+
}
12+
13+
.pgn__data-table td{
14+
text-align: center;
15+
}
16+
.pgn__data-table th:not(:first-of-type) span {
17+
margin: auto;
618
}

0 commit comments

Comments
 (0)