Skip to content

Commit

Permalink
EPMRPP-94765 || Update the state of action buttons in Create project …
Browse files Browse the repository at this point in the history
…and Invite user buttons (#4047)
  • Loading branch information
BlazarQSO authored and maria-hambardzumian committed Oct 15, 2024
1 parent 8f087e7 commit 9c3f17b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ export class InviteUserModal extends Component {
areUserSuggestionsAllowed: PropTypes.bool.isRequired,
projectName: PropTypes.string.isRequired,
organizationSlug: PropTypes.string.isRequired,
valid: PropTypes.bool.isRequired,
invalid: PropTypes.bool.isRequired,
anyTouched: PropTypes.bool.isRequired,
};

static defaultProps = {
Expand Down Expand Up @@ -312,7 +313,8 @@ export class InviteUserModal extends Component {
projectName,
areUserSuggestionsAllowed,
selectedUser,
valid,
anyTouched,
invalid,
} = this.props;

const okButton = {
Expand All @@ -324,7 +326,7 @@ export class InviteUserModal extends Component {
onClick: () => {
handleSubmit(this.inviteUserAndCloseModal)();
},
disabled: !valid,
disabled: anyTouched && invalid,
eventInfo: MEMBERS_PAGE_EVENTS.INVITE_BTN_INVITE_USER_MODAL,
'data-automation-id': 'submitButton',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { useDispatch } from 'react-redux';
import { messages } from '../messages';

const PROJECT_NAME_FIELD = 'projectName';
export const AddProjectModal = ({ data = {}, handleSubmit, valid }) => {
export const AddProjectModal = ({ data = {}, handleSubmit, anyTouched, invalid }) => {
const dispatch = useDispatch();
const { formatMessage } = useIntl();
const { onSubmit } = data;
Expand All @@ -46,7 +46,7 @@ export const AddProjectModal = ({ data = {}, handleSubmit, valid }) => {
onClick: () => {
handleSubmit(onCreateProject)();
},
disabled: !valid,
disabled: anyTouched && invalid,
}}
cancelButton={{
children: formatMessage(COMMON_LOCALE_KEYS.CANCEL),
Expand All @@ -70,7 +70,8 @@ export const AddProjectModal = ({ data = {}, handleSubmit, valid }) => {
AddProjectModal.propTypes = {
data: PropTypes.object,
handleSubmit: PropTypes.func,
valid: PropTypes.bool.isRequired,
anyTouched: PropTypes.bool.isRequired,
invalid: PropTypes.bool.isRequired,
};

export default withModal('addProjectModal')(
Expand Down

0 comments on commit 9c3f17b

Please sign in to comment.