From bfee7ff09d4208d97ee6cc9a6272d17e4d838051 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 2 Oct 2025 14:14:24 +0200 Subject: [PATCH] Fix age rendering --- web/components/optional-profile-form.tsx | 7 ++++--- web/components/profile-about.tsx | 8 +++++--- web/components/profile/profile-info.tsx | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/web/components/optional-profile-form.tsx b/web/components/optional-profile-form.tsx index 40d1554e..54954743 100644 --- a/web/components/optional-profile-form.tsx +++ b/web/components/optional-profile-form.tsx @@ -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)} /> @@ -238,7 +239,7 @@ export const OptionalLoveUserForm = (props: { - 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'} > diff --git a/web/components/profile-about.tsx b/web/components/profile-about.tsx index beaf657a..1fa213fa 100644 --- a/web/components/profile-about.tsx +++ b/web/components/profile-about.tsx @@ -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) { diff --git a/web/components/profile/profile-info.tsx b/web/components/profile/profile-info.tsx index 901d110d..a40e6b71 100644 --- a/web/components/profile/profile-info.tsx +++ b/web/components/profile/profile-info.tsx @@ -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()