'use client' // React Imports import { useTranslations } from 'next-intl' // MUI Imports import Card from '@mui/material/Card' import CardHeader from '@mui/material/CardHeader' import CardContent from '@mui/material/CardContent' import Typography from '@mui/material/Typography' import { styled } from '@mui/material/styles' import TimelineDot from '@mui/lab/TimelineDot' import TimelineItem from '@mui/lab/TimelineItem' import TimelineContent from '@mui/lab/TimelineContent' import TimelineSeparator from '@mui/lab/TimelineSeparator' import TimelineConnector from '@mui/lab/TimelineConnector' import MuiTimeline from '@mui/lab/Timeline' import type { TimelineProps } from '@mui/lab/Timeline' // Styled Timeline const Timeline = styled(MuiTimeline)({ paddingLeft: 0, paddingRight: 0, '& .MuiTimelineItem-root': { width: '100%', '&:before': { display: 'none' } } }) type AlertItem = { title: string description: string time: string color: 'primary' | 'warning' | 'error' | 'info' | 'success' } interface FarmAlertsTimelineProps { data?: Record } const FarmAlertsTimeline = ({ data }: FarmAlertsTimelineProps) => { const t = useTranslations('farmDashboard') const alerts = (data?.alerts as AlertItem[] | undefined) ?? [] return ( } title={t('cards.farmAlertsTimeline')} titleTypographyProps={{ variant: 'h5' }} subheader={t('subheaders.explainableRecommendations')} sx={{ '& .MuiCardHeader-avatar': { mr: 3 } }} /> {alerts.map((alert, index) => ( {index < alerts.length - 1 && }
{alert.title} {alert.time}
{alert.description}
))}
) } export default FarmAlertsTimeline