Skip to content

Commit 7d73945

Browse files
chore: update with latest master
2 parents f36b218 + d99a09e commit 7d73945

25 files changed

+377
-181
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ ENABLE_UNIT_PAGE=false
3434
ENABLE_ASSETS_PAGE=false
3535
ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN=false
3636
ENABLE_TAGGING_TAXONOMY_PAGES=true
37+
ENABLE_CERTIFICATE_PAGE=true
3738
BBB_LEARN_MORE_URL=''
3839
HOTJAR_APP_ID=''
3940
HOTJAR_VERSION=6

.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ ENABLE_TEAM_TYPE_SETTING=false
3535
ENABLE_UNIT_PAGE=false
3636
ENABLE_ASSETS_PAGE=false
3737
ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN=true
38+
ENABLE_CERTIFICATE_PAGE=true
3839
ENABLE_NEW_VIDEO_UPLOAD_PAGE=true
3940
ENABLE_TAGGING_TAXONOMY_PAGES=true
4041
BBB_LEARN_MORE_URL=''

.env.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ENABLE_TEAM_TYPE_SETTING=false
3131
ENABLE_UNIT_PAGE=true
3232
ENABLE_ASSETS_PAGE=false
3333
ENABLE_VIDEO_UPLOAD_PAGE_LINK_IN_CONTENT_DROPDOWN=true
34+
ENABLE_CERTIFICATE_PAGE=true
3435
ENABLE_TAGGING_TAXONOMY_PAGES=true
3536
BBB_LEARN_MORE_URL=''
3637
INVITE_STUDENTS_EMAIL_TO="[email protected]"

.github/workflows/validate.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ on:
99
jobs:
1010
tests:
1111
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node: [18, 20]
15+
continue-on-error: ${{ matrix.node == 20 }}
16+
1217
steps:
1318
- uses: actions/checkout@v4
14-
- name: Setup Nodejs Env
15-
run: echo "NODE_VER=`cat .nvmrc`" >> $GITHUB_ENV
16-
- uses: actions/setup-node@v3
19+
- uses: actions/setup-node@v4
1720
with:
18-
node-version: ${{ env.NODE_VER }}
21+
node-version: ${{ matrix.node }}
1922
- run: make validate.ci
2023
- name: Upload coverage
2124
uses: codecov/codecov-action@v4

src/CourseAuthoringRoutes.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const CourseAuthoringRoutes = () => {
124124
/>
125125
<Route
126126
path="certificates"
127-
element={<PageWrap><Certificates courseId={courseId} /></PageWrap>}
127+
element={getConfig().ENABLE_CERTIFICATE_PAGE === 'true' ? <PageWrap><Certificates courseId={courseId} /></PageWrap> : null}
128128
/>
129129
<Route
130130
path="textbooks"

src/generic/processing-notification/index.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import { Badge, Icon } from '@openedx/paragon';
55
import { Settings as IconSettings } from '@openedx/paragon/icons';
66
import { capitalize } from 'lodash';
77

8-
import { NOTIFICATION_MESSAGES } from '../../constants';
9-
108
const ProcessingNotification = ({ isShow, title }) => (
119
<Badge
1210
className={classNames('processing-notification', {
@@ -24,7 +22,7 @@ const ProcessingNotification = ({ isShow, title }) => (
2422

2523
ProcessingNotification.propTypes = {
2624
isShow: PropTypes.bool.isRequired,
27-
title: PropTypes.oneOf(Object.values(NOTIFICATION_MESSAGES)).isRequired,
25+
title: PropTypes.string.isRequired,
2826
};
2927

3028
export default ProcessingNotification;

src/generic/toast-context/index.test.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ describe('<ToastProvider />', () => {
5050
},
5151
});
5252
store = initializeStore();
53+
jest.useFakeTimers();
5354
});
5455

5556
afterEach(() => {
@@ -61,6 +62,13 @@ describe('<ToastProvider />', () => {
6162
expect(await screen.findByText('This is the toast!')).toBeInTheDocument();
6263
});
6364

65+
it('should close toast after 5000ms', async () => {
66+
render(<RootWrapper><TestComponentToShow /></RootWrapper>);
67+
expect(await screen.findByText('This is the toast!')).toBeInTheDocument();
68+
jest.advanceTimersByTime(6000);
69+
expect(screen.queryByText('This is the toast!')).not.toBeInTheDocument();
70+
});
71+
6472
it('should close toast', async () => {
6573
render(<RootWrapper><TestComponentToClose /></RootWrapper>);
6674
expect(await screen.findByText('Content')).toBeInTheDocument();

src/generic/toast-context/index.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
2-
import { Toast } from '@openedx/paragon';
2+
3+
import ProcessingNotification from '../processing-notification';
34

45
export interface ToastContextData {
56
toastMessage: string | null;
@@ -35,7 +36,13 @@ export const ToastProvider = (props: ToastProviderProps) => {
3536
setToastMessage(null);
3637
}, []);
3738

38-
const showToast = React.useCallback((message) => setToastMessage(message), [setToastMessage]);
39+
const showToast = React.useCallback((message) => {
40+
setToastMessage(message);
41+
// Close the toast after 5 seconds
42+
setTimeout(() => {
43+
setToastMessage(null);
44+
}, 5000);
45+
}, [setToastMessage]);
3946
const closeToast = React.useCallback(() => setToastMessage(null), [setToastMessage]);
4047

4148
const context = React.useMemo(() => ({
@@ -48,9 +55,7 @@ export const ToastProvider = (props: ToastProviderProps) => {
4855
<ToastContext.Provider value={context}>
4956
{props.children}
5057
{ toastMessage && (
51-
<Toast show={toastMessage !== null} onClose={closeToast}>
52-
{toastMessage}
53-
</Toast>
58+
<ProcessingNotification isShow={toastMessage !== null} title={toastMessage} />
5459
)}
5560
</ToastContext.Provider>
5661
);

src/header/utils.js

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,37 @@ export const getContentMenuItems = ({ studioBaseUrl, courseId, intl }) => {
3131
return items;
3232
};
3333

34-
export const getSettingMenuItems = ({ studioBaseUrl, courseId, intl }) => ([
35-
{
36-
href: `${studioBaseUrl}/settings/details/${courseId}`,
37-
title: intl.formatMessage(messages['header.links.scheduleAndDetails']),
38-
},
39-
{
40-
href: `${studioBaseUrl}/settings/grading/${courseId}`,
41-
title: intl.formatMessage(messages['header.links.grading']),
42-
},
43-
{
44-
href: `${studioBaseUrl}/course_team/${courseId}`,
45-
title: intl.formatMessage(messages['header.links.courseTeam']),
46-
},
47-
{
48-
href: `${studioBaseUrl}/group_configurations/${courseId}`,
49-
title: intl.formatMessage(messages['header.links.groupConfigurations']),
50-
},
51-
{
52-
href: `${studioBaseUrl}/settings/advanced/${courseId}`,
53-
title: intl.formatMessage(messages['header.links.advancedSettings']),
54-
},
55-
{
56-
href: `${studioBaseUrl}/certificates/${courseId}`,
57-
title: intl.formatMessage(messages['header.links.certificates']),
58-
},
59-
]);
34+
export const getSettingMenuItems = ({ studioBaseUrl, courseId, intl }) => {
35+
const items = [
36+
{
37+
href: `${studioBaseUrl}/settings/details/${courseId}`,
38+
title: intl.formatMessage(messages['header.links.scheduleAndDetails']),
39+
},
40+
{
41+
href: `${studioBaseUrl}/settings/grading/${courseId}`,
42+
title: intl.formatMessage(messages['header.links.grading']),
43+
},
44+
{
45+
href: `${studioBaseUrl}/course_team/${courseId}`,
46+
title: intl.formatMessage(messages['header.links.courseTeam']),
47+
},
48+
{
49+
href: `${studioBaseUrl}/group_configurations/${courseId}`,
50+
title: intl.formatMessage(messages['header.links.groupConfigurations']),
51+
},
52+
{
53+
href: `${studioBaseUrl}/settings/advanced/${courseId}`,
54+
title: intl.formatMessage(messages['header.links.advancedSettings']),
55+
},
56+
];
57+
if (getConfig().ENABLE_CERTIFICATE_PAGE === 'true') {
58+
items.push({
59+
href: `${studioBaseUrl}/certificates/${courseId}`,
60+
title: intl.formatMessage(messages['header.links.certificates']),
61+
});
62+
}
63+
return items;
64+
};
6065

6166
export const getToolsMenuItems = ({ studioBaseUrl, courseId, intl }) => ([
6267
{

src/header/utils.test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getConfig, setConfig } from '@edx/frontend-platform';
2-
import { getContentMenuItems, getToolsMenuItems } from './utils';
2+
import { getContentMenuItems, getToolsMenuItems, getSettingMenuItems } from './utils';
33

44
const props = {
55
studioBaseUrl: 'UrLSTuiO',
@@ -29,6 +29,25 @@ describe('header utils', () => {
2929
});
3030
});
3131

32+
describe('getSettingsMenuitems', () => {
33+
it('should include certificates option', () => {
34+
setConfig({
35+
...getConfig(),
36+
ENABLE_CERTIFICATE_PAGE: 'true',
37+
});
38+
const actualItems = getSettingMenuItems(props);
39+
expect(actualItems).toHaveLength(6);
40+
});
41+
it('should not include certificates option', () => {
42+
setConfig({
43+
...getConfig(),
44+
ENABLE_CERTIFICATE_PAGE: 'false',
45+
});
46+
const actualItems = getSettingMenuItems(props);
47+
expect(actualItems).toHaveLength(5);
48+
});
49+
});
50+
3251
describe('getToolsMenuItems', () => {
3352
it('should include export tags option', () => {
3453
setConfig({

0 commit comments

Comments
 (0)