Skip to content

Commit 1d924b4

Browse files
authored
Merge pull request #329 from openedx/aansari/INF-1375
feat: added info banner for ORA notifications
2 parents 9cfab58 + 31ed941 commit 1d924b4

File tree

9 files changed

+92
-0
lines changed

9 files changed

+92
-0
lines changed

.env

+1
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ ENTERPRISE_MARKETING_UTM_CAMPAIGN=''
3232
ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM=''
3333
APP_ID=''
3434
MFE_CONFIG_API_URL=''
35+
ACCOUNT_SETTINGS_URL=''

.env.development

+1
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral'
3838
ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer'
3939
APP_ID=''
4040
MFE_CONFIG_API_URL=''
41+
ACCOUNT_SETTINGS_URL=http://localhost:1997

.env.test

+1
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@ ENTERPRISE_MARKETING_URL='http://example.com'
3636
ENTERPRISE_MARKETING_UTM_SOURCE='example.com'
3737
ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral'
3838
ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer'
39+
ACCOUNT_SETTINGS_URL=http://localhost:1997

src/App.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { selectors } from 'data/redux';
1010

1111
import DemoWarning from 'containers/DemoWarning';
1212
import CTA from 'containers/CTA';
13+
import NotificationsBanner from 'containers/NotificationsBanner';
1314
import ListView from 'containers/ListView';
1415

1516
import './App.scss';
@@ -27,6 +28,7 @@ export const App = ({ courseMetadata, isEnabled }) => (
2728
/>
2829
{!isEnabled && <DemoWarning />}
2930
<CTA />
31+
<NotificationsBanner />
3032
<main data-testid="main">
3133
<ListView />
3234
</main>

src/__snapshots__/App.test.jsx.snap

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ exports[`App router component snapshot: disabled (show demo warning) 1`] = `
1212
/>
1313
<DemoWarning />
1414
<CTA />
15+
<NotificationsBanner />
1516
<main
1617
data-testid="main"
1718
>
@@ -36,6 +37,7 @@ exports[`App router component snapshot: enabled 1`] = `
3637
data-testid="header"
3738
/>
3839
<CTA />
40+
<NotificationsBanner />
3941
<main
4042
data-testid="main"
4143
>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import React from 'react';
2+
import { shallow } from '@edx/react-unit-test-utils';
3+
4+
import { NotificationsBanner } from '.';
5+
6+
describe('NotificationsBanner component', () => {
7+
test('snapshots', () => {
8+
const el = shallow(<NotificationsBanner hide />);
9+
expect(el.snapshot).toMatchSnapshot();
10+
});
11+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`NotificationsBanner component snapshots 1`] = `
4+
<PageBanner
5+
variant="accentB"
6+
>
7+
<span>
8+
<FormattedMessage
9+
defaultMessage="You can now enable notifications for ORA assignments that require staff grading, from the "
10+
description="user info message that user can enable notifications for ORA assignments"
11+
id="ora-grading.NotificationsBanner.Message"
12+
/>
13+
<Hyperlink
14+
destination="http://localhost:1997/notifications"
15+
isInline={true}
16+
rel="noopener noreferrer"
17+
showLaunchIcon={false}
18+
target="_blank"
19+
variant="muted"
20+
>
21+
<FormattedMessage
22+
defaultMessage="preferences center."
23+
description="placeholder for the preferences center link"
24+
id="ora-grading.NotificationsBanner.linkMessage"
25+
/>
26+
</Hyperlink>
27+
</span>
28+
</PageBanner>
29+
`;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
3+
import { getConfig } from '@edx/frontend-platform';
4+
import { FormattedMessage } from '@edx/frontend-platform/i18n';
5+
import { PageBanner, Hyperlink } from '@openedx/paragon';
6+
7+
import messages from './messages';
8+
9+
export const NotificationsBanner = () => (
10+
<PageBanner variant="accentB">
11+
<span>
12+
<FormattedMessage {...messages.infoMessage} />
13+
<Hyperlink
14+
isInline
15+
variant="muted"
16+
destination={`${getConfig().ACCOUNT_SETTINGS_URL}/notifications`}
17+
target="_blank"
18+
rel="noopener noreferrer"
19+
showLaunchIcon={false}
20+
>
21+
<FormattedMessage {...messages.notificationsBannerLinkMessage} />
22+
</Hyperlink>
23+
</span>
24+
</PageBanner>
25+
);
26+
27+
export default NotificationsBanner;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/* eslint-disable quotes */
2+
import { defineMessages } from '@edx/frontend-platform/i18n';
3+
import { StrictDict } from 'utils';
4+
5+
const messages = defineMessages({
6+
infoMessage: {
7+
id: 'ora-grading.NotificationsBanner.Message',
8+
defaultMessage: 'You can now enable notifications for ORA assignments that require staff grading, from the ',
9+
description: 'user info message that user can enable notifications for ORA assignments',
10+
},
11+
notificationsBannerLinkMessage: {
12+
id: 'ora-grading.NotificationsBanner.linkMessage',
13+
defaultMessage: 'preferences center.',
14+
description: 'placeholder for the preferences center link',
15+
},
16+
});
17+
18+
export default StrictDict(messages);

0 commit comments

Comments
 (0)