mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-06 07:52:27 -05:00
Fix age rendering
This commit is contained in:
@@ -65,6 +65,7 @@ export const OptionalLoveUserForm = (props: {
|
||||
const handleSubmit = async () => {
|
||||
setIsSubmitting(true)
|
||||
const {bio: _, ...otherProfileProps} = profile
|
||||
console.log('otherProfileProps', removeNullOrUndefinedProps(otherProfileProps))
|
||||
const {error} = await tryCatch(
|
||||
updateProfile(removeNullOrUndefinedProps(otherProfileProps) as any)
|
||||
)
|
||||
@@ -198,7 +199,7 @@ export const OptionalLoveUserForm = (props: {
|
||||
value={profile['age'] ?? undefined}
|
||||
min={18}
|
||||
max={100}
|
||||
onChange={(e) => setProfile('age', Number(e.target.value))}
|
||||
onChange={(e) => setProfile('age', e.target.value ? Number(e.target.value) : null)}
|
||||
/>
|
||||
</Col>
|
||||
|
||||
@@ -238,7 +239,7 @@ export const OptionalLoveUserForm = (props: {
|
||||
<Select
|
||||
value={profile['pref_age_min'] ?? ''}
|
||||
onChange={(e) =>
|
||||
setProfile('pref_age_min', Number(e.target.value))
|
||||
setProfile('pref_age_min', e.target.value ? Number(e.target.value) : 18)
|
||||
}
|
||||
className={'w-18 border-ink-300 rounded-md'}
|
||||
>
|
||||
@@ -255,7 +256,7 @@ export const OptionalLoveUserForm = (props: {
|
||||
<Select
|
||||
value={profile['pref_age_max'] ?? ''}
|
||||
onChange={(e) =>
|
||||
setProfile('pref_age_max', Number(e.target.value))
|
||||
setProfile('pref_age_max', e.target.value ? Number(e.target.value) : 100)
|
||||
}
|
||||
className={'w-18 border-ink-300 rounded-md'}
|
||||
>
|
||||
|
||||
@@ -107,12 +107,14 @@ function Seeking(props: { profile: Profile }) {
|
||||
})
|
||||
|
||||
const ageRangeText =
|
||||
min == 18 && max == 100
|
||||
min == 18 && max == 100 || min == undefined && max == undefined
|
||||
? 'of any age'
|
||||
: min == max
|
||||
? `exactly ${min} years old`
|
||||
: max == 100
|
||||
? `${min} or older`
|
||||
: max == 100 || max == undefined
|
||||
? `older than ${min}`
|
||||
: min == 18 || min == undefined
|
||||
? `younger than ${max}`
|
||||
: `between ${min} - ${max} years old`
|
||||
|
||||
if (!prefGender || prefGender.length < 1) {
|
||||
|
||||
@@ -23,8 +23,8 @@ export function ProfileInfo(props: {
|
||||
fromProfilePage?: Profile
|
||||
fromSignup?: boolean
|
||||
}) {
|
||||
console.log('Rendering ProfileProfile for ', props)
|
||||
const {profile, user, refreshProfile, fromProfilePage, fromSignup} = props
|
||||
console.log('Rendering Profile for', user.username, user.name, props)
|
||||
|
||||
const currentUser = useUser()
|
||||
// const currentProfile = useProfile()
|
||||
|
||||
Reference in New Issue
Block a user