'use client';
import { useMemo, useState } from 'react';
import { Footer, TopPools, PoolsTable, Filters, Stats } from '@/components';
import { usePools, useStats } from '@/hooks/usePools';
import { Shield, TrendingUp, Clock, CheckCircle, RefreshCw, Menu, X, Globe } from 'lucide-react';
import { useI18n, I18nProvider, locales, localeFlags, localeNames, Locale } from '@/utils/i18n';
// ============================================
// LOGO YIIELD
// ============================================
function YiieldLogo() {
return (
);
}
// ============================================
// SÉLECTEUR DE LANGUE
// ============================================
function LanguageSelector() {
const [isOpen, setIsOpen] = useState(false);
const { locale, setLocale } = useI18n();
return (
{isOpen && (
<>
setIsOpen(false)} />
{locales.map(lang => (
))}
>
)}
);
}
// ============================================
// HEADER
// ============================================
function Header({ lastUpdated, onRefresh, isLoading }: { lastUpdated: Date | null; onRefresh: () => void; isLoading: boolean }) {
const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);
const { t } = useI18n();
return (
{isMobileMenuOpen && (
)}
);
}
// ============================================
// CONTENU PRINCIPAL
// ============================================
function HomeContent() {
const { pools, topPools, filteredPools, isLoading, error, lastUpdated, filters, setFilters, refresh } = usePools();
const stats = useStats(filteredPools);
const { locale, t } = useI18n();
const availableChains = useMemo(() => [...new Set(pools.map(p => p.chain))], [pools]);
return (
{/* Hero Section */}
{t('hero.title1')} {t('hero.title2')}
{t('hero.title3')} {t('hero.title4')}
{t('hero.subtitle')}
{t('nav.security')}
APY
{t('common.realtime')}
{t('common.audited')}
{/* Main content */}
{error && (
)}
{/* Security Section */}
{t('security.title')}
{t('security.subtitle')}
25pts
{t('security.auditsTitle')}
{t('security.auditsDesc')}
25pts
{t('security.ageTitle')}
{t('security.ageDesc')}
25pts
{t('security.tvlTitle')}
{t('security.tvlDesc')}
25pts
{t('security.historyTitle')}
{t('security.historyDesc')}
{t('security.recommendation')}
{t('security.recommendationText')}
);
}
// ============================================
// PAGE PRINCIPALE
// ============================================
export default function HomePage() {
return (
);
}