Skip to content

Commit

Permalink
use ActionButton
Browse files Browse the repository at this point in the history
  • Loading branch information
dzonidoo committed Aug 23, 2023
1 parent 6bfbf55 commit 11c980f
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions assets/users/components/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {getUserStateLabelDetails} from 'company-admin/components/CompanyUserList
import {companyProductSeatsSelector, companySectionListSelector, sectionListSelector} from 'company-admin/selectors';
import {IUser} from 'interfaces/user';
import {IUserProfileStore} from 'user-profile/reducers';
import ActionButton from 'components/ActionButton';

const getCompanyOptions = (companies: any) => companies.map((company: any) => ({value: company._id, text: company.name}));

Expand Down Expand Up @@ -85,6 +86,18 @@ const EditUserComponent: React.ComponentType<IProps> = ({
const company = companies.map((value: any) => value.name);
const userIsAdmin = isUserAdmin(user);

const resendInviteButton = {
name: gettext('Resend Invite'),
icon: 'refresh',
tooltip: gettext('Resend Invite'),
multi: false,
action: () => {
if (confirm(gettext('Would you like to resend the invitation for {{ email }}?', {email: user.email}))) {
resendUserInvite();
}
},
}

Check failure on line 99 in assets/users/components/EditUser.tsx

View workflow job for this annotation

GitHub Actions / client

Missing semicolon

return (
<div
data-test-id="edit-user-form"
Expand Down Expand Up @@ -117,21 +130,12 @@ const EditUserComponent: React.ComponentType<IProps> = ({
</label>
)}
{(user._id == null || user.is_validated === true) ? null : (
<button
type="button"
<ActionButton
key={resendInviteButton.name}
className="icon-button icon-button--small icon-button--secondary"
aria-label={gettext('Resend Invite')}
title={gettext('Resend Invite')}
onClick={(event: any) => {
event.preventDefault();

if (confirm(gettext('Would you like to resend the invitation for {{ email }}?', {email: user.email}))) {
resendUserInvite();
}
}}
>
<i className="icon--refresh" role="presentation"></i>
</button>
action={resendInviteButton}
/>
)}
</div>
{(currentUserIsAdmin && user._id != null && user._id !== currentUser._id) && (
Expand Down

0 comments on commit 11c980f

Please sign in to comment.