Skip to content

Commit a1d9f68

Browse files
committed
fix: add back button and fix liter
1 parent 43c94df commit a1d9f68

File tree

4 files changed

+16
-22
lines changed

4 files changed

+16
-22
lines changed

.eslintrc.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
// eslint-disable-next-line import/no-extraneous-dependencies
22
const { createConfig } = require('@openedx/frontend-build');
33

4-
const config = createConfig('eslint');
4+
const config = createConfig('eslint', {
5+
rules: {
6+
'react/prop-types': 'off',
7+
},
8+
});
59

610
module.exports = config;

src/app/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type Learner = {
1818
};
1919

2020
export type CorporateCourse = {
21-
id: string;
21+
id: number;
2222
catalogId: number;
2323
position: number;
2424
enrollments: number;
@@ -30,7 +30,8 @@ export type CorporateCourse = {
3030
start: string | null;
3131
end: string | null;
3232
enrollmentStart: string | null;
33-
enrollmentEnd: string | null; }
33+
enrollmentEnd: string | null;
34+
}
3435
};
3536

3637
export type CorporateCatalog = {

src/courses/CoursesPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useCatalogDetails } from '@src/catalogs/hooks';
55
import { usePartnerDetails } from '@src/partner/hooks';
66
import { IconButton } from '@openedx/paragon';
77
import { LmsEditSquare } from '@openedx/paragon/icons';
8+
import { paths } from '@src/constants';
89
import CoursesList from './components/CoursesList';
910
import AppLayout from '../app/AppLayout';
1011

@@ -15,7 +16,7 @@ const CoursesPage = () => {
1516
const { partnerDetails } = usePartnerDetails({ partnerId });
1617

1718
return (
18-
<AppLayout>
19+
<AppLayout withBackButton backPath={paths.catalogs.buildPath(partnerId)}>
1920
{catalogDetails
2021
&& (
2122
<HeaderDescription

src/courses/components/CoursesList.tsx

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const CoursesList = ({ partnerId, catalogId }: CoursesListProps) => {
3535

3636
const positions = Array.from({ length: count + 1 || 0 }, (_, i) => i);
3737
const formatDate = (date: string | null) => {
38-
if (!date) return '';
38+
if (!date) { return ''; }
3939
return intl.formatDate(date);
4040
};
4141

@@ -124,25 +124,17 @@ const CoursesList = ({ partnerId, catalogId }: CoursesListProps) => {
124124
// eslint-disable-next-line react/no-unstable-nested-components
125125
Cell: ({ row }: CoursesCell) => {
126126
const { start, end } = row.original.courseRun;
127-
return (
128-
<>
129-
{`${formatDate(start)} - ${formatDate(end)}`}
130-
</>
131-
)
132-
}
127+
return `${formatDate(start)} - ${formatDate(end)}`;
128+
},
133129
},
134130
{
135131
Header: intl.formatMessage(messages.headerEnrollmentDates),
136132
accessor: 'enrollmentDates',
137133
// eslint-disable-next-line react/no-unstable-nested-components
138134
Cell: ({ row }: CoursesCell) => {
139135
const { enrollmentStart, enrollmentEnd } = row.original.courseRun;
140-
return (
141-
<>
142-
{`${formatDate(enrollmentStart)} - ${formatDate(enrollmentEnd)}`}
143-
</>
144-
)
145-
}
136+
return `${formatDate(enrollmentStart)} - ${formatDate(enrollmentEnd)}`;
137+
},
146138
},
147139
{
148140
Header: intl.formatMessage(messages.headerEnrollment),
@@ -155,11 +147,7 @@ const CoursesList = ({ partnerId, catalogId }: CoursesListProps) => {
155147
{
156148
Header: intl.formatMessage(messages.headerCompletion),
157149
accessor: 'completionRate',
158-
Cell: ({ row }: CoursesCell) => (
159-
<>
160-
{row.original.completionRate}%
161-
</>
162-
),
150+
Cell: ({ row }: CoursesCell) => `${row.original.completionRate}%`,
163151
},
164152
]}
165153
>

0 commit comments

Comments
 (0)