Skip to content

Commit 2c73588

Browse files
committed
State the removal dialog's copy in one place
1 parent 12f6fc5 commit 2c73588

1 file changed

Lines changed: 25 additions & 16 deletions

File tree

‎apps/sim/platform/app/(shell)/settings/_components/sections/members/remove-member-modal.tsx‎

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,34 +33,43 @@ function describeImpact(
3333
return `${subject} ${who} (${formatQuotedNameList([...credentials], MAX_LISTED_CREDENTIALS)}) will stop working in organization workspaces until another member reconnects ${pronoun}.`
3434
}
3535

36+
function removalCopy(target: RemovalTarget | null) {
37+
if (target?.isSelf)
38+
return {
39+
title: 'Leave organization',
40+
confirmLabel: 'Leave organization',
41+
body: 'Are you sure you want to leave this organization? You will lose access to all team resources. This action cannot be undone.',
42+
}
43+
if (target?.isExternal)
44+
return {
45+
title: 'Remove external member',
46+
confirmLabel: 'Remove',
47+
body: `Are you sure you want to remove ${target.name} from all organization workspaces? Their workspace access and workspace credential access will be revoked. This action cannot be undone.`,
48+
}
49+
return {
50+
title: 'Remove team member',
51+
confirmLabel: 'Remove',
52+
body: `Are you sure you want to remove ${target?.name} from the team? This action cannot be undone.`,
53+
}
54+
}
55+
3656
/** Removal discloses what stops working first, holding the confirm until that check has answered. */
3757
export function RemoveMemberModal({ target, onClose }: RemoveMemberModalProps) {
3858
const removal = useMemberRemoval(target)
39-
const isSelf = target?.isSelf ?? false
40-
const title = isSelf
41-
? 'Leave organization'
42-
: target?.isExternal
43-
? 'Remove external member'
44-
: 'Remove team member'
45-
const impact = describeImpact(isSelf, removal.credentials, removal.checkFailed)
59+
const copy = removalCopy(target)
60+
const impact = describeImpact(target?.isSelf ?? false, removal.credentials, removal.checkFailed)
4661
return (
4762
<Modal
4863
variant='confirm'
4964
destructive
5065
open={target !== null}
5166
onOpenChange={(open) => !open && onClose()}
52-
title={title}
53-
confirmLabel={isSelf ? 'Leave organization' : 'Remove'}
67+
title={copy.title}
68+
confirmLabel={copy.confirmLabel}
5469
confirmDisabled={removal.checking}
5570
onConfirm={removal.confirm}
5671
>
57-
<p data-type='T060'>
58-
{isSelf
59-
? 'Are you sure you want to leave this organization? You will lose access to all team resources. This action cannot be undone.'
60-
: target?.isExternal
61-
? `Are you sure you want to remove ${target.name} from all organization workspaces? Their workspace access and workspace credential access will be revoked. This action cannot be undone.`
62-
: `Are you sure you want to remove ${target?.name} from the team? This action cannot be undone.`}
63-
</p>
72+
<p data-type='T060'>{copy.body}</p>
6473
{removal.checking ? (
6574
<p className={styles.status} role='status' data-type='T060'>
6675
Checking which connected credentials this affects…

0 commit comments

Comments
 (0)