fix: Handle family data correctly during registration and onboarding
- Extract family data from registration response and add to user object - Backend returns family separately in registration, but included in user for login - Remove error messages for language/measurement preferences (they save correctly) - Add detailed console logging for debugging family issues - Improve error message when family is missing during child creation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -364,20 +364,27 @@ export const InsightsDashboard: React.FC = () => {
|
||||
transition={{ duration: 0.3, delay: 0 }}
|
||||
>
|
||||
<Card sx={{ bgcolor: COLORS.feeding, color: 'white', height: '160px', minHeight: '160px', width: '100%' }}>
|
||||
<CardContent sx={{ height: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center', p: 2, '&:last-child': { pb: 2 } }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>
|
||||
<Restaurant sx={{ fontSize: 32, mr: 1 }} />
|
||||
<Typography variant="h6" fontWeight="600">
|
||||
{t('stats.feedings.title')}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '160px',
|
||||
minHeight: '160px',
|
||||
width: '100%',
|
||||
p: 2,
|
||||
}}
|
||||
>
|
||||
<Restaurant sx={{ fontSize: 32, mb: 1 }} />
|
||||
<Typography variant="h3" fontWeight="700">
|
||||
{stats.totalFeedings}
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ opacity: 0.9, mt: 1 }}>
|
||||
{t('stats.feedings.subtitle')}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Box>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</Grid>
|
||||
@@ -389,20 +396,27 @@ export const InsightsDashboard: React.FC = () => {
|
||||
transition={{ duration: 0.3, delay: 0.1 }}
|
||||
>
|
||||
<Card sx={{ bgcolor: COLORS.sleep, color: 'white', height: '160px', minHeight: '160px', width: '100%' }}>
|
||||
<CardContent sx={{ height: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center', p: 2, '&:last-child': { pb: 2 } }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>
|
||||
<Hotel sx={{ fontSize: 32, mr: 1 }} />
|
||||
<Typography variant="h6" fontWeight="600">
|
||||
{t('stats.sleep.title')}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '160px',
|
||||
minHeight: '160px',
|
||||
width: '100%',
|
||||
p: 2,
|
||||
}}
|
||||
>
|
||||
<Hotel sx={{ fontSize: 32, mb: 1 }} />
|
||||
<Typography variant="h3" fontWeight="700">
|
||||
{stats.avgSleepHours}h
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ opacity: 0.9, mt: 1 }}>
|
||||
{t('stats.sleep.subtitle')}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Box>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</Grid>
|
||||
@@ -414,20 +428,27 @@ export const InsightsDashboard: React.FC = () => {
|
||||
transition={{ duration: 0.3, delay: 0.2 }}
|
||||
>
|
||||
<Card sx={{ bgcolor: COLORS.diaper, color: 'white', height: '160px', minHeight: '160px', width: '100%' }}>
|
||||
<CardContent sx={{ height: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center', p: 2, '&:last-child': { pb: 2 } }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>
|
||||
<BabyChangingStation sx={{ fontSize: 32, mr: 1 }} />
|
||||
<Typography variant="h6" fontWeight="600">
|
||||
{t('stats.diapers.title')}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '160px',
|
||||
minHeight: '160px',
|
||||
width: '100%',
|
||||
p: 2,
|
||||
}}
|
||||
>
|
||||
<BabyChangingStation sx={{ fontSize: 32, mb: 1 }} />
|
||||
<Typography variant="h3" fontWeight="700">
|
||||
{stats.totalDiapers}
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ opacity: 0.9, mt: 1 }}>
|
||||
{t('stats.diapers.subtitle')}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Box>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</Grid>
|
||||
@@ -439,20 +460,27 @@ export const InsightsDashboard: React.FC = () => {
|
||||
transition={{ duration: 0.3, delay: 0.3 }}
|
||||
>
|
||||
<Card sx={{ bgcolor: COLORS.milestone, color: 'white', height: '160px', minHeight: '160px', width: '100%' }}>
|
||||
<CardContent sx={{ height: '100%', display: 'flex', flexDirection: 'column', justifyContent: 'center', p: 2, '&:last-child': { pb: 2 } }}>
|
||||
<Box sx={{ display: 'flex', alignItems: 'center', mb: 1 }}>
|
||||
<TrendingUp sx={{ fontSize: 32, mr: 1 }} />
|
||||
<Typography variant="h6" fontWeight="600">
|
||||
{t('stats.topActivity.title')}
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
textAlign: 'center',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
height: '160px',
|
||||
minHeight: '160px',
|
||||
width: '100%',
|
||||
p: 2,
|
||||
}}
|
||||
>
|
||||
<TrendingUp sx={{ fontSize: 32, mb: 1 }} />
|
||||
<Typography variant="h3" fontWeight="700" sx={{ textTransform: 'capitalize' }}>
|
||||
{t(`activityTypes.${stats.mostCommonType}`)}
|
||||
</Typography>
|
||||
<Typography variant="body2" sx={{ opacity: 0.9, mt: 1 }}>
|
||||
{t('stats.topActivity.subtitle')}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Box>
|
||||
</Card>
|
||||
</motion.div>
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user