Skip to content

Commit c824b68

Browse files
committed
fix(webapp): restyle the leave and remove team member dialogs
The dialog was still built on the old Alert primitive, so the whole question sat in the title, there was no header divider or Esc affordance, and the footer used small right-aligned buttons. It now uses the standard Dialog layout, and the copy names the person being removed instead of only saying "them".
1 parent 205bdc3 commit c824b68

2 files changed

Lines changed: 50 additions & 36 deletions

File tree

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
Removing a teammate now shows a clearer confirmation dialog that names the person you're removing.

apps/webapp/app/routes/_app.orgs.$organizationSlug.settings.team/route.tsx

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ import { UserAvatar } from "~/components/UserProfilePhoto";
2020
import { AdminDebugTooltip } from "~/components/admin/debugTooltip";
2121
import { CopyableText } from "~/components/primitives/CopyableText";
2222
import { PageBody, PageContainer } from "~/components/layout/AppLayout";
23-
import {
24-
Alert,
25-
AlertCancel,
26-
AlertContent,
27-
AlertDescription,
28-
AlertFooter,
29-
AlertHeader,
30-
AlertTitle,
31-
AlertTrigger,
32-
} from "~/components/primitives/Alert";
3323
import { Button, ButtonContent, LinkButton } from "~/components/primitives/Buttons";
3424
import { PermissionButton } from "~/components/primitives/PermissionButton";
3525
import { DateTime } from "~/components/primitives/DateTime";
@@ -659,8 +649,14 @@ function LeaveRemoveButton({
659649
<LeaveTeamModal
660650
member={member}
661651
buttonText="Leave team"
662-
title="Are you sure you want to leave the team?"
663-
description={`You will no longer have access to ${organization.title}. To regain access, you will need to be invited again.`}
652+
title="Leave team"
653+
description={
654+
<>
655+
Are you sure you want to leave the team? You will no longer have access to{" "}
656+
<span className="text-text-bright">{organization.title}</span>. To regain access, you
657+
will need to be invited again.
658+
</>
659+
}
664660
actionText="Leave team"
665661
/>
666662
);
@@ -684,8 +680,16 @@ function LeaveRemoveButton({
684680
<LeaveTeamModal
685681
member={member}
686682
buttonText="Remove from team"
687-
title={`Are you sure you want to remove ${member.user.name ?? "them"} from the team?`}
688-
description={`They will no longer have access to ${organization.title}. To regain access, you will need to invite them again.`}
683+
title="Remove team member"
684+
description={
685+
<>
686+
Are you sure you want to remove{" "}
687+
<span className="text-text-bright">{member.user.name ?? member.user.email}</span> from the
688+
team? They will no longer have access to{" "}
689+
<span className="text-text-bright">{organization.title}</span>. To regain access, you will
690+
need to invite them again.
691+
</>
692+
}
689693
actionText="Remove from team"
690694
/>
691695
);
@@ -795,7 +799,7 @@ function LeaveTeamModal({
795799
member: Member;
796800
buttonText: string;
797801
title: string;
798-
description: string;
802+
description: React.ReactNode;
799803
actionText: string;
800804
}) {
801805
const [open, setOpen] = useState(false);
@@ -811,28 +815,32 @@ function LeaveTeamModal({
811815
});
812816

813817
return (
814-
<Alert open={open} onOpenChange={(o) => setOpen(o)}>
815-
<AlertTrigger asChild>
818+
<Dialog open={open} onOpenChange={setOpen}>
819+
<DialogTrigger asChild>
816820
<Button variant="secondary/small">{buttonText}</Button>
817-
</AlertTrigger>
818-
<AlertContent>
819-
<AlertHeader>
820-
<AlertTitle>{title}</AlertTitle>
821-
<AlertDescription>{description}</AlertDescription>
822-
</AlertHeader>
823-
<AlertFooter>
824-
<AlertCancel asChild>
825-
<Button variant="secondary/small">Cancel</Button>
826-
</AlertCancel>
827-
<Form method="post" {...getFormProps(form)} onSubmit={() => setOpen(false)}>
828-
<input type="hidden" value={member.id} name="memberId" />
829-
<Button type="submit" variant="danger/small" form={form.id}>
830-
{actionText}
831-
</Button>
832-
</Form>
833-
</AlertFooter>
834-
</AlertContent>
835-
</Alert>
821+
</DialogTrigger>
822+
<DialogContent className="sm:max-w-md">
823+
<DialogHeader>{title}</DialogHeader>
824+
<Form method="post" {...getFormProps(form)} onSubmit={() => setOpen(false)}>
825+
<input type="hidden" value={member.id} name="memberId" />
826+
<Paragraph variant="small" className="pb-4 pt-2">
827+
{description}
828+
</Paragraph>
829+
<FormButtons
830+
confirmButton={
831+
<Button type="submit" variant="danger/medium">
832+
{actionText}
833+
</Button>
834+
}
835+
cancelButton={
836+
<DialogClose asChild>
837+
<Button variant="secondary/medium">Cancel</Button>
838+
</DialogClose>
839+
}
840+
/>
841+
</Form>
842+
</DialogContent>
843+
</Dialog>
836844
);
837845
}
838846

0 commit comments

Comments
 (0)