'use client';
import { Alert, AlertTitle, Box, Chip, List, ListItem, ListItemIcon, ListItemText, Collapse } from '@mui/material';
import { ChildCare, CheckCircle, Timeline, Schedule } from '@mui/icons-material';
import { useState } from 'react';
import { GrowthSpurtDetection } from '@/lib/api/analytics';
interface GrowthSpurtAlertProps {
growthSpurt: GrowthSpurtDetection | null;
}
export default function GrowthSpurtAlert({ growthSpurt }: GrowthSpurtAlertProps) {
const [expanded, setExpanded] = useState(false);
if (!growthSpurt || !growthSpurt.isLikelyGrowthSpurt) {
return null;
}
const confidencePercent = Math.round(growthSpurt.confidence * 100);
const severityColor = growthSpurt.confidence >= 0.7 ? 'warning' : 'info';
return (
}
sx={{ mb: 3, cursor: 'pointer' }}
onClick={() => setExpanded(!expanded)}
>
Possible Growth Spurt Detected
Expected duration: {growthSpurt.expectedDuration}
{/* Indicators */}
{growthSpurt.indicators.length > 0 && (
Indicators observed:
{growthSpurt.indicators.map((indicator, index) => (
))}
)}
{/* Recommendations */}
{growthSpurt.recommendations.length > 0 && (
What to do:
{growthSpurt.recommendations.map((rec, index) => (
))}
)}
{!expanded && (
Click to see details and recommendations
)}
);
}