Skip to content

Commit

Permalink
refactor: addressing to some pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
johnvente committed Jan 5, 2024
1 parent 7905e8a commit 9752165
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions plugins/communications-app/ScheduleSection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import { actionCreators as formActions } from '@communications-app/src/component
import messages from './messages';
import './styles.scss';

const formStatusToast = ['error', 'complete', 'completeSchedule', 'loadingTeams'];
const ERROR = 'error';
const COMPLETE = 'complete';
const COMPLETE_SCHEDULE = 'completeSchedule';
const LOADING_TEAMS = 'loadingTeams';
const PENDING = 'pending';
const formStatusToast = [ERROR, COMPLETE, COMPLETE_SCHEDULE, LOADING_TEAMS];

const ScheduleSection = ({ openTaskAlert }) => {
const intl = useIntl();
Expand Down Expand Up @@ -107,10 +112,10 @@ const ScheduleSection = ({ openTaskAlert }) => {
}), [intl]);

const statefulButtonDisableStates = useMemo(() => [
'pending',
'complete',
'completeSchedule',
isLoadingTeams ? 'loadingTeams' : '',
PENDING,
COMPLETE,
COMPLETE_SCHEDULE,
isLoadingTeams ? LOADING_TEAMS : '',
], [isLoadingTeams]);

return (
Expand Down Expand Up @@ -159,7 +164,7 @@ const ScheduleSection = ({ openTaskAlert }) => {
data-testid="send-email-btn"
variant="primary"
onClick={handleClickStatefulButton}
state={isLoadingTeams ? 'loadingTeams' : formStatus}
state={isLoadingTeams ? LOADING_TEAMS : formStatus}
icons={statefulButtonIcons}
labels={statefulButtonLabels}
disabledStates={statefulButtonDisableStates}
Expand Down
2 changes: 1 addition & 1 deletion plugins/communications-app/TeamEmails/ListTeams.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const ListTeams = ({ teams, onChangeCheckBox, teamsSelected }) => (
<Form.Checkbox
key={`team:${name}_${id}`}
value={id}
className="mr-2 team-checkbox"
className="mr-4 mb-4 team-checkbox"
data-testid={`team:${id}`}
onChange={onChangeCheckBox}
checked={teamsSelected.includes(id)}
Expand Down

0 comments on commit 9752165

Please sign in to comment.