From 0ba3cac532646aff84013ebc5ea00e3b0c2d0c28 Mon Sep 17 00:00:00 2001 From: Awais Ansari Date: Tue, 30 Apr 2024 19:59:26 +0500 Subject: [PATCH 1/2] feat: added info banner for ORA notifications --- .env | 1 + .env.development | 1 + .env.test | 1 + src/App.jsx | 2 ++ .../NotificationsBanner.test.jsx | 11 ++++++++ src/containers/NotificationsBanner/index.jsx | 27 +++++++++++++++++++ .../NotificationsBanner/messages.js | 18 +++++++++++++ 7 files changed, 61 insertions(+) create mode 100644 src/containers/NotificationsBanner/NotificationsBanner.test.jsx create mode 100644 src/containers/NotificationsBanner/index.jsx create mode 100644 src/containers/NotificationsBanner/messages.js diff --git a/.env b/.env index 1c57b441..b9c03b3b 100644 --- a/.env +++ b/.env @@ -32,3 +32,4 @@ ENTERPRISE_MARKETING_UTM_CAMPAIGN='' ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='' APP_ID='' MFE_CONFIG_API_URL='' +ACCOUNT_SETTINGS_URL='' diff --git a/.env.development b/.env.development index 44fb5656..dd8d661a 100644 --- a/.env.development +++ b/.env.development @@ -38,3 +38,4 @@ ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral' ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer' APP_ID='' MFE_CONFIG_API_URL='' +ACCOUNT_SETTINGS_URL=http://localhost:1997 diff --git a/.env.test b/.env.test index 2b225626..5b882a2e 100644 --- a/.env.test +++ b/.env.test @@ -36,3 +36,4 @@ ENTERPRISE_MARKETING_URL='http://example.com' ENTERPRISE_MARKETING_UTM_SOURCE='example.com' ENTERPRISE_MARKETING_UTM_CAMPAIGN='example.com Referral' ENTERPRISE_MARKETING_FOOTER_UTM_MEDIUM='Footer' +ACCOUNT_SETTINGS_URL=http://localhost:1997 diff --git a/src/App.jsx b/src/App.jsx index 534dc34d..dae17ae2 100755 --- a/src/App.jsx +++ b/src/App.jsx @@ -10,6 +10,7 @@ import { selectors } from 'data/redux'; import DemoWarning from 'containers/DemoWarning'; import CTA from 'containers/CTA'; +import NotificationsBanner from 'containers/NotificationsBanner'; import ListView from 'containers/ListView'; import './App.scss'; @@ -27,6 +28,7 @@ export const App = ({ courseMetadata, isEnabled }) => ( /> {!isEnabled && } +
diff --git a/src/containers/NotificationsBanner/NotificationsBanner.test.jsx b/src/containers/NotificationsBanner/NotificationsBanner.test.jsx new file mode 100644 index 00000000..d111c5fb --- /dev/null +++ b/src/containers/NotificationsBanner/NotificationsBanner.test.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import { shallow } from '@edx/react-unit-test-utils'; + +import { NotificationsBanner } from '.'; + +describe('NotificationsBanner component', () => { + test('snapshots', () => { + const el = shallow(); + expect(el.snapshot).toMatchSnapshot(); + }); +}); diff --git a/src/containers/NotificationsBanner/index.jsx b/src/containers/NotificationsBanner/index.jsx new file mode 100644 index 00000000..4c334e78 --- /dev/null +++ b/src/containers/NotificationsBanner/index.jsx @@ -0,0 +1,27 @@ +import React from 'react'; + +import { getConfig } from '@edx/frontend-platform'; +import { FormattedMessage } from '@edx/frontend-platform/i18n'; +import { PageBanner, Hyperlink } from '@openedx/paragon'; + +import messages from './messages'; + +export const NotificationsBanner = () => ( + + + + + + + + +); + +export default NotificationsBanner; diff --git a/src/containers/NotificationsBanner/messages.js b/src/containers/NotificationsBanner/messages.js new file mode 100644 index 00000000..8a831ed9 --- /dev/null +++ b/src/containers/NotificationsBanner/messages.js @@ -0,0 +1,18 @@ +/* eslint-disable quotes */ +import { defineMessages } from '@edx/frontend-platform/i18n'; +import { StrictDict } from 'utils'; + +const messages = defineMessages({ + infoMessage: { + id: 'ora-grading.NotificationsBanner.Message', + defaultMessage: 'You can now enable notifications for ORA assignments that require staff grading, from the ', + description: 'user info message that user can enable notifications for ORA assignments', + }, + notificationsBannerLinkMessage: { + id: 'ora-grading.NotificationsBanner.linkMessage', + defaultMessage: 'preferences center.', + description: 'placeholder for the preferences center link', + }, +}); + +export default StrictDict(messages); From 31ed9410a4b03db47d66411c3246e510999bfcbf Mon Sep 17 00:00:00 2001 From: Awais Ansari Date: Tue, 30 Apr 2024 20:07:23 +0500 Subject: [PATCH 2/2] test: added test cases for NotificationsBanner --- src/__snapshots__/App.test.jsx.snap | 2 ++ .../NotificationsBanner.test.jsx.snap | 29 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 src/containers/NotificationsBanner/__snapshots__/NotificationsBanner.test.jsx.snap diff --git a/src/__snapshots__/App.test.jsx.snap b/src/__snapshots__/App.test.jsx.snap index ad16942b..87f6cec1 100644 --- a/src/__snapshots__/App.test.jsx.snap +++ b/src/__snapshots__/App.test.jsx.snap @@ -12,6 +12,7 @@ exports[`App router component snapshot: disabled (show demo warning) 1`] = ` /> +
@@ -36,6 +37,7 @@ exports[`App router component snapshot: enabled 1`] = ` data-testid="header" /> +
diff --git a/src/containers/NotificationsBanner/__snapshots__/NotificationsBanner.test.jsx.snap b/src/containers/NotificationsBanner/__snapshots__/NotificationsBanner.test.jsx.snap new file mode 100644 index 00000000..ba208b01 --- /dev/null +++ b/src/containers/NotificationsBanner/__snapshots__/NotificationsBanner.test.jsx.snap @@ -0,0 +1,29 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`NotificationsBanner component snapshots 1`] = ` + + + + + + + + +`;