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