Merge pull request #912 from openedx/aansari/code-refactoring
refactor: removed disable eslint and created channels constant
This commit is contained in:
@@ -13,7 +13,7 @@ import {
|
||||
LOADING_STATUS,
|
||||
SUCCESS_STATUS,
|
||||
} from '../constants';
|
||||
import { messages } from './messages';
|
||||
import messages from './messages';
|
||||
import { NotFoundPage } from '../account-settings';
|
||||
import { useFeedbackWrapper } from '../hooks';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Collapsible } from '@edx/paragon';
|
||||
import { messages } from './messages';
|
||||
import messages from './messages';
|
||||
import ToggleSwitch from './ToggleSwitch';
|
||||
import {
|
||||
selectPreferenceAppToggleValue,
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
import { Icon, OverlayTrigger, Tooltip } from '@edx/paragon';
|
||||
import { InfoOutline } from '@edx/paragon/icons';
|
||||
import { messages } from './messages';
|
||||
import messages from './messages';
|
||||
import ToggleSwitch from './ToggleSwitch';
|
||||
import {
|
||||
selectPreference,
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
selectSelectedCourseId,
|
||||
selectNotificationPreferencesStatus,
|
||||
} from './data/selectors';
|
||||
import NOTIFICATION_CHANNELS from './data/constants';
|
||||
import { updatePreferenceToggle } from './data/thunks';
|
||||
import { LOADING_STATUS } from '../constants';
|
||||
|
||||
@@ -53,7 +54,7 @@ const NotificationPreferenceRow = ({ appId, preferenceName }) => {
|
||||
<Tooltip id={tooltipId}>
|
||||
{preference.info}
|
||||
</Tooltip>
|
||||
)}
|
||||
)}
|
||||
>
|
||||
<span className="ml-2">
|
||||
<Icon src={InfoOutline} />
|
||||
@@ -62,7 +63,7 @@ const NotificationPreferenceRow = ({ appId, preferenceName }) => {
|
||||
)}
|
||||
</div>
|
||||
<div className="d-flex align-items-center">
|
||||
{['web'].map((channel) => (
|
||||
{NOTIFICATION_CHANNELS.map((channel) => (
|
||||
<div
|
||||
id={`${preferenceName}-${channel}`}
|
||||
className={classNames(
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
selectCourseList,
|
||||
} from './data/selectors';
|
||||
import { fetchCourseList, fetchCourseNotificationPreferences } from './data/thunks';
|
||||
import { messages } from './messages';
|
||||
import messages from './messages';
|
||||
import NotificationPreferenceApp from './NotificationPreferenceApp';
|
||||
import {
|
||||
FAILURE_STATUS,
|
||||
@@ -67,7 +67,7 @@ const NotificationPreferences = () => {
|
||||
destination="https://edx.readthedocs.io/projects/open-edx-learner-guide/en/latest/sfd_notifications/managing_notifications.html"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="text-decoration-underline"
|
||||
className="text-decoration-underline ml-1"
|
||||
>
|
||||
{intl.formatMessage(messages.notificationPreferenceGuideLink)}
|
||||
</Hyperlink>
|
||||
@@ -83,15 +83,15 @@ const NotificationPreferences = () => {
|
||||
</div>
|
||||
{preferencesList}
|
||||
{isLoading && (
|
||||
<div className="d-flex">
|
||||
<Spinner
|
||||
variant="primary"
|
||||
animation="border"
|
||||
className="mx-auto my-auto"
|
||||
size="lg"
|
||||
data-testid="loading-spinner"
|
||||
/>
|
||||
</div>
|
||||
<div className="d-flex">
|
||||
<Spinner
|
||||
variant="primary"
|
||||
animation="border"
|
||||
className="mx-auto my-auto"
|
||||
size="lg"
|
||||
data-testid="loading-spinner"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Container>
|
||||
|
||||
3
src/notification-preferences/data/constants.js
Normal file
3
src/notification-preferences/data/constants.js
Normal file
@@ -0,0 +1,3 @@
|
||||
const NOTIFICATION_CHANNELS = ['web'];
|
||||
|
||||
export default NOTIFICATION_CHANNELS;
|
||||
@@ -1,7 +1,6 @@
|
||||
import { defineMessages } from '@edx/frontend-platform/i18n';
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export const messages = defineMessages({
|
||||
const messages = defineMessages({
|
||||
notificationHeading: {
|
||||
id: 'notification.preference.heading',
|
||||
defaultMessage: 'Notifications',
|
||||
@@ -10,21 +9,21 @@ export const messages = defineMessages({
|
||||
notificationAppTitle: {
|
||||
id: 'notification.preference.app.title',
|
||||
defaultMessage: `{
|
||||
key, select,
|
||||
discussion {Discussions}
|
||||
coursework {Course Work}
|
||||
other {{key}}
|
||||
key, select,
|
||||
discussion {Discussions}
|
||||
coursework {Course Work}
|
||||
other {{key}}
|
||||
}`,
|
||||
description: 'Display text for Notification Types',
|
||||
},
|
||||
notificationTitle: {
|
||||
id: 'notification.preference.title',
|
||||
defaultMessage: `{
|
||||
text, select,
|
||||
core {Core notifications}
|
||||
newDiscussionPost {New discussion posts}
|
||||
newQuestionPost {New question posts}
|
||||
other {{text}}
|
||||
text, select,
|
||||
core {Core notifications}
|
||||
newDiscussionPost {New discussion posts}
|
||||
newQuestionPost {New question posts}
|
||||
other {{text}}
|
||||
}`,
|
||||
description: 'Display text for Notification Types',
|
||||
},
|
||||
@@ -34,7 +33,7 @@ export const messages = defineMessages({
|
||||
description: 'Display text for type',
|
||||
},
|
||||
webLabel: {
|
||||
id: 'notification.preference.web,label',
|
||||
id: 'notification.preference.web.label',
|
||||
defaultMessage: 'Web',
|
||||
description: 'Display text for web',
|
||||
},
|
||||
@@ -60,7 +59,9 @@ export const messages = defineMessages({
|
||||
},
|
||||
notificationPreferenceGuideBody: {
|
||||
id: 'notification.preference.guide.body',
|
||||
defaultMessage: 'Notifications for certain activities are enabled by default, ',
|
||||
defaultMessage: 'Notifications for certain activities are enabled by default,',
|
||||
description: 'Body of the notification preferences for learner guide',
|
||||
},
|
||||
});
|
||||
|
||||
export default messages;
|
||||
|
||||
Reference in New Issue
Block a user