import React, { useState, useEffect } from 'react'; import App from './App.tsx'; import AdminApp from './AdminApp.tsx'; import { Globe, Shield, RefreshCw } from 'lucide-react'; export default function Root() { const [simulatedDomain, setSimulatedDomain] = useState<'student' | 'admin'>(() => { // 1. Check hostname if (window.location.hostname.includes('admin')) { return 'admin'; } // 2. Check path if (window.location.pathname.startsWith('/admin')) { return 'admin'; } // 3. Fallback to localStorage const saved = localStorage.getItem('microtecflix_simulated_domain'); return saved === 'admin' ? 'admin' : 'student'; }); const handleToggleDomain = (domain: 'student' | 'admin') => { localStorage.setItem('microtecflix_simulated_domain', domain); setSimulatedDomain(domain); // Reload to clear state and re-route properly window.location.reload(); }; const isAdmin = simulatedDomain === 'admin'; return (