import { useState, useEffect } from "react"
import { BrowserRouter as Router, Route, Routes } from "react-router-dom"
import AuthRegister from "./pages/Auth/AuthRegister"
import AuthLogin from "./pages/Auth/AuthLogin"
import EmailVerification from "./pages/Auth/EmailVerification"
import Test from "./pages/Testing/Test"
import ForgotPassword from "./pages/Auth/ForgotPassword"
import ResetPassword from "./pages/Auth/ResetPassword"
import Landingpage from "./pages/Landing/Landingpage"
import Home from "./pages/Landing/Home"
import DeckManagerPage from "./pages/Decks/DeckManagerPage"
import DeckCreator from "./pages/DeckCreator/DeckCreator"
import CompanyHub from "./pages/Companies/Companies"
import About from "./pages/About/About"
import ScrollToTop from "./components/ScrollToTop"
import GameScreen from "./pages/Game/GameScreen"
import Reports from "./pages/Report/Reports"

function App() {
  const [isMobile, setIsMobile] = useState(false)

  useEffect(() => {
    const handleResize = () => {
      setIsMobile(window.innerWidth <= 1280)
    }

    handleResize()
    window.addEventListener("resize", handleResize)

    return () => window.removeEventListener("resize", handleResize)
  }, [])

  // if (isMobile) {
  //   return (
  //     <Router>
  //       <Routes>
  //         <Route path="/register" element={<AuthRegister />} />
  //         <Route path="/login" element={<AuthLogin />} />
  //         <Route path="/verify-email" element={<EmailVerification />} />
  //       </Routes>
  //     </Router>
  //   );
  // }

  return (
    <Router>
      <Routes>
        <Route path="/about" element={<About />} />
        <Route path="/register" element={<AuthRegister />} />
        <Route path="/login" element={<AuthLogin />} />
        <Route path="/verify-email" element={<EmailVerification />} />
        <Route path="/forgot-password" element={<ForgotPassword />} />
        <Route path="/reset-password" element={<ResetPassword />} />
        <Route path="/test" element={<Test />} />
        <Route path="/" element={<Landingpage />} />
        <Route path="/home" element={<Home />} />
        <Route path="/decks" element={<DeckManagerPage />} />
        <Route path="/deck-creator" element={<DeckCreator />} />
        <Route path="/deck-creator/:deckId" element={<DeckCreator />} />
        <Route path="/game" element={<GameScreen />} />
        <Route path="/companies" element={<CompanyHub />} />
        <Route path="/report" element={<Reports />} />

        {/* Add more routes as needed */}
      </Routes>
    </Router>
  )
}

export default App
