Skip to content

Commit 3283843

Browse files
committed
Fix connection type
1 parent 4cb14ec commit 3283843

File tree

4 files changed

+39
-44
lines changed

4 files changed

+39
-44
lines changed

web/components/filters/choices.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export const RELATIONSHIP_CHOICES = {
2+
Monogamous: 'mono',
3+
Polyamorous: 'poly',
4+
'Open Relationship': 'open',
5+
Other: 'other',
6+
Collaboration: 'collaboration',
7+
Friendship: 'friendship',
8+
Relationship: 'relationship',
9+
};
10+
11+
export const REVERTED_RELATIONSHIP_CHOICES = {}

web/components/filters/relationship-filter.tsx

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
import clsx from 'clsx'
2-
import {
3-
RelationshipType,
4-
convertRelationshipType,
5-
} from 'web/lib/util/convert-relationship-type'
2+
import {convertRelationshipType, RelationshipType,} from 'web/lib/util/convert-relationship-type'
63
import stringOrStringArrayToText from 'web/lib/util/string-or-string-array-to-text'
7-
import { FilterFields } from './search'
8-
import { MultiCheckbox } from 'web/components/multi-checkbox'
4+
import {FilterFields} from './search'
5+
import {MultiCheckbox} from 'web/components/multi-checkbox'
6+
7+
import {RELATIONSHIP_CHOICES} from "web/components/filters/choices";
98

109
export function RelationshipFilterText(props: {
1110
relationship: RelationshipType[] | undefined
1211
highlightedClass?: string
1312
}) {
14-
const { relationship, highlightedClass } = props
13+
const {relationship, highlightedClass} = props
1514
const relationshipLength = (relationship ?? []).length
1615

1716
if (!relationship || relationshipLength < 1) {
1817
return (
19-
<span className={clsx('text-semibold', highlightedClass)}>Any style</span>
18+
<span className={clsx('text-semibold', highlightedClass)}>Any connection</span>
2019
)
2120
}
2221

@@ -49,20 +48,13 @@ export function RelationshipFilter(props: {
4948
filters: Partial<FilterFields>
5049
updateFilter: (newState: Partial<FilterFields>) => void
5150
}) {
52-
const { filters, updateFilter } = props
51+
const {filters, updateFilter} = props
5352
return (
5453
<MultiCheckbox
5554
selected={filters.pref_relation_styles ?? []}
56-
choices={
57-
{
58-
Monogamous: 'mono',
59-
Polyamorous: 'poly',
60-
'Open Relationship': 'open',
61-
Other: 'other',
62-
} as any
63-
}
55+
choices={RELATIONSHIP_CHOICES as any}
6456
onChange={(c) => {
65-
updateFilter({ pref_relation_styles: c })
57+
updateFilter({pref_relation_styles: c})
6658
}}
6759
/>
6860
)

web/components/optional-lover-form.tsx

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {City, CityRow, loverToCity, useCitySearch} from "web/components/search-l
2828
import {AddPhotosWidget} from './widgets/add-photos'
2929
import {RadioToggleGroup} from "web/components/widgets/radio-toggle-group";
3030
import {MultipleChoiceOptions} from "common/love/multiple-choice";
31+
import {RELATIONSHIP_CHOICES} from "web/components/filters/choices";
3132

3233
export const OptionalLoveUserForm = (props: {
3334
lover: LoverRow
@@ -225,7 +226,7 @@ export const OptionalLoveUserForm = (props: {
225226
</Col>
226227

227228
<Col className={clsx(colClassName)}>
228-
<label className={clsx(labelClassName)}>Aged between</label>
229+
<label className={clsx(labelClassName)}>Who are aged between</label>
229230
<Row className={'gap-2'}>
230231
<Col>
231232
<span>Min</span>
@@ -262,6 +263,17 @@ export const OptionalLoveUserForm = (props: {
262263
</Row>
263264
</Col>
264265

266+
<Col className={clsx(colClassName)}>
267+
<label className={clsx(labelClassName)}>Connection type</label>
268+
<MultiCheckbox
269+
choices={RELATIONSHIP_CHOICES}
270+
selected={lover['pref_relation_styles']}
271+
onChange={(selected) =>
272+
setLover('pref_relation_styles', selected)
273+
}
274+
/>
275+
</Col>
276+
265277
<Col className={clsx(colClassName, 'pb-4')}>
266278
<label className={clsx(labelClassName)}>Socials</label>
267279

@@ -522,7 +534,7 @@ export const OptionalLoveUserForm = (props: {
522534
{lookingRelationship && <>
523535
<Col className={clsx(colClassName)}>
524536
<label className={clsx(labelClassName)}>
525-
You want to have kids
537+
I would like to have kids
526538
</label>
527539
<RadioToggleGroup
528540
className={'w-44'}
@@ -533,22 +545,6 @@ export const OptionalLoveUserForm = (props: {
533545
currentChoice={lover.wants_kids_strength ?? -1}
534546
/>
535547
</Col>
536-
537-
<Col className={clsx(colClassName)}>
538-
<label className={clsx(labelClassName)}>Relationship style</label>
539-
<MultiCheckbox
540-
choices={{
541-
Monogamous: 'mono',
542-
Polyamorous: 'poly',
543-
'Open Relationship': 'open',
544-
Other: 'other',
545-
}}
546-
selected={lover['pref_relation_styles']}
547-
onChange={(selected) =>
548-
setLover('pref_relation_styles', selected)
549-
}
550-
/>
551-
</Col>
552548
</>}
553549

554550
<Col className={clsx(colClassName)}>
Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
export type RelationshipType = 'mono' | 'poly' | 'open' | 'other'
1+
import {REVERTED_RELATIONSHIP_CHOICES} from "web/components/filters/choices";
2+
3+
export type RelationshipType = keyof typeof REVERTED_RELATIONSHIP_CHOICES
24

35
export function convertRelationshipType(relationshipType: RelationshipType) {
4-
if (relationshipType == 'mono') {
5-
return 'monogamous'
6-
}
7-
if (relationshipType == 'poly') {
8-
return 'polyamorous'
9-
}
10-
return relationshipType
6+
return REVERTED_RELATIONSHIP_CHOICES[relationshipType]
117
}

0 commit comments

Comments
 (0)