feat: Add back button to insights page

Added back button to UnifiedInsightsDashboard component to match
the navigation pattern used in tracker pages (sleep, feeding, etc).

Changes:
- Added ArrowBack icon import
- Added useRouter hook
- Added IconButton with router.back() onClick handler
- Restructured header to include back button alongside title

Now insights page has consistent navigation with tracker pages.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-05 07:16:03 +00:00
parent b94f298d2b
commit ee6b5cddee
2 changed files with 18 additions and 10 deletions

View File

@@ -13,8 +13,10 @@ import {
CircularProgress,
Alert,
Grid,
IconButton,
} from '@mui/material';
import { Timeline, TrendingUp, Assessment } from '@mui/icons-material';
import { Timeline, TrendingUp, Assessment, ArrowBack } from '@mui/icons-material';
import { useRouter } from 'next/navigation';
import { childrenApi, Child } from '@/lib/api/children';
import { analyticsApi, PatternInsights, PredictionInsights } from '@/lib/api/analytics';
import { InsightsDashboard } from './InsightsDashboard';
@@ -46,6 +48,7 @@ function TabPanel(props: TabPanelProps) {
}
export function UnifiedInsightsDashboard() {
const router = useRouter();
const { user } = useAuth();
const [children, setChildren] = useState<Child[]>([]);
const [selectedChildId, setSelectedChildId] = useState<string>('');
@@ -162,14 +165,19 @@ export function UnifiedInsightsDashboard() {
transition={{ duration: 0.5 }}
>
<Box sx={{ px: { xs: 2, sm: 3 }, py: 3 }}>
{/* Header */}
<Box sx={{ mb: 3 }}>
<Typography variant="h4" gutterBottom fontWeight={600}>
Insights & Predictions
</Typography>
<Typography variant="body2" color="text.secondary">
AI-powered insights, patterns, and predictions for your child
</Typography>
{/* Header with Back Button */}
<Box sx={{ display: 'flex', alignItems: 'center', mb: 3 }}>
<IconButton onClick={() => router.back()} sx={{ mr: 2 }}>
<ArrowBack />
</IconButton>
<Box>
<Typography variant="h4" fontWeight={600}>
Insights & Predictions
</Typography>
<Typography variant="body2" color="text.secondary">
AI-powered insights, patterns, and predictions for your child
</Typography>
</Box>
</Box>
{/* Error Alert */}

File diff suppressed because one or more lines are too long