'use client' import { format } from 'date-fns' import { BarChart2, ExternalLink } from 'lucide-react' import { useEffect, useState } from 'react' import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from 'ui' import { Chart, ChartActions, ChartBar, ChartCard, ChartContent, ChartEmptyState, ChartFooter, ChartHeader, ChartLoadingState, ChartTitle, } from 'ui-patterns/Chart' export default function ChartComposedTable() { const [isLoading, setIsLoading] = useState(true) const actions = [ { label: 'Open in Logs Explorer', onClick: () => { alert('Opening in Logs Explorer...') }, icon: , }, ] const data = Array.from({ length: 46 }, (_, i) => { const date = new Date() date.setMinutes(date.getMinutes() - i * 5) // Each point 5 minutes apart return { timestamp: date.toISOString(), standard_score: Math.floor(Math.random() * 100), } }).reverse() useEffect(() => { setTimeout(() => { setIsLoading(false) }, 1000) }, []) return (
Standard Bar Chart } title="No data to show" description="It may take up to 24 hours for data to refresh" /> } loadingState={} >
`${value}k`, width: 36, }} isFullHeight={true} />
Timestamp Standard Score {data.slice(0, 3).map((item) => ( {format(new Date(item.timestamp), 'MMM d, yyyy h:mm a')} {item.standard_score} ))}
) }