Skip to content

Commit bfee7ff

Browse files
committed
Fix age rendering
1 parent ce1305d commit bfee7ff

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

web/components/optional-profile-form.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export const OptionalLoveUserForm = (props: {
6565
const handleSubmit = async () => {
6666
setIsSubmitting(true)
6767
const {bio: _, ...otherProfileProps} = profile
68+
console.log('otherProfileProps', removeNullOrUndefinedProps(otherProfileProps))
6869
const {error} = await tryCatch(
6970
updateProfile(removeNullOrUndefinedProps(otherProfileProps) as any)
7071
)
@@ -198,7 +199,7 @@ export const OptionalLoveUserForm = (props: {
198199
value={profile['age'] ?? undefined}
199200
min={18}
200201
max={100}
201-
onChange={(e) => setProfile('age', Number(e.target.value))}
202+
onChange={(e) => setProfile('age', e.target.value ? Number(e.target.value) : null)}
202203
/>
203204
</Col>
204205

@@ -238,7 +239,7 @@ export const OptionalLoveUserForm = (props: {
238239
<Select
239240
value={profile['pref_age_min'] ?? ''}
240241
onChange={(e) =>
241-
setProfile('pref_age_min', Number(e.target.value))
242+
setProfile('pref_age_min', e.target.value ? Number(e.target.value) : 18)
242243
}
243244
className={'w-18 border-ink-300 rounded-md'}
244245
>
@@ -255,7 +256,7 @@ export const OptionalLoveUserForm = (props: {
255256
<Select
256257
value={profile['pref_age_max'] ?? ''}
257258
onChange={(e) =>
258-
setProfile('pref_age_max', Number(e.target.value))
259+
setProfile('pref_age_max', e.target.value ? Number(e.target.value) : 100)
259260
}
260261
className={'w-18 border-ink-300 rounded-md'}
261262
>

web/components/profile-about.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,14 @@ function Seeking(props: { profile: Profile }) {
107107
})
108108

109109
const ageRangeText =
110-
min == 18 && max == 100
110+
min == 18 && max == 100 || min == undefined && max == undefined
111111
? 'of any age'
112112
: min == max
113113
? `exactly ${min} years old`
114-
: max == 100
115-
? `${min} or older`
114+
: max == 100 || max == undefined
115+
? `older than ${min}`
116+
: min == 18 || min == undefined
117+
? `younger than ${max}`
116118
: `between ${min} - ${max} years old`
117119

118120
if (!prefGender || prefGender.length < 1) {

web/components/profile/profile-info.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ export function ProfileInfo(props: {
2323
fromProfilePage?: Profile
2424
fromSignup?: boolean
2525
}) {
26-
console.log('Rendering ProfileProfile for ', props)
2726
const {profile, user, refreshProfile, fromProfilePage, fromSignup} = props
27+
console.log('Rendering Profile for', user.username, user.name, props)
2828

2929
const currentUser = useUser()
3030
// const currentProfile = useProfile()

0 commit comments

Comments
 (0)