Skip to content

Commit

Permalink
Merge pull request #1054 from openedx/sundas/INF-1389
Browse files Browse the repository at this point in the history
fix: disabled email cadence dropdown while api is pending
  • Loading branch information
sundasnoreen12 authored May 23, 2024
2 parents 4e38c9e + 94ef299 commit 175d9cf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/notification-preferences/EmailCadences.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState } from 'react';

import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';

import { useIntl } from '@edx/frontend-platform/i18n';
import { ExpandLess, ExpandMore } from '@openedx/paragon/icons';
Expand All @@ -10,21 +11,24 @@ import {

import messages from './messages';
import EMAIL_CADENCE from './data/constants';
import { selectUpdatePreferencesStatus } from './data/selectors';
import { LOADING_STATUS } from '../constants';

const EmailCadences = ({
email, onToggle, emailCadence, notificationType,
}) => {
const intl = useIntl();
const [isOpen, open, close] = useToggle(false);
const [target, setTarget] = useState(null);
const updatePreferencesStatus = useSelector(selectUpdatePreferencesStatus());

return (
<>
<Button
ref={setTarget}
variant="outline-primary"
onClick={open}
disabled={!email}
disabled={!email || updatePreferencesStatus === LOADING_STATUS}
size="sm"
iconAfter={isOpen ? ExpandLess : ExpandMore}
className="border-light-300 justify-content-between ml-3.5 cadence-button"
Expand Down

0 comments on commit 175d9cf

Please sign in to comment.