mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-07-31 10:19:38 -04:00
Refactor deletion reasons logic to improve clarity; rename variables and centralize stay pitch check.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user