Skip to content

Commit d089dde

Browse files
committed
fix: solve lint issues
1 parent 0748c5f commit d089dde

9 files changed

Lines changed: 39 additions & 43 deletions

src/learningpath/CourseCard.jsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, { useMemo, useState } from 'react';
22
import PropTypes from 'prop-types';
3-
import { Link } from 'react-router-dom';
43
import {
5-
Card, Button, Col, ProgressBar, Chip, PageBanner, Icon,
4+
Card, Button, Icon,
65
} from '@openedx/paragon';
76
import {
87
AccessTime,
@@ -20,7 +19,12 @@ import { buildCourseHomeUrl } from './utils';
2019
import { useScreenSize } from '../hooks/useScreenSize';
2120

2221
export const CourseCard = ({
23-
course, relatedLearningPaths, onClick, onClickViewButton, isEnrolledInLearningPath, showFilters = false, orientationOverride, isEnrolledInCourse = false,
22+
course,
23+
onClick,
24+
onClickViewButton,
25+
isEnrolledInLearningPath,
26+
showFilters = false,
27+
orientationOverride,
2428
}) => {
2529
const { formatMessage } = useIntl();
2630
const {
@@ -51,8 +55,6 @@ export const CourseCard = ({
5155
prefetchCourseDetail();
5256
};
5357

54-
const linkTo = buildCourseHomeUrl(course.id);
55-
5658
let buttonText = formatMessage(messages.startCourse);
5759

5860
switch (status?.toLowerCase()) {
@@ -175,10 +177,6 @@ CourseCard.propTypes = {
175177
percent: PropTypes.number.isRequired,
176178
checkingEnrollment: PropTypes.bool,
177179
}).isRequired,
178-
relatedLearningPaths: PropTypes.arrayOf(PropTypes.shape({
179-
name: PropTypes.string.isRequired,
180-
key: PropTypes.string.isRequired,
181-
})),
182180
onClick: PropTypes.func,
183181
onClickViewButton: PropTypes.func,
184182
isEnrolledInLearningPath: PropTypes.bool,

src/learningpath/CourseDetails.jsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ const CourseDetailContent = ({
5656

5757
const { isSmall } = useScreenSize();
5858
const navigate = useNavigate();
59+
const paceText = selfPaced
60+
? formatMessage(messages.selfPaced)
61+
: formatMessage(messages.instructorPaced);
62+
const aboutHtml = replaceStaticAssetReferences(
63+
description || shortDescription || formatMessage(messages.noDescription),
64+
course.id,
65+
);
66+
const scheduleText = selfPaced
67+
? formatMessage(messages.progressAtYourOwnSpeed)
68+
: formatMessage(messages.followCourseSchedule);
5969
const handleClose = onClose || (() => navigate(-1));
6070
const { courseKey: urlCourseKey } = useParams();
6171
const activeCourseKey = course.id || urlCourseKey;
@@ -148,10 +158,8 @@ const CourseDetailContent = ({
148158
<div className="d-flex align-items-center">
149159
<Icon src={Person} className="mr-4 mb-3.5" />
150160
<div>
151-
<p className="mb-0 font-weight-bold">{selfPaced ? formatMessage(messages.selfPaced) : formatMessage(messages.instructorPaced)}</p>
152-
<p className="mb-0 text-muted">
153-
{selfPaced ? formatMessage(messages.progressAtYourOwnSpeed) : formatMessage(messages.followCourseSchedule)}
154-
</p>
161+
<p className="mb-0 font-weight-bold">{paceText}</p>
162+
<p className="mb-0 text-muted">{scheduleText}</p>
155163
</div>
156164
</div>
157165
</Row>
@@ -172,10 +180,7 @@ const CourseDetailContent = ({
172180
<div className="py-3">
173181
<section id="about">
174182
{/* eslint-disable-next-line react/no-danger */}
175-
<div dangerouslySetInnerHTML={{
176-
__html: replaceStaticAssetReferences(description || shortDescription || formatMessage(messages.noDescription), course.id),
177-
}}
178-
/>
183+
<div dangerouslySetInnerHTML={{ __html: aboutHtml }} />
179184
</section>
180185
</div>
181186
</>
@@ -205,6 +210,7 @@ const CourseDetailPage = ({
205210
courseKey: propCourseKey,
206211
learningPathTitle,
207212
}) => {
213+
const { formatMessage } = useIntl();
208214
const { courseKey: urlCourseKey } = useParams();
209215
const courseKey = propCourseKey || urlCourseKey;
210216

src/learningpath/DataSharingAuthorizationModal.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
33
import {
4-
ModalDialog, Button, Alert, Stack,
4+
ModalDialog, Button, Stack,
55
} from '@openedx/paragon';
66
import { useIntl } from '@edx/frontend-platform/i18n';
77
import messages from './message';
88

9-
export default function DataSharingAuthorizationModal({
9+
const DataSharingAuthorizationModal = ({
1010
isOpen,
1111
onClose,
1212
onAllow,
1313
partnerName = 'Corporate Partner Name',
1414
additionalMessage,
15-
}) {
15+
}) => {
1616
const { formatMessage } = useIntl();
1717
return (
1818
<ModalDialog
@@ -54,7 +54,7 @@ export default function DataSharingAuthorizationModal({
5454
</ModalDialog.Body>
5555

5656
<ModalDialog.Footer>
57-
<Button className='mr-2' variant="tertiary" onClick={onClose}>
57+
<Button className="mr-2" variant="tertiary" onClick={onClose}>
5858
{formatMessage(messages.dataSharingDoNotShare)}
5959
</Button>
6060
<Button variant="primary" onClick={onAllow}>
@@ -63,7 +63,9 @@ export default function DataSharingAuthorizationModal({
6363
</ModalDialog.Footer>
6464
</ModalDialog>
6565
);
66-
}
66+
};
67+
68+
export default DataSharingAuthorizationModal;
6769

6870
DataSharingAuthorizationModal.propTypes = {
6971
isOpen: PropTypes.bool.isRequired,

src/learningpath/FilterPanel.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
33
import {
44
Button, ButtonGroup, Form, Icon, IconButton,
55
} from '@openedx/paragon';
6-
import { FilterList, Close } from '@openedx/paragon/icons';
6+
import { Close } from '@openedx/paragon/icons';
77
import { useIntl } from '@edx/frontend-platform/i18n';
88
import messages from './message';
99

src/learningpath/LearningPathDetails.jsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useMemo, useState, useEffect } from 'react';
22
import { useParams, Link, useSearchParams } from 'react-router-dom';
33
import {
4-
Row, Spinner, Nav, Icon, ModalLayer, Button, Chip, Card, Collapsible, Col,
4+
Row, Spinner, Icon, ModalLayer, Button, Chip, Card, Collapsible, Col,
55
Stack,
66
} from '@openedx/paragon';
77
import {
@@ -65,6 +65,8 @@ const LearningPathDetailPage = () => {
6565

6666
const [isModalOpen, setIsModalOpen] = useState(false);
6767

68+
const enrollMutation = useEnrollLearningPath();
69+
6870
const handleDoNotShare = () => {
6971
setIsModalOpen(false);
7072
};
@@ -94,8 +96,6 @@ const LearningPathDetailPage = () => {
9496
error: coursesError,
9597
} = useCoursesByIds(courseIds);
9698

97-
const enrollMutation = useEnrollLearningPath();
98-
9999
const accessUntilDate = useMemo(() => {
100100
if (!coursesForPath) {
101101
return null;
@@ -184,11 +184,8 @@ const LearningPathDetailPage = () => {
184184
const {
185185
name,
186186
image,
187-
subtitle,
188187
duration,
189188
timeCommitment,
190-
requiredSkills,
191-
description,
192189
enrollmentDate,
193190
} = detail;
194191

src/learningpath/data/queries.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ export const useLearningPaths = () => {
4747
queryFn: api.fetchAllCourseCompletions,
4848
});
4949

50-
const completions = queryClient.getQueryData(QUERY_KEYS.COURSE_COMPLETIONS) || {};
51-
const completionsMap = createCompletionsMap(completions);
52-
5350
const learningPathList = await api.fetchLearningPaths();
5451

5552
return learningPathList.map(lp => {
@@ -78,8 +75,8 @@ export const useLearningPaths = () => {
7875
percent = Math.round(progress * 100);
7976
}
8077

81-
let minDate = null;
82-
let maxDate = null;
78+
const minDate = null;
79+
const maxDate = null;
8380

8481
return {
8582
...lp,

src/learningpath/progress/CourseWithProgress.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import ProgressIndicator from './ProgressIndicator';
32
import { CourseCardWithEnrollment } from '../CourseCard';
43
import { Course } from './types';
54

src/learningpath/progress/CoursesWithProgressList.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@ const CoursesWithProgressList: React.FC<CoursesWithProgressListProps> = ({
1515
learningPathId,
1616
isEnrolledInLearningPath = false,
1717
onCourseClick,
18-
}) => {
19-
20-
return (
21-
<Container fluid className="py-4 learning-path-courses-grid w-100 px-0">
18+
}) => (
19+
<Container fluid className="py-4 learning-path-courses-grid w-100 px-0">
2220
<Row className="g-12">
2321
{courses.map((course) => (
2422
<Col key={course.id} xs={12} sm={6} md={6} lg={6} xl={4}>
@@ -32,7 +30,6 @@ const CoursesWithProgressList: React.FC<CoursesWithProgressListProps> = ({
3230
))}
3331
</Row>
3432
</Container>
35-
);
36-
};
33+
);
3734

3835
export default CoursesWithProgressList;

src/learningpath/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export const buildCourseHomeUrl = (courseId) => {
1616

1717
export const buildMarketingSiteCourseUrl = (courseId) => {
1818
const marketingSiteBase = getConfig().MARKETING_SITE_BASE_URL;
19-
return `${marketingSiteBase}/${courseId}`
19+
return `${marketingSiteBase}/${courseId}`;
2020
};
2121

2222
export const buildCourseAboutUrl = (courseId) => {
2323
const lmsBaseUrl = getConfig().LMS_BASE_URL;
2424
const trimmedBase = lmsBaseUrl.replace(/\/$/, '');
2525
return `${trimmedBase}/courses/${courseId}/about`;
26-
}
26+
};

0 commit comments

Comments
 (0)