'use client'; import { useWalletConnection } from '@/hooks/useWalletConnection'; import { getCurrentNetwork } from '@/lib/celo'; import { useState } from 'react'; import { LoadingSpinner } from '../ui/LoadingSpinner'; interface NetworkSwitchModalProps { isOpen: boolean; onClose: () => void; } export function NetworkSwitchModal({ isOpen, onClose }: NetworkSwitchModalProps) { const { switchNetwork } = useWalletConnection(); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); if (!isOpen) return null; const network = getCurrentNetwork(); const handleSwitch = async () => { setIsLoading(true); setError(null); try { await switchNetwork(); onClose(); } catch (err: any) { setError(err.message); } finally { setIsLoading(false); } }; return (

Wrong Network

Please switch to {network.name} to continue.

{error && (

{error}

)}
); }