diff --git a/maternal-web/app/(auth)/onboarding/page.tsx b/maternal-web/app/(auth)/onboarding/page.tsx
index 68ccd12..0c0593c 100644
--- a/maternal-web/app/(auth)/onboarding/page.tsx
+++ b/maternal-web/app/(auth)/onboarding/page.tsx
@@ -67,8 +67,8 @@ export default function OnboardingPage() {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
} catch (err: any) {
console.error('Failed to save language:', err);
- setError('Failed to save language preference. Continuing anyway...');
- setTimeout(() => setActiveStep((prevActiveStep) => prevActiveStep + 1), 1500);
+ // Language was saved locally even if backend failed, so continue
+ setActiveStep((prevActiveStep) => prevActiveStep + 1);
} finally {
setLoading(false);
}
@@ -90,8 +90,8 @@ export default function OnboardingPage() {
setActiveStep((prevActiveStep) => prevActiveStep + 1);
} catch (err: any) {
console.error('Failed to save measurement:', err);
- setError('Failed to save measurement preference. Continuing anyway...');
- setTimeout(() => setActiveStep((prevActiveStep) => prevActiveStep + 1), 1500);
+ // Measurement was saved locally even if backend failed, so continue
+ setActiveStep((prevActiveStep) => prevActiveStep + 1);
} finally {
setLoading(false);
}
@@ -107,7 +107,8 @@ export default function OnboardingPage() {
const familyId = user?.families?.[0]?.familyId;
if (!familyId) {
- setError('No family found. Please try logging out and back in.');
+ console.error('No family found. User object:', JSON.stringify(user, null, 2));
+ setError('Unable to create child profile. Your account setup is incomplete. Please contact support or try logging out and back in.');
return;
}
diff --git a/maternal-web/app/track/page.tsx b/maternal-web/app/track/page.tsx
index 6382cc2..429ee45 100644
--- a/maternal-web/app/track/page.tsx
+++ b/maternal-web/app/track/page.tsx
@@ -74,39 +74,36 @@ export default function TrackPage() {
onClick={() => router.push(option.path)}
sx={{
height: '100%',
- display: 'flex',
- flexDirection: 'column',
- alignItems: 'center',
- justifyContent: 'center',
+ width: '100%',
}}
>
-
+
{option.icon}
{option.title}
-
+
diff --git a/maternal-web/components/features/analytics/InsightsDashboard.tsx b/maternal-web/components/features/analytics/InsightsDashboard.tsx
index a970a67..0f09786 100644
--- a/maternal-web/components/features/analytics/InsightsDashboard.tsx
+++ b/maternal-web/components/features/analytics/InsightsDashboard.tsx
@@ -364,20 +364,27 @@ export const InsightsDashboard: React.FC = () => {
transition={{ duration: 0.3, delay: 0 }}
>
-
-
-
-
- {t('stats.feedings.title')}
-
-
+
+
{stats.totalFeedings}
{t('stats.feedings.subtitle')}
-
+
@@ -389,20 +396,27 @@ export const InsightsDashboard: React.FC = () => {
transition={{ duration: 0.3, delay: 0.1 }}
>
-
-
-
-
- {t('stats.sleep.title')}
-
-
+
+
{stats.avgSleepHours}h
{t('stats.sleep.subtitle')}
-
+
@@ -414,20 +428,27 @@ export const InsightsDashboard: React.FC = () => {
transition={{ duration: 0.3, delay: 0.2 }}
>
-
-
-
-
- {t('stats.diapers.title')}
-
-
+
+
{stats.totalDiapers}
{t('stats.diapers.subtitle')}
-
+
@@ -439,20 +460,27 @@ export const InsightsDashboard: React.FC = () => {
transition={{ duration: 0.3, delay: 0.3 }}
>
-
-
-
-
- {t('stats.topActivity.title')}
-
-
+
+
{t(`activityTypes.${stats.mostCommonType}`)}
{t('stats.topActivity.subtitle')}
-
+
diff --git a/maternal-web/lib/auth/AuthContext.tsx b/maternal-web/lib/auth/AuthContext.tsx
index 03d8498..02434c1 100644
--- a/maternal-web/lib/auth/AuthContext.tsx
+++ b/maternal-web/lib/auth/AuthContext.tsx
@@ -170,7 +170,7 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
// Backend returns { success, data: { user, family, tokens } }
const { data: responseData } = response.data;
- const { tokens, user: userData } = responseData;
+ const { tokens, user: userData, family: familyData } = responseData;
if (!tokens?.accessToken || !tokens?.refreshToken) {
throw new Error('Invalid response from server');
@@ -178,9 +178,19 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
const { accessToken, refreshToken } = tokens;
+ // Add family data to user object (registration returns family separately)
+ const userWithFamily = {
+ ...userData,
+ families: familyData ? [{
+ id: familyData.id,
+ familyId: familyData.id,
+ role: familyData.role || 'parent',
+ }] : [],
+ };
+
tokenStorage.setTokens(accessToken, refreshToken);
setToken(accessToken);
- setUser(userData);
+ setUser(userWithFamily);
// Redirect to onboarding
router.push('/onboarding');