Skip to content

Commit

Permalink
chore: fix react-router typing
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge committed Oct 3, 2024
1 parent b7ed9c3 commit c1900a1
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 102 deletions.
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"react-dom": "^18.3.1",
"react-helmet": "^6.1.0",
"react-hook-form": "^7.53.0",
"react-router-dom": "^6.26.1",
"react-router-dom": "^6.26.2",
"tailwindcss": "^3.4.10",
"tailwindcss-animate": "^1.0.7",
"use-clipboard-copy": "^0.2.0",
Expand Down
201 changes: 101 additions & 100 deletions apps/frontend/src/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import { RouterProvider } from "react-aria-components";
import {
createBrowserRouter,
Navigate,
NavigateOptions,
Outlet,
useHref,
useNavigate,
type NavigateOptions,
} from "react-router-dom";

import { Layout } from "@/containers/Layout";
Expand Down Expand Up @@ -40,102 +40,103 @@ function Root() {
);
}

export const router = createBrowserRouter([
{
path: `/auth/:provider/callback`,
lazy: () => import("./pages/AuthCallback"),
},
{
path: "/",
element: <Root />,
children: [
{
path: "/:accountSlug/:projectName/builds/:buildNumber",
lazy: () => import("./pages/Build"),
},
{
path: "/:accountSlug/:projectName/builds/:buildNumber/:diffId",
lazy: () => import("./pages/Build"),
},
{
path: "/",
lazy: () => import("./pages/Home"),
},
{
path: "/",
element: (
<Layout>
<Outlet />
</Layout>
),
children: [
{
path: "new",
lazy: () => import("./pages/NewProject"),
},
{
path: "login",
lazy: () => import("./pages/Login"),
},
{
path: "signup",
lazy: () => import("./pages/Signup"),
},
{
path: "invite/:inviteToken",
lazy: () => import("./pages/Invite"),
},
{
path: "teams/new",
lazy: () => import("./pages/NewTeam"),
},
{
path: ":accountSlug/:projectName",
lazy: () => import("./pages/Project"),
children: [
{
index: true,
lazy: () => import("./pages/Project/Builds"),
},
{
path: "reference",
lazy: () => import("./pages/Project/Reference"),
},
{
path: "builds",
element: <Navigate to=".." replace={true} />,
},
{
path: "settings",
lazy: () => import("./pages/Project/Settings"),
},
],
},
{
id: "account",
path: ":accountSlug",
lazy: () => import("./pages/Account"),
children: [
{
index: true,
lazy: () => import("./pages/Account/Projects"),
},
{
path: "new",
lazy: () => import("./pages/Account/NewProject"),
},
{
path: "settings",
lazy: () => import("./pages/Account/Settings"),
},
],
},
{
path: "*",
element: <NotFound />,
},
],
},
],
},
]);
export const router: ReturnType<typeof createBrowserRouter> =
createBrowserRouter([
{
path: `/auth/:provider/callback`,
lazy: () => import("./pages/AuthCallback"),
},
{
path: "/",
element: <Root />,
children: [
{
path: "/:accountSlug/:projectName/builds/:buildNumber",
lazy: () => import("./pages/Build"),
},
{
path: "/:accountSlug/:projectName/builds/:buildNumber/:diffId",
lazy: () => import("./pages/Build"),
},
{
path: "/",
lazy: () => import("./pages/Home"),
},
{
path: "/",
element: (
<Layout>
<Outlet />
</Layout>
),
children: [
{
path: "new",
lazy: () => import("./pages/NewProject"),
},
{
path: "login",
lazy: () => import("./pages/Login"),
},
{
path: "signup",
lazy: () => import("./pages/Signup"),
},
{
path: "invite/:inviteToken",
lazy: () => import("./pages/Invite"),
},
{
path: "teams/new",
lazy: () => import("./pages/NewTeam"),
},
{
path: ":accountSlug/:projectName",
lazy: () => import("./pages/Project"),
children: [
{
index: true,
lazy: () => import("./pages/Project/Builds"),
},
{
path: "reference",
lazy: () => import("./pages/Project/Reference"),
},
{
path: "builds",
element: <Navigate to=".." replace={true} />,
},
{
path: "settings",
lazy: () => import("./pages/Project/Settings"),
},
],
},
{
id: "account",
path: ":accountSlug",
lazy: () => import("./pages/Account"),
children: [
{
index: true,
lazy: () => import("./pages/Account/Projects"),
},
{
path: "new",
lazy: () => import("./pages/Account/NewProject"),
},
{
path: "settings",
lazy: () => import("./pages/Account/Settings"),
},
],
},
{
path: "*",
element: <NotFound />,
},
],
},
],
},
]);
2 changes: 1 addition & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c1900a1

Please sign in to comment.