diff --git a/frontend/src/components/layout/WalletGate.tsx b/frontend/src/components/layout/WalletGate.tsx
index 38dd091c..c9749f5c 100644
--- a/frontend/src/components/layout/WalletGate.tsx
+++ b/frontend/src/components/layout/WalletGate.tsx
@@ -1,13 +1,26 @@
'use client';
-import { useWallet } from '@/contexts/WalletContext';
-import { AlertCircle, Wallet } from 'lucide-react';
+import { useWallet, StellarNetwork } from '@/contexts/WalletContext';
+import { AlertCircle, CheckCircle2, Download, ExternalLink, Globe, RefreshCw, ShieldAlert, Wallet } from 'lucide-react';
import { motion } from 'framer-motion';
import { useEffect, useState } from 'react';
import { usePathname } from 'next/navigation';
export default function WalletGate({ children }: { children: React.ReactNode }) {
- const { isConnected, connect, isConnecting, availableWallets, activeWallet } = useWallet();
+ const {
+ isConnected,
+ connect,
+ isConnecting,
+ availableWallets,
+ activeWallet,
+ activeNetwork,
+ walletNetwork,
+ isNetworkDivergent,
+ blockHeight,
+ switchNetwork,
+ setAppNetwork,
+ } = useWallet();
+
const pathname = usePathname();
const [isMounted, setIsMounted] = useState(false);
@@ -15,10 +28,6 @@ export default function WalletGate({ children }: { children: React.ReactNode })
setIsMounted(true);
}, []);
- // Public routes (landing, offline recovery, auth) must always render — on the
- // server AND the client — so they never depend on mount state or localStorage.
- // Gated routes stay blocked until mounted to avoid a hydration flicker / a
- // leaked localStorage wallet bypassing the gate before React hydrates.
const isPublicRoute =
pathname === '/' || pathname === '/offline' || pathname?.startsWith('/auth/');
@@ -33,57 +42,145 @@ export default function WalletGate({ children }: { children: React.ReactNode })
const hasLocalWallet = typeof window !== 'undefined' && !!localStorage.getItem('stellar_wallet');
if (isConnected || hasLocalWallet) {
- return <>{children}>;
+ return (
+
+ {isNetworkDivergent && (
+
+
+
+
+ Network Mismatch Detected: Application target is{' '}
+ {activeNetwork} but connected wallet is on{' '}
+ {walletNetwork}.
+
+
+
+
+
+
+
+ )}
+
{children}
+
+ );
}
return (
-
-
-
-
+
+
+
+
+
+
+
+ Connect Web3 Wallet
+
+
+ Select your preferred Stellar ecosystem wallet to log in.
+
+
+
+
+
+
+
+ {activeNetwork}
+
+ {blockHeight && (
+
+ Block #{blockHeight.toLocaleString()}
+
+ )}
-
-
- Authentication Required
-
-
- You must connect your Web3 wallet to access the Web3 Student Lab platform.
-
-
- {availableWallets.map((wallet) => (
-