@@ -41,12 +41,12 @@ def render_profile_page():
4141 with col_inputs :
4242 col1 , col2 = st .columns (2 )
4343 with col1 :
44- height = st .number_input ("Height (cm)" , value = float (profile .get ("height" ) or 170.0 ) )
45- weight = st .number_input ("Weight (kg)" , value = float (profile .get ("weight" ) or 70.0 ))
44+ height = st .number_input ("Height (cm)" , value = int (profile .get ("height" ) or 170 ), format = "%d" , step = 1 )
45+ weight = st .number_input ("Weight (kg)" , value = float (profile .get ("weight" ) or 70.0 ), format = "%.1f" , step = 0.1 )
4646 diet = st .selectbox ("Diet" , ["Vegetarian" , "Non-Vegetarian" , "Vegan" , "Keto" , "Other" ], index = 0 if not profile .get ("diet" ) else ["Vegetarian" , "Non-Vegetarian" , "Vegan" , "Keto" , "Other" ].index (profile .get ("diet" )))
4747 with col2 :
4848 activity = st .selectbox ("Activity Level" , ["Sedentary" , "Lightly Active" , "Moderately Active" , "Very Active" ], index = 0 )
49- sleep = st .slider ("Sleep (Hours)" , 4.0 , 12.0 , float (profile .get ("sleep_hours" ) or 7.0 ))
49+ sleep = st .slider ("Sleep (Hours)" , 4.0 , 12.0 , float (profile .get ("sleep_hours" ) or 7.0 ), step = 0.5 , format = "%.1f" )
5050 stress = st .selectbox ("Stress Level" , ["Low" , "Moderate" , "High" ], index = 1 )
5151
5252 allow_data = st .checkbox ("Allow Data Collection for AI Improvement" , value = profile .get ("allow_data_collection" , True ))
@@ -70,8 +70,10 @@ def render_profile_page():
7070 "stress_level" : stress , "allow_data_collection" : allow_data ,
7171 "profile_picture" : pic_data
7272 }
73- api .update_profile (payload )
74- st .rerun ()
73+ if api .update_profile (payload ):
74+ # Update Session State immediately for Sidebar sync
75+ st .session_state ['profile_picture' ] = pic_data
76+ st .rerun ()
7577
7678 # Display Metrics
7779 st .markdown ("### My Stats" )
0 commit comments