From 106ebf58c6051cbbe50fb752d963556e6effd14f Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Fri, 31 Jul 2026 11:35:17 +0200 Subject: [PATCH] Refactor deletion reasons logic to improve clarity; rename variables and centralize stay pitch check. --- .../profile/delete-account-survey-modal.tsx | 4 ++-- .../profile/stay-instead-of-delete.tsx | 18 +++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/web/components/profile/delete-account-survey-modal.tsx b/web/components/profile/delete-account-survey-modal.tsx index 29fe694f..73e69626 100644 --- a/web/components/profile/delete-account-survey-modal.tsx +++ b/web/components/profile/delete-account-survey-modal.tsx @@ -8,7 +8,7 @@ import {deleteAccount} from 'web/lib/util/delete' import {ConfirmationButton} from '../buttons/confirmation-button' import {Col} from '../layout/col' import {Title} from '../widgets/title' -import {SCARCITY_DELETION_REASONS, StayInsteadOfDelete} from './stay-instead-of-delete' +import {shouldShowStayPitch, StayInsteadOfDelete} from './stay-instead-of-delete' export function DeleteAccountSurveyModal() { const [selectedReason, setSelectedReason] = useState(null) @@ -126,7 +126,7 @@ export function DeleteAccountSurveyModal() { } } - const showStayPitch = !!selectedReason && SCARCITY_DELETION_REASONS.includes(selectedReason) + const showStayPitch = shouldShowStayPitch(selectedReason) return ( + !!reason && !NO_STAY_PITCH_DELETION_REASONS.includes(reason) + function Point(props: {icon: ReactNode; title: string; body: string}) { const {icon, title, body} = props return (