import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { BrowserRouter, Routes } from "react-router";
import { Route } from "react-router";
import { HomePage } from "./pages/home";
import { PodcastPage } from "./pages/podcast";
import { PlayerProvider } from "./player/provider";
import { Player } from "./player/player";

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      retry: false,
    },
  },
});

createRoot(document.getElementById("root")!).render(
  <StrictMode>
    <QueryClientProvider client={queryClient}>
      <PlayerProvider>
        <div className="max-w-[1440px] w-full mx-auto p-2 relative">
          <BrowserRouter>
            <Routes>
              <Route path="/" element={<HomePage />} />
              <Route path="/podcasts/:id" element={<PodcastPage />} />
            </Routes>
          </BrowserRouter>
        </div>
        <Player />
      </PlayerProvider>
    </QueryClientProvider>
  </StrictMode>,
);
