'use client' import { useState, useEffect } from 'react' import { LineChart } from '@/components/charts/LineChart' import axios from 'axios' const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:4000' export function PerformanceMetrics() { const [metrics, setMetrics] = useState(null) const [loading, setLoading] = useState(true) useEffect(() => { fetchMetrics() const interval = setInterval(fetchMetrics, 60000) // Refresh every minute return () => clearInterval(interval) }, []) const fetchMetrics = async () => { try { const response = await axios.get(`${API_URL}/api/analytics/metrics`) setMetrics(response.data) } catch (error) { console.error('Error fetching performance metrics:', error) } finally { setLoading(false) } } if (loading) { return (
Loading performance metrics...
) } if (!metrics) { return null } return (

Total TVL

{parseFloat(metrics.totalTVL || '0').toLocaleString()}

24h Volume

{parseFloat(metrics.totalVolume24h || '0').toLocaleString()}

24h Fees

{parseFloat(metrics.totalFees24h || '0').toLocaleString()}

Active Pools

{metrics.activePools || 0}

Active Users

{metrics.activeUsers || 0}

24h Transactions

{metrics.transactionCount24h || 0}

) }