Skip to content

Commit 7c4ef47

Browse files
ahtesham-quraishAhtesham Quraish
andauthored
refactor: replace one injectIntl with useIntl, fix JSX return (#2354)
Co-authored-by: Ahtesham Quraish <[email protected]>
1 parent 8003453 commit 7c4ef47

File tree

2 files changed

+30
-29
lines changed

2 files changed

+30
-29
lines changed

src/files-and-videos/videos-page/VideosPage.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ const VideosPage = ({
169169
handleAddThumbnail,
170170
videoImageSettings,
171171
});
172+
172173
const infoModalSidebar = (video, activeTab, setActiveTab) => (
173-
VideoInfoModalSidebar({ video, activeTab, setActiveTab })
174+
<VideoInfoModalSidebar video={video} activeTab={activeTab} setActiveTab={setActiveTab} />
174175
);
175176
const maxFileSize = videoUploadMaxFileSize * 1073741824;
176177
const transcriptColumn = {
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
3+
import { useIntl } from '@edx/frontend-platform/i18n';
44
import {
55
Tabs,
66
Tab,
@@ -14,33 +14,35 @@ const VideoInfoModalSidebar = ({
1414
video,
1515
activeTab,
1616
setActiveTab,
17-
// injected
18-
intl,
19-
}) => (
20-
<Tabs
21-
id="controlled-info-sidebar-tab"
22-
activeKey={activeTab}
23-
onSelect={(tab) => setActiveTab(tab)}
24-
>
25-
<Tab eventKey="fileInfo" title={intl.formatMessage(messages.infoTabTitle)}>
26-
<InfoTab {...{ video }} />
27-
</Tab>
28-
<Tab
29-
eventKey="fileTranscripts"
30-
title={intl.formatMessage(
31-
messages.transcriptTabTitle,
32-
{ transcriptCount: video.transcripts.length },
33-
)}
34-
notification={TRANSCRIPT_FAILURE_STATUSES.includes(video.transcriptionStatus) && (
17+
}) => {
18+
const intl = useIntl();
19+
20+
return (
21+
<Tabs
22+
id="controlled-info-sidebar-tab"
23+
activeKey={activeTab}
24+
onSelect={(tab) => setActiveTab(tab)}
25+
>
26+
<Tab eventKey="fileInfo" title={intl.formatMessage(messages.infoTabTitle)}>
27+
<InfoTab {...{ video }} />
28+
</Tab>
29+
<Tab
30+
eventKey="fileTranscripts"
31+
title={intl.formatMessage(
32+
messages.transcriptTabTitle,
33+
{ transcriptCount: video.transcripts.length },
34+
)}
35+
notification={TRANSCRIPT_FAILURE_STATUSES.includes(video.transcriptionStatus) && (
3536
<span>
3637
<span className="sr-only">{intl.formatMessage(messages.notificationScreenReaderText)}</span>
3738
</span>
38-
)}
39-
>
40-
<TranscriptTab {...{ video }} />
41-
</Tab>
42-
</Tabs>
43-
);
39+
)}
40+
>
41+
<TranscriptTab {...{ video }} />
42+
</Tab>
43+
</Tabs>
44+
);
45+
};
4446

4547
VideoInfoModalSidebar.propTypes = {
4648
video: PropTypes.shape({
@@ -54,12 +56,10 @@ VideoInfoModalSidebar.propTypes = {
5456
}),
5557
activeTab: PropTypes.string.isRequired,
5658
setActiveTab: PropTypes.func.isRequired,
57-
// injected
58-
intl: intlShape.isRequired,
5959
};
6060

6161
VideoInfoModalSidebar.defaultProps = {
6262
video: null,
6363
};
6464

65-
export default injectIntl(VideoInfoModalSidebar);
65+
export default VideoInfoModalSidebar;

0 commit comments

Comments
 (0)