mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-02-18 14:55:18 -05:00
Fix connection type
This commit is contained in:
11
web/components/filters/choices.tsx
Normal file
11
web/components/filters/choices.tsx
Normal file
@@ -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 = {}
|
||||
@@ -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 (
|
||||
<span className={clsx('text-semibold', highlightedClass)}>Any style</span>
|
||||
<span className={clsx('text-semibold', highlightedClass)}>Any connection</span>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -49,20 +48,13 @@ export function RelationshipFilter(props: {
|
||||
filters: Partial<FilterFields>
|
||||
updateFilter: (newState: Partial<FilterFields>) => void
|
||||
}) {
|
||||
const { filters, updateFilter } = props
|
||||
const {filters, updateFilter} = props
|
||||
return (
|
||||
<MultiCheckbox
|
||||
selected={filters.pref_relation_styles ?? []}
|
||||
choices={
|
||||
{
|
||||
Monogamous: 'mono',
|
||||
Polyamorous: 'poly',
|
||||
'Open Relationship': 'open',
|
||||
Other: 'other',
|
||||
} as any
|
||||
}
|
||||
choices={RELATIONSHIP_CHOICES as any}
|
||||
onChange={(c) => {
|
||||
updateFilter({ pref_relation_styles: c })
|
||||
updateFilter({pref_relation_styles: c})
|
||||
}}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -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: {
|
||||
</Col>
|
||||
|
||||
<Col className={clsx(colClassName)}>
|
||||
<label className={clsx(labelClassName)}>Aged between</label>
|
||||
<label className={clsx(labelClassName)}>Who are aged between</label>
|
||||
<Row className={'gap-2'}>
|
||||
<Col>
|
||||
<span>Min</span>
|
||||
@@ -262,6 +263,17 @@ export const OptionalLoveUserForm = (props: {
|
||||
</Row>
|
||||
</Col>
|
||||
|
||||
<Col className={clsx(colClassName)}>
|
||||
<label className={clsx(labelClassName)}>Connection type</label>
|
||||
<MultiCheckbox
|
||||
choices={RELATIONSHIP_CHOICES}
|
||||
selected={lover['pref_relation_styles']}
|
||||
onChange={(selected) =>
|
||||
setLover('pref_relation_styles', selected)
|
||||
}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
<Col className={clsx(colClassName, 'pb-4')}>
|
||||
<label className={clsx(labelClassName)}>Socials</label>
|
||||
|
||||
@@ -522,7 +534,7 @@ export const OptionalLoveUserForm = (props: {
|
||||
{lookingRelationship && <>
|
||||
<Col className={clsx(colClassName)}>
|
||||
<label className={clsx(labelClassName)}>
|
||||
You want to have kids
|
||||
I would like to have kids
|
||||
</label>
|
||||
<RadioToggleGroup
|
||||
className={'w-44'}
|
||||
@@ -533,22 +545,6 @@ export const OptionalLoveUserForm = (props: {
|
||||
currentChoice={lover.wants_kids_strength ?? -1}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
<Col className={clsx(colClassName)}>
|
||||
<label className={clsx(labelClassName)}>Relationship style</label>
|
||||
<MultiCheckbox
|
||||
choices={{
|
||||
Monogamous: 'mono',
|
||||
Polyamorous: 'poly',
|
||||
'Open Relationship': 'open',
|
||||
Other: 'other',
|
||||
}}
|
||||
selected={lover['pref_relation_styles']}
|
||||
onChange={(selected) =>
|
||||
setLover('pref_relation_styles', selected)
|
||||
}
|
||||
/>
|
||||
</Col>
|
||||
</>}
|
||||
|
||||
<Col className={clsx(colClassName)}>
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user