1- import { Fragment , useEffect , useRef , useState } from 'react'
1+ import { Fragment , useRef , useState } from 'react'
22import { Title } from 'web/components/widgets/title'
33import { Col } from 'web/components/layout/col'
44import clsx from 'clsx'
@@ -112,10 +112,6 @@ export const OptionalProfileUserForm = (props: {
112112 }
113113 }
114114
115- const [ trans , setTrans ] = useState < boolean | undefined > (
116- profile [ 'gender' ] . includes ( 'trans' )
117- )
118-
119115 function setProfileCity ( inputCity : City | undefined ) {
120116 if ( ! inputCity ) {
121117 setProfile ( 'geodb_city_id' , null )
@@ -142,17 +138,6 @@ export const OptionalProfileUserForm = (props: {
142138 }
143139 }
144140
145- useEffect ( ( ) => {
146- const currentState = profile [ 'gender' ]
147- if ( currentState === 'non-binary' ) {
148- setTrans ( undefined )
149- } else if ( trans && ! currentState . includes ( 'trans-' ) ) {
150- setProfile ( 'gender' , 'trans-' + currentState . replace ( 'trans-' , '' ) )
151- } else if ( ! trans && currentState . includes ( 'trans-' ) ) {
152- setProfile ( 'gender' , currentState . replace ( 'trans-' , '' ) )
153- }
154- } , [ trans , profile [ 'gender' ] ] )
155-
156141 return (
157142 < >
158143 { /*<Row className={'justify-end'}>*/ }
@@ -214,7 +199,7 @@ export const OptionalProfileUserForm = (props: {
214199 < Col className = { 'gap-1' } >
215200 < label className = { clsx ( labelClassName ) } > Gender</ label >
216201 < ChoicesToggleGroup
217- currentChoice = { profile [ 'gender' ] . replace ( 'trans-' , '' ) }
202+ currentChoice = { profile [ 'gender' ] }
218203 choicesMap = { {
219204 Woman : 'female' ,
220205 Man : 'male' ,
@@ -233,7 +218,7 @@ export const OptionalProfileUserForm = (props: {
233218 Men : 'male' ,
234219 Other : 'other' ,
235220 } }
236- selected = { profile [ 'pref_gender' ] }
221+ selected = { profile [ 'pref_gender' ] || [ ] }
237222 onChange = { ( selected ) => setProfile ( 'pref_gender' , selected ) }
238223 />
239224 </ Col >
@@ -282,7 +267,7 @@ export const OptionalProfileUserForm = (props: {
282267 < label className = { clsx ( labelClassName ) } > Connection type</ label >
283268 < MultiCheckbox
284269 choices = { RELATIONSHIP_CHOICES }
285- selected = { profile [ 'pref_relation_styles' ] }
270+ selected = { profile [ 'pref_relation_styles' ] || [ ] }
286271 onChange = { ( selected ) => {
287272 setProfile ( 'pref_relation_styles' , selected )
288273 setLookingRelationship ( ( selected || [ ] ) . includes ( 'relationship' ) )
0 commit comments