Refactor deletion reasons logic to improve clarity; rename variables and centralize stay pitch check.

This commit is contained in:
MartinBraquet
2026-07-31 11:35:17 +02:00
parent 9acb2d2be8
commit 106ebf58c6
2 changed files with 13 additions and 9 deletions

View File

@@ -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<string | null>(null)
@@ -126,7 +126,7 @@ export function DeleteAccountSurveyModal() {
}
}
const showStayPitch = !!selectedReason && SCARCITY_DELETION_REASONS.includes(selectedReason)
const showStayPitch = shouldShowStayPitch(selectedReason)
return (
<ConfirmationButton

View File

@@ -6,16 +6,20 @@ import {Col} from '../layout/col'
import {Row} from '../layout/row'
/**
* Reasons that boil down to "there aren't enough people here (yet)". Deleting is the one move that
* makes that worse for the person doing it: they stop being found, and they stop being told when
* someone who fits shows up.
* Reasons where the pitch to stay would be tone-deaf: the person already found someone, so keeping a
* profile findable is not something they want. Every other reason gets the pitch — deleting is the
* one move that makes things worse for the person doing it: they stop being found, and they stop
* being told when someone who fits shows up.
*/
export const SCARCITY_DELETION_REASONS = [
'not_enough_relevant_people',
'platform_not_active_enough',
'low_response_rate',
export const NO_STAY_PITCH_DELETION_REASONS = [
'found_connection_on_compass',
'found_connection_elsewhere',
]
/** Whether to show the "one thing before you go" pitch for a stated deletion reason. */
export const shouldShowStayPitch = (reason: string | null) =>
!!reason && !NO_STAY_PITCH_DELETION_REASONS.includes(reason)
function Point(props: {icon: ReactNode; title: string; body: string}) {
const {icon, title, body} = props
return (