diff --git a/apps/web/src/main.tsx b/apps/web/src/main.tsx index f68f0c9..1e1e0b9 100644 --- a/apps/web/src/main.tsx +++ b/apps/web/src/main.tsx @@ -1,10 +1,10 @@ import queryClient from "@/query-client"; -import router from "@/router"; import { QueryClientProvider } from "@tanstack/react-query"; import { RouterProvider } from "@tanstack/react-router"; import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import "@/index.css"; +import router from "@/routes"; import { ThemeProvider } from "./components/providers/theme-provider"; const rootElement = document.getElementById("root") as HTMLElement; diff --git a/apps/web/src/pages/auth/index.tsx b/apps/web/src/pages/auth/index.tsx deleted file mode 100644 index de599bc..0000000 --- a/apps/web/src/pages/auth/index.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { Logo } from "@/components/common/logo"; -import { rootRoute } from "@/pages/__root"; -import { Outlet, createRoute } from "@tanstack/react-router"; -import { motion } from "framer-motion"; - -export const authIndexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: "/auth", - component: AuthIndexRouteComponent, -}); - -function AuthIndexRouteComponent() { - return ( -
- -
- -

- Welcome back -

-

- Enter your credentials to access your workspace -

-
- -
- -
-
-
- ); -} diff --git a/apps/web/src/pages/auth/sign-in.tsx b/apps/web/src/pages/auth/sign-in.tsx index ca13e79..32299d6 100644 --- a/apps/web/src/pages/auth/sign-in.tsx +++ b/apps/web/src/pages/auth/sign-in.tsx @@ -1,8 +1,8 @@ +import { rootRoute } from "@/routes"; import { createRoute } from "@tanstack/react-router"; import { AuthLayout } from "../../components/auth/layout"; import { SignInForm } from "../../components/auth/sign-in-form"; import { AuthToggle } from "../../components/auth/toggle"; -import { rootRoute } from "../__root"; export const signInRoute = createRoute({ getParentRoute: () => rootRoute, diff --git a/apps/web/src/pages/auth/sign-up.tsx b/apps/web/src/pages/auth/sign-up.tsx index 17d1d6e..d0f6107 100644 --- a/apps/web/src/pages/auth/sign-up.tsx +++ b/apps/web/src/pages/auth/sign-up.tsx @@ -1,7 +1,7 @@ import { AuthLayout } from "@/components/auth/layout"; import { SignUpForm } from "@/components/auth/sign-up-form"; import { AuthToggle } from "@/components/auth/toggle"; -import { rootRoute } from "@/pages/__root"; +import { rootRoute } from "@/routes"; import { createRoute } from "@tanstack/react-router"; export const signUpRoute = createRoute({ diff --git a/apps/web/src/pages/index.tsx b/apps/web/src/pages/index.tsx index 605fa89..c773798 100644 --- a/apps/web/src/pages/index.tsx +++ b/apps/web/src/pages/index.tsx @@ -1,7 +1,7 @@ import queryClient from "@/query-client"; +import { rootRoute } from "@/routes"; import { api } from "@kaneo/libs"; import { Outlet, createRoute, redirect } from "@tanstack/react-router"; -import { rootRoute } from "./__root"; export const indexRoute = createRoute({ getParentRoute: () => rootRoute, diff --git a/apps/web/src/routeTree.gen.ts b/apps/web/src/routeTree.gen.ts new file mode 100644 index 0000000..d94a3ad --- /dev/null +++ b/apps/web/src/routeTree.gen.ts @@ -0,0 +1,88 @@ +/* eslint-disable */ + +// @ts-nocheck + +// noinspection JSUnusedGlobalSymbols + +// This file was automatically generated by TanStack Router. +// You should NOT make any changes in this file as it will be overwritten. +// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. + +// Import Routes + +import { Route as rootRoute } from './routes/__root' +import { Route as IndexImport } from './routes/index' + +// Create/Update Routes + +const IndexRoute = IndexImport.update({ + id: '/', + path: '/', + getParentRoute: () => rootRoute, +} as any) + +// Populate the FileRoutesByPath interface + +declare module '@tanstack/react-router' { + interface FileRoutesByPath { + '/': { + id: '/' + path: '/' + fullPath: '/' + preLoaderRoute: typeof IndexImport + parentRoute: typeof rootRoute + } + } +} + +// Create and export the route tree + +export interface FileRoutesByFullPath { + '/': typeof IndexRoute +} + +export interface FileRoutesByTo { + '/': typeof IndexRoute +} + +export interface FileRoutesById { + __root__: typeof rootRoute + '/': typeof IndexRoute +} + +export interface FileRouteTypes { + fileRoutesByFullPath: FileRoutesByFullPath + fullPaths: '/' + fileRoutesByTo: FileRoutesByTo + to: '/' + id: '__root__' | '/' + fileRoutesById: FileRoutesById +} + +export interface RootRouteChildren { + IndexRoute: typeof IndexRoute +} + +const rootRouteChildren: RootRouteChildren = { + IndexRoute: IndexRoute, +} + +export const routeTree = rootRoute + ._addFileChildren(rootRouteChildren) + ._addFileTypes() + +/* ROUTE_MANIFEST_START +{ + "routes": { + "__root__": { + "filePath": "__root.tsx", + "children": [ + "/" + ] + }, + "/": { + "filePath": "index.ts" + } + } +} +ROUTE_MANIFEST_END */ diff --git a/apps/web/src/pages/__root.tsx b/apps/web/src/routes/__root.tsx similarity index 94% rename from apps/web/src/pages/__root.tsx rename to apps/web/src/routes/__root.tsx index a813dc0..8ec539a 100644 --- a/apps/web/src/pages/__root.tsx +++ b/apps/web/src/routes/__root.tsx @@ -18,3 +18,5 @@ function RootComponent() { ); } + +export default RootComponent; diff --git a/apps/web/src/router/index.ts b/apps/web/src/routes/index.ts similarity index 59% rename from apps/web/src/router/index.ts rename to apps/web/src/routes/index.ts index 5959a75..fe6f9fc 100644 --- a/apps/web/src/router/index.ts +++ b/apps/web/src/routes/index.ts @@ -1,17 +1,23 @@ import { indexRoute } from "@/pages"; -import { rootRoute } from "@/pages/__root"; -import { authIndexRoute } from "@/pages/auth"; import { signInRoute } from "@/pages/auth/sign-in"; import { signUpRoute } from "@/pages/auth/sign-up"; import { dashboardIndexRoute } from "@/pages/dashboard"; import queryClient from "@/query-client"; -import { createRouter } from "@tanstack/react-router"; +import type { QueryClient } from "@tanstack/react-query"; +import { + createRootRouteWithContext, + createRouter, +} from "@tanstack/react-router"; +import RootComponent from "./__root"; + +export const rootRoute = createRootRouteWithContext<{ + queryClient: QueryClient; +}>()({ + component: RootComponent, +}); const routeTree = rootRoute.addChildren([ - indexRoute.addChildren([ - authIndexRoute.addChildren([signInRoute, signUpRoute]), - dashboardIndexRoute, - ]), + indexRoute.addChildren([signInRoute, signUpRoute, dashboardIndexRoute]), ]); const router = createRouter({ diff --git a/biome.json b/biome.json index 2844ec7..3907a50 100644 --- a/biome.json +++ b/biome.json @@ -7,7 +7,7 @@ }, "files": { "ignoreUnknown": false, - "ignore": ["**/tsconfig*.json"] + "ignore": ["**/tsconfig*.json", "routeTree.gen.ts"] }, "formatter": { "enabled": true,