"use client"; import { useQuery } from "@tanstack/react-query"; import { useApp } from "@/contexts/AppContext"; import { fetchProducts, fetchProductDetail } from "@/lib/api/fundmarket"; interface RepayPoolStatsProps { tokenType: string; } export default function RepayPoolStats({ tokenType }: RepayPoolStatsProps) { const { t } = useApp(); const { data: products = [] } = useQuery({ queryKey: ['token-list'], queryFn: () => fetchProducts(true), staleTime: 5 * 60 * 1000, }); const product = products.find(p => p.tokenSymbol === tokenType); const { data: detail } = useQuery({ queryKey: ['product-detail', product?.id], queryFn: () => fetchProductDetail(product!.id), enabled: !!product?.id, staleTime: 5 * 60 * 1000, }); const tvlDisplay = detail?.tvlUsd != null ? `$${detail.tvlUsd.toLocaleString('en-US', { maximumFractionDigits: 0 })}` : '--'; return (