Skip to content

Commit

Permalink
refactor: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
sundasnoreen12 committed Dec 27, 2024
1 parent 2756568 commit 5228cc9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/account-settings/AccountSettingsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,6 @@ class AccountSettingsPage extends React.Component {
</div>
<div className="border border-light-700 my-6" />
<NotificationSettings />
{this.props.showPreferences && <div className="border border-light-700 my-6" />}
<div className="account-section mb-5" id="site-preferences" ref={this.navLinkRefs['#site-preferences']}>
<h2 className="section-heading h4 mb-3">
{this.props.intl.formatMessage(messages['account.settings.section.site.preferences'])}
Expand Down Expand Up @@ -970,7 +969,6 @@ AccountSettingsPage.propTypes = {
navigate: PropTypes.func.isRequired,
location: PropTypes.string.isRequired,
disabledCountries: PropTypes.arrayOf(PropTypes.string),
showPreferences: PropTypes.bool,
};

AccountSettingsPage.defaultProps = {
Expand Down Expand Up @@ -998,7 +996,6 @@ AccountSettingsPage.defaultProps = {
mostRecentVerifiedName: {},
verifiedNameHistory: [],
disabledCountries: [],
showPreferences: false,
};

export default withLocation(withNavigate(connect(accountSettingsPageSelector, {
Expand Down
4 changes: 0 additions & 4 deletions src/account-settings/data/selectors.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createSelector, createStructuredSelector } from 'reselect';
import { siteLanguageListSelector, siteLanguageOptionsSelector } from '../site-language';
import { compareVerifiedNamesByCreatedDate } from '../../utils';
import { selectShowPreferences } from '../../notification-preferences/data/selectors';

export const storeName = 'accountSettings';

Expand Down Expand Up @@ -244,7 +243,6 @@ export const accountSettingsPageSelector = createSelector(
mostRecentVerifiedNameSelector,
sortedVerifiedNameHistorySelector,
disabledCountriesSelector,
selectShowPreferences(),
(
accountSettings,
siteLanguageOptions,
Expand All @@ -263,7 +261,6 @@ export const accountSettingsPageSelector = createSelector(
mostRecentVerifiedName,
verifiedNameHistory,
disabledCountries,
showPreferences,
) => ({
siteLanguageOptions,
siteLanguage,
Expand All @@ -285,7 +282,6 @@ export const accountSettingsPageSelector = createSelector(
mostRecentVerifiedName,
verifiedNameHistory,
disabledCountries,
showPreferences,
}),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const NotificationPreferenceColumn = ({ appId, channel, appPreference }) => {

const onToggle = useCallback((event, notificationType) => {
const { name: notificationChannel } = event.target;
const appNotificationPreference = appPreferences.find(x => x.id === notificationType);
const appNotificationPreference = appPreferences.find(preference => preference.id === notificationType);
const value = notificationChannel === 'email_cadence' && courseId ? event.target.innerText : event.target.checked;
const emailCadence = notificationChannel === 'email_cadence' ? event.target.innerText : appNotificationPreference.emailCadence;

Expand Down
1 change: 1 addition & 0 deletions src/notification-preferences/NotificationSettings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const NotificationSettings = () => {
</div>
<NotificationCoursesDropdown />
<NotificationPreferences courseId={courseId} />
<div className="border border-light-700 my-6" />
</Container>
)
);
Expand Down

0 comments on commit 5228cc9

Please sign in to comment.