Skip to content

Commit 11e68a0

Browse files
committed
refactor: change plugin files to tsx,remove propTypes
1 parent cc9fd08 commit 11e68a0

File tree

3 files changed

+21
-30
lines changed
  • src/plugin-slots/CourseExitPluginSlots

3 files changed

+21
-30
lines changed

src/plugin-slots/CourseExitPluginSlots/CourseExitViewCoursesPluginSlot/index.jsx renamed to src/plugin-slots/CourseExitPluginSlots/CourseExitViewCoursesPluginSlot/index.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { PluginSlot } from '@openedx/frontend-plugin-framework';
55
import { useIntl } from '@edx/frontend-platform/i18n';
66
import messages from '../../../courseware/course/course-exit/messages';
77

8-
const ViewCoursesLink = ({ content }) => {
8+
interface Props {
9+
content: { href: string }
10+
}
11+
12+
const ViewCoursesLink: React.FC<Props> = ({ content }) => {
913
const intl = useIntl();
1014
return (
1115
<div className="row w-100 mt-2 mb-4 justify-content-end">
@@ -19,13 +23,7 @@ const ViewCoursesLink = ({ content }) => {
1923
);
2024
};
2125

22-
ViewCoursesLink.propTypes = {
23-
content: PropTypes.shape({
24-
href: PropTypes.string.isRequired,
25-
}).isRequired,
26-
};
27-
28-
const CourseExitViewCoursesPluginSlot = () => {
26+
const CourseExitViewCoursesPluginSlot: React.FC = () => {
2927
const href = `${getConfig().LMS_BASE_URL}/dashboard`;
3028
return (
3129
<PluginSlot id="org.openedx.frontend.learning.course_exit_view_courses.v1">
@@ -34,6 +32,4 @@ const CourseExitViewCoursesPluginSlot = () => {
3432
);
3533
};
3634

37-
CourseExitViewCoursesPluginSlot.propTypes = {};
38-
3935
export default CourseExitViewCoursesPluginSlot;

src/plugin-slots/CourseExitPluginSlots/CourseRecommendationsSlot/index.jsx renamed to src/plugin-slots/CourseExitPluginSlots/CourseRecommendationsSlot/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import PropTypes from 'prop-types';
22
import { PluginSlot } from '@openedx/frontend-plugin-framework';
33
import CourseRecommendations from '../../../courseware/course/course-exit/CourseRecommendations';
44

5-
const CourseRecommendationsSlot = ({ variant }) => (
5+
interface Props {
6+
variant: string
7+
}
8+
9+
export const CourseRecommendationsSlot: React.FC<Props> = ({ variant }) => (
610
<PluginSlot
711
id="org.openedx.frontend.learning.course_recommendations.v1"
812
idAliases={['course_recommendations_slot']}
@@ -11,8 +15,3 @@ const CourseRecommendationsSlot = ({ variant }) => (
1115
</PluginSlot>
1216
);
1317

14-
CourseRecommendationsSlot.propTypes = {
15-
variant: PropTypes.string.isRequired,
16-
};
17-
18-
export default CourseRecommendationsSlot;

src/plugin-slots/CourseExitPluginSlots/DashboardFootnoteLinkPluginSlot/index.jsx renamed to src/plugin-slots/CourseExitPluginSlots/DashboardFootnoteLinkPluginSlot/index.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ import messages from '../../../courseware/course/course-exit/messages';
99
import { logClick } from '../../../courseware/course/course-exit/utils';
1010
import { useModel } from '../../../generic/model-store';
1111

12-
const DashboardFootnoteLink = ({ variant, content }) => {
12+
interface LinkProps {
13+
variant: string,
14+
content: { destination: string }
15+
}
16+
17+
const DashboardFootnoteLink: React.FC<LinkProps> = ({ variant, content }) => {
1318
const intl = useIntl();
1419
const { courseId } = useSelector(state => state.courseware);
1520
const { org } = useModel('courseHomeMeta', courseId);
@@ -27,24 +32,15 @@ const DashboardFootnoteLink = ({ variant, content }) => {
2732
);
2833
};
2934

30-
DashboardFootnoteLink.propTypes = {
31-
variant: PropTypes.string.isRequired,
32-
content: PropTypes.shape({
33-
destination: PropTypes.string.isRequired,
34-
}).isRequired,
35-
};
35+
interface PluginProps {
36+
variant: string
37+
}
3638

37-
const DashboardFootnoteLinkPluginSlot = ({ variant }) => {
39+
export const DashboardFootnoteLinkPluginSlot: React.FC<PluginProps> = ({ variant }) => {
3840
const destination = `${getConfig().LMS_BASE_URL}/dashboard`;
3941
return (
4042
<PluginSlot id="org.openedx.frontend.learning.course_exit_dashboard_footnote_link.v1">
4143
<DashboardFootnoteLink variant={variant} content={{ destination }} />
4244
</PluginSlot>
4345
);
4446
};
45-
46-
DashboardFootnoteLinkPluginSlot.propTypes = {
47-
variant: PropTypes.string.isRequired,
48-
};
49-
50-
export default DashboardFootnoteLinkPluginSlot;

0 commit comments

Comments
 (0)