Skip to content
index.tsx 1.14 KiB
Newer Older
Grant's avatar
Grant committed
import React from "react";
import { createRoot } from "react-dom/client";
Grant's avatar
Grant committed
import { NextUIProvider } from "@nextui-org/react";
Ategon Dev's avatar
Ategon Dev committed
import { ThemeProvider } from 'next-themes'
Grant's avatar
Grant committed
import App from "./components/App";

Grant's avatar
Grant committed
import Bugsnag from "@bugsnag/js";
import BugsnagPluginReact from "@bugsnag/plugin-react";
import BugsnagPerformance from "@bugsnag/browser-performance";

Grant's avatar
Grant committed
let ErrorBoundary: any = ({ children }: React.PropsWithChildren) => (
  <>{children}</>
);
Grant's avatar
Grant committed

if (import.meta.env.VITE_BUGSNAG_KEY) {
  Bugsnag.start({
    apiKey: import.meta.env.VITE_BUGSNAG_KEY,
    plugins: [new BugsnagPluginReact()],
  });
  BugsnagPerformance.start({ apiKey: import.meta.env.VITE_BUGSNAG_KEY });

  ErrorBoundary = Bugsnag.getPlugin("react")!.createErrorBoundary(React);
}

Grant's avatar
Grant committed
const root = createRoot(document.getElementById("root")!);
Grant's avatar
Grant committed
root.render(
  <React.StrictMode>
Grant's avatar
Grant committed
    <ErrorBoundary>
      <NextUIProvider>
Ategon Dev's avatar
Ategon Dev committed
        <ThemeProvider attribute="class" defaultTheme="system">
          <div className="w-screen h-screen bg-[#ddd] dark:bg-[#060606]">
            <App />
          </div>
        </ThemeProvider>
Grant's avatar
Grant committed
      </NextUIProvider>
    </ErrorBoundary>
Grant's avatar
Grant committed
  </React.StrictMode>
);