import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom"
import AdminRoutes from "./admin/AdminRoutes"
import Navbar from "./components/Navbar"
import CreateAccount from "./admin/pages/CreateAccount"

function AppContent() {
  const location = useLocation()
  const mockRole = "admin"

  const isAdminRoute = location.pathname.startsWith("/admin")

  return (
    <>
      {!isAdminRoute && <Navbar role={mockRole} />}

      <Routes>
        <Route path="/admin/*" element={<AdminRoutes />} />
        <Route path="/create-account" element={<CreateAccount />} />
      </Routes>
    </>
  )
}

export default function App() {
  return (
    <BrowserRouter>
      <AppContent />
    </BrowserRouter>
  )
}
