Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: remove duplicate Close button on the org invite links modal (#14974)

Alonaa4943ba61b6c
diff --git a/frontend/src/components/features/org/invite-organization-member-modal.tsx b/frontend/src/components/features/org/invite-organization-member-modal.tsx
index 85c32747f5..99ee70b9a2 100644
--- a/frontend/src/components/features/org/invite-organization-member-modal.tsx
+++ b/frontend/src/components/features/org/invite-organization-member-modal.tsx
@@ -86,6 +86,7 @@ export function InviteOrganizationMemberModal({
primaryButtonText={t(I18nKey.BUTTON$CLOSE)}
onPrimaryClick={() => onClose()}
onClose={onClose}
+ hideSecondaryButton
>
<div className="flex flex-col gap-2" data-testid="invite-links-list">
{/* With email configured the modal only stays open to show failures;
diff --git a/frontend/src/components/shared/modals/modal-button-group.tsx b/frontend/src/components/shared/modals/modal-button-group.tsx
index c9f73bcf72..e7f3c6891d 100644
--- a/frontend/src/components/shared/modals/modal-button-group.tsx
+++ b/frontend/src/components/shared/modals/modal-button-group.tsx
@@ -15,6 +15,9 @@ interface ModalButtonGroupProps {
primaryTestId?: string;
secondaryTestId?: string;
fullWidth?: boolean;
+ // For single-action modals where the primary button already closes; avoids a
+ // redundant second "Close" button next to it.
+ hideSecondaryButton?: boolean;
}
export function ModalButtonGroup({
@@ -27,6 +30,7 @@ export function ModalButtonGroup({
primaryTestId,
secondaryTestId,
fullWidth = false,
+ hideSecondaryButton = false,
}: ModalButtonGroupProps) {
const { t } = useTranslation();
const closeText = secondaryText ?? t(I18nKey.BUTTON$CLOSE);
@@ -55,16 +59,18 @@ export function ModalButtonGroup({
primaryText
)}
</BrandButton>
- <BrandButton
- type="button"
- variant="secondary"
- onClick={onSecondaryClick}
- className={cn(fullWidth ? "w-full" : "grow")}
- testId={secondaryTestId}
- isDisabled={isLoading}
- >
- {closeText}
- </BrandButton>
+ {!hideSecondaryButton && (
+ <BrandButton
+ type="button"
+ variant="secondary"
+ onClick={onSecondaryClick}
+ className={cn(fullWidth ? "w-full" : "grow")}
+ testId={secondaryTestId}
+ isDisabled={isLoading}
+ >
+ {closeText}
+ </BrandButton>
+ )}
</div>
);
}
diff --git a/frontend/src/components/shared/modals/org-modal.tsx b/frontend/src/components/shared/modals/org-modal.tsx
index 054fc1f673..1a29c3268e 100644
--- a/frontend/src/components/shared/modals/org-modal.tsx
+++ b/frontend/src/components/shared/modals/org-modal.tsx
@@ -20,6 +20,7 @@ interface OrgModalProps {
asForm?: boolean;
formAction?: (formData: FormData) => void;
fullWidthButtons?: boolean;
+ hideSecondaryButton?: boolean;
}
export function OrgModal({
@@ -39,6 +40,7 @@ export function OrgModal({
asForm = false,
formAction,
fullWidthButtons = false,
+ hideSecondaryButton = false,
}: OrgModalProps) {
const content = (
<>
@@ -59,6 +61,7 @@ export function OrgModal({
primaryTestId={primaryButtonTestId}
secondaryTestId={secondaryButtonTestId}
fullWidth={fullWidthButtons}
+ hideSecondaryButton={hideSecondaryButton}
/>
</>
);