import { render } from "preact";
import { LocationProvider, Router, Route } from "preact-iso";
import { Header } from "./components/header/Header";
import { Footer } from "./components/footer/Footer";
import { Home } from "./pages/Home/index.jsx";
import { ProductDetail } from "./pages/product/ProductDetail";
import { Buildpc } from "./pages/buildpc/Buildpc";
import { CompareBuildpc } from "./pages/buildpc/CompareBuildpc";
import { DetailBuildpc } from "./pages/buildpc/DetailBuildpc";
import { NotFound } from "./pages/_404.jsx";

export function App() {
  return (
    <LocationProvider>
      <main>
        <Header />
        <Router>
          <Route path="/" component={Home} />
          <Route path="/product-detail" component={ProductDetail} />
          <Route path="/buildpc" component={Buildpc} />
          <Route path="/buildpc/compare" component={CompareBuildpc} />
          <Route path="/buildpc/detail" component={DetailBuildpc} />
          <Route default component={NotFound} />
        </Router>
        <Footer />
      </main>
    </LocationProvider>
  );
}

render(<App />, document.getElementById("root"));
