import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import BackgroundCanvas from './components/BackgroundCanvas/BackgroundCanvas';

import { StyledEngineProvider } from "@mui/material/styles";
import { HashRouter } from "react-router-dom";
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { WagmiProvider  } from "wagmi";
import { config } from "./config";
import ReactGA from "react-ga4";

const queryClient = new QueryClient();
const TRACKING_ID = import.meta.env.VITE_APP_TRACKING_ID;
ReactGA.initialize(TRACKING_ID);

ReactDOM.createRoot(document.getElementById('root')).render(
    <>
        <BackgroundCanvas />
        <WagmiProvider config={config}>
            <QueryClientProvider client={queryClient}>
                <HashRouter>
                    <StyledEngineProvider injectFirst>
                        <App />
                    </StyledEngineProvider>
                </HashRouter>
            </QueryClientProvider>
        </WagmiProvider>
    </>
)
