'use client' import { BarChart2, ExternalLink, LineChart } from 'lucide-react' import { useEffect, useState } from 'react' import { Chart, ChartActions, ChartBar, ChartCard, ChartContent, ChartEmptyState, ChartHeader, ChartLine, ChartLoadingState, ChartTitle, } from 'ui-patterns/Chart' export default function ChartComposedActions() { const [isLoading, setIsLoading] = useState(true) const [chartType, setChartType] = useState<'bar' | 'line'>('bar') const actions = [ { label: 'Open in Logs Explorer', onClick: () => { alert('Opening in Logs Explorer...') }, icon: , }, { label: 'Toggle Chart Type', onClick: () => { setChartType(chartType === 'bar' ? 'line' : 'bar') }, icon: chartType === 'bar' ? : , }, ] 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(), requests: Math.floor(Math.random() * 100), } }).reverse() useEffect(() => { setTimeout(() => { setIsLoading(false) }, 1000) }, []) return (
Total Requests } title="No data to show" description="It may take up to 24 hours for data to refresh" /> } loadingState={} >
{chartType === 'bar' ? ( `${value}k`, width: 36, }} isFullHeight={true} /> ) : ( `${value}k`, width: 36, }} isFullHeight={true} /> )}
) }