diff --git a/web/components/filters/choices.tsx b/web/components/filters/choices.tsx new file mode 100644 index 0000000..e3ebdf1 --- /dev/null +++ b/web/components/filters/choices.tsx @@ -0,0 +1,11 @@ +export const RELATIONSHIP_CHOICES = { + Monogamous: 'mono', + Polyamorous: 'poly', + 'Open Relationship': 'open', + Other: 'other', + Collaboration: 'collaboration', + Friendship: 'friendship', + Relationship: 'relationship', +}; + +export const REVERTED_RELATIONSHIP_CHOICES = {} \ No newline at end of file diff --git a/web/components/filters/relationship-filter.tsx b/web/components/filters/relationship-filter.tsx index e28a0d2..77231f1 100644 --- a/web/components/filters/relationship-filter.tsx +++ b/web/components/filters/relationship-filter.tsx @@ -1,22 +1,21 @@ import clsx from 'clsx' -import { - RelationshipType, - convertRelationshipType, -} from 'web/lib/util/convert-relationship-type' +import {convertRelationshipType, RelationshipType,} from 'web/lib/util/convert-relationship-type' import stringOrStringArrayToText from 'web/lib/util/string-or-string-array-to-text' -import { FilterFields } from './search' -import { MultiCheckbox } from 'web/components/multi-checkbox' +import {FilterFields} from './search' +import {MultiCheckbox} from 'web/components/multi-checkbox' + +import {RELATIONSHIP_CHOICES} from "web/components/filters/choices"; export function RelationshipFilterText(props: { relationship: RelationshipType[] | undefined highlightedClass?: string }) { - const { relationship, highlightedClass } = props + const {relationship, highlightedClass} = props const relationshipLength = (relationship ?? []).length if (!relationship || relationshipLength < 1) { return ( - Any style + Any connection ) } @@ -49,20 +48,13 @@ export function RelationshipFilter(props: { filters: Partial updateFilter: (newState: Partial) => void }) { - const { filters, updateFilter } = props + const {filters, updateFilter} = props return ( { - updateFilter({ pref_relation_styles: c }) + updateFilter({pref_relation_styles: c}) }} /> ) diff --git a/web/components/optional-lover-form.tsx b/web/components/optional-lover-form.tsx index 8e39441..f171290 100644 --- a/web/components/optional-lover-form.tsx +++ b/web/components/optional-lover-form.tsx @@ -28,6 +28,7 @@ import {City, CityRow, loverToCity, useCitySearch} from "web/components/search-l import {AddPhotosWidget} from './widgets/add-photos' import {RadioToggleGroup} from "web/components/widgets/radio-toggle-group"; import {MultipleChoiceOptions} from "common/love/multiple-choice"; +import {RELATIONSHIP_CHOICES} from "web/components/filters/choices"; export const OptionalLoveUserForm = (props: { lover: LoverRow @@ -225,7 +226,7 @@ export const OptionalLoveUserForm = (props: { - + Min @@ -262,6 +263,17 @@ export const OptionalLoveUserForm = (props: { + + + + setLover('pref_relation_styles', selected) + } + /> + + @@ -522,7 +534,7 @@ export const OptionalLoveUserForm = (props: { {lookingRelationship && <> - - - - - setLover('pref_relation_styles', selected) - } - /> - } diff --git a/web/lib/util/convert-relationship-type.ts b/web/lib/util/convert-relationship-type.ts index be230c0..9396906 100644 --- a/web/lib/util/convert-relationship-type.ts +++ b/web/lib/util/convert-relationship-type.ts @@ -1,11 +1,7 @@ -export type RelationshipType = 'mono' | 'poly' | 'open' | 'other' +import {REVERTED_RELATIONSHIP_CHOICES} from "web/components/filters/choices"; + +export type RelationshipType = keyof typeof REVERTED_RELATIONSHIP_CHOICES export function convertRelationshipType(relationshipType: RelationshipType) { - if (relationshipType == 'mono') { - return 'monogamous' - } - if (relationshipType == 'poly') { - return 'polyamorous' - } - return relationshipType + return REVERTED_RELATIONSHIP_CHOICES[relationshipType] }