import React from 'react'; import ReactDOM from 'react-dom/client'; import { createBrowserRouter, RouterProvider, Outlet, Navigate } from 'react-router-dom'; import RootApp from '@/App'; import AdminPage from '@/pages/AdminPage'; import LoginPage from '@/pages/LoginPage'; import ManageProfilePage from '@/pages/ManageProfilePage'; import AuthCallbackPage from '@/pages/AuthCallbackPage'; import { AuthProvider, useAuth } from '@/contexts/AuthContext'; import { DataProvider, useData as useDataContextData } from '@/contexts/DataContext'; // Import useData directly import '@/index.css'; // Toaster is rendered within RootApp, so no need to import here unless specifically needed outside // import { Toaster } from '@/components/ui/toaster'; import { SearchSection } from '@/components/SearchSection'; import { useState as ReactUseState, useEffect as ReactUseEffect } from 'react'; import { Loader2 } from 'lucide-react'; function HomePageContent() { const { barbershops, barbers, loadingData } = useDataContextData(); const [currentUserPosition, setCurrentUserPosition] = ReactUseState(null); ReactUseEffect(() => { if (navigator.geolocation) { navigator.geolocation.getCurrentPosition( (position) => { setCurrentUserPosition({ latitude: position.coords.latitude, longitude: position.coords.longitude, }); }, (error) => { console.error("Error getting user location:", error); } ); } }, []); if (loadingData && (barbershops.length === 0 && barbers.length === 0) ) { return (
Carregando barbearias e barbeiros...
Ainda não há barbearias ou barbeiros cadastrados. Seja o primeiro!
Aguarde um momento.