Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-94765 || Update the state of action buttons in Create project … #4047

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading