All files / publisher-admin index.tsx

0% Statements 0/6
100% Branches 0/0
100% Functions 0/0
0% Lines 0/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95                                                                                                                                                                                             
import React from "react";
import { Provider as JotaiProvider } from "jotai";
import { createRoot } from "react-dom/client";
import {
  createBrowserRouter,
  createRoutesFromChildren,
  matchRoutes,
  RouterProvider,
  useLocation,
  useNavigationType,
} from "react-router-dom";
import { QueryClient, QueryClientProvider } from "react-query";
import * as Sentry from "@sentry/react";
 
import Root from "./routes/root";
import NotFound from "./pages/NotFound";
import Publicise from "./pages/Publicise";
import Settings from "./pages/Settings";
import Listing from "./pages/Listing";
import Collaboration from "./pages/Collaboration";
import Releases from "./pages/Releases";
 
Sentry.init({
  dsn: window.SENTRY_DSN,
  integrations: [
    Sentry.reactRouterV6BrowserTracingIntegration({
      useEffect: React.useEffect,
      useLocation,
      useNavigationType,
      createRoutesFromChildren,
      matchRoutes,
    }),
    Sentry.replayIntegration(),
  ],
  tracesSampleRate: 1.0,
  tracePropagationTargets: ["localhost", /^https:\/\/charmhub\.io/],
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 1.0,
});
 
const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      refetchOnWindowFocus: false,
      refetchOnReconnect: false,
    },
  },
});
 
const router = createBrowserRouter([
  {
    path: "/:packageName",
    element: <Root />,
    errorElement: <NotFound />,
    children: [
      {
        path: "/:packageName/publicise",
        element: <Publicise />,
        children: [
          {
            path: "/:packageName/publicise/cards",
            element: <Publicise />,
          },
        ],
      },
      {
        path: "/:packageName/settings",
        element: <Settings />,
      },
      {
        path: "/:packageName/releases",
        element: <Releases />,
      },
      {
        path: "/:packageName/listing",
        element: <Listing />,
      },
      {
        path: "/:packageName/collaboration",
        element: <Collaboration />,
      },
    ],
  },
]);
 
const container = document.getElementById("root");
const root = createRoot(container!);
root.render(
  <JotaiProvider>
    <QueryClientProvider client={queryClient}>
      <RouterProvider router={router} />
    </QueryClientProvider>
  </JotaiProvider>
);