-
+
{title}
-
+
{date}
diff --git a/src/client/components/three/ThreeLoader.tsx b/src/client/components/three/ThreeLoader.tsx
index 0e8e497..0f1c4dc 100644
--- a/src/client/components/three/ThreeLoader.tsx
+++ b/src/client/components/three/ThreeLoader.tsx
@@ -22,8 +22,14 @@ export function ThreeLoader({ minDuration = 1000 }: { minDuration?: number }) {
hidden ? "opacity-0" : "opacity-100",
)}
>
-
diff --git a/src/core/types/index.ts b/src/core/types/index.ts
index 45281fe..bb839ce 100644
--- a/src/core/types/index.ts
+++ b/src/core/types/index.ts
@@ -1,6 +1,8 @@
export type Success
= { data: T; error: null };
+
export type Failure = {
data: null;
error: E;
};
+
export type Result = Success | Failure;
diff --git a/src/logo.svg b/src/logo.svg
deleted file mode 100644
index fe53fe8..0000000
--- a/src/logo.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/routing/router.tsx b/src/router/index.tsx
similarity index 95%
rename from src/routing/router.tsx
rename to src/router/index.tsx
index ae43cbf..3199673 100644
--- a/src/routing/router.tsx
+++ b/src/router/index.tsx
@@ -2,9 +2,8 @@ import { QueryClient } from "@tanstack/react-query";
import { createRouter, Link } from "@tanstack/react-router";
import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";
import { Button } from "@/client/components/ui/button";
+import { routeTree } from "@/router/routeTree.gen";
import type { BetterAuthSession } from "@/server/auth";
-// Import the generated route tree
-import { routeTree } from "./routeTree.gen";
export interface RouterContext {
queryClient: QueryClient;
diff --git a/src/routing/routeTree.gen.ts b/src/router/routeTree.gen.ts
similarity index 56%
rename from src/routing/routeTree.gen.ts
rename to src/router/routeTree.gen.ts
index c0eb550..afb81d1 100644
--- a/src/routing/routeTree.gen.ts
+++ b/src/router/routeTree.gen.ts
@@ -9,13 +9,18 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
+import { Route as AppRouteRouteImport } from './routes/_app/route'
import { Route as IndexRouteImport } from './routes/index'
import { Route as ApiTodosRouteImport } from './routes/api/todos'
-import { Route as appLoginRouteImport } from './routes/(app)/login'
-import { Route as appAuthedRouteRouteImport } from './routes/(app)/_authed/route'
+import { Route as AppLoginRouteImport } from './routes/_app/login'
+import { Route as AppProtectedRouteRouteImport } from './routes/_app/_protected/route'
import { Route as ApiAuthSplatRouteImport } from './routes/api/auth.$'
-import { Route as appAuthedTodosRouteImport } from './routes/(app)/_authed/todos'
+import { Route as AppProtectedTodosRouteImport } from './routes/_app/_protected/todos'
+const AppRouteRoute = AppRouteRouteImport.update({
+ id: '/_app',
+ getParentRoute: () => rootRouteImport,
+} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
@@ -26,47 +31,48 @@ const ApiTodosRoute = ApiTodosRouteImport.update({
path: '/api/todos',
getParentRoute: () => rootRouteImport,
} as any)
-const appLoginRoute = appLoginRouteImport.update({
- id: '/(app)/login',
+const AppLoginRoute = AppLoginRouteImport.update({
+ id: '/login',
path: '/login',
- getParentRoute: () => rootRouteImport,
+ getParentRoute: () => AppRouteRoute,
} as any)
-const appAuthedRouteRoute = appAuthedRouteRouteImport.update({
- id: '/(app)/_authed',
- getParentRoute: () => rootRouteImport,
+const AppProtectedRouteRoute = AppProtectedRouteRouteImport.update({
+ id: '/_protected',
+ getParentRoute: () => AppRouteRoute,
} as any)
const ApiAuthSplatRoute = ApiAuthSplatRouteImport.update({
id: '/api/auth/$',
path: '/api/auth/$',
getParentRoute: () => rootRouteImport,
} as any)
-const appAuthedTodosRoute = appAuthedTodosRouteImport.update({
+const AppProtectedTodosRoute = AppProtectedTodosRouteImport.update({
id: '/todos',
path: '/todos',
- getParentRoute: () => appAuthedRouteRoute,
+ getParentRoute: () => AppProtectedRouteRoute,
} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
- '/login': typeof appLoginRoute
+ '/login': typeof AppLoginRoute
'/api/todos': typeof ApiTodosRoute
- '/todos': typeof appAuthedTodosRoute
+ '/todos': typeof AppProtectedTodosRoute
'/api/auth/$': typeof ApiAuthSplatRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
- '/login': typeof appLoginRoute
+ '/login': typeof AppLoginRoute
'/api/todos': typeof ApiTodosRoute
- '/todos': typeof appAuthedTodosRoute
+ '/todos': typeof AppProtectedTodosRoute
'/api/auth/$': typeof ApiAuthSplatRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
- '/(app)/_authed': typeof appAuthedRouteRouteWithChildren
- '/(app)/login': typeof appLoginRoute
+ '/_app': typeof AppRouteRouteWithChildren
+ '/_app/_protected': typeof AppProtectedRouteRouteWithChildren
+ '/_app/login': typeof AppLoginRoute
'/api/todos': typeof ApiTodosRoute
- '/(app)/_authed/todos': typeof appAuthedTodosRoute
+ '/_app/_protected/todos': typeof AppProtectedTodosRoute
'/api/auth/$': typeof ApiAuthSplatRoute
}
export interface FileRouteTypes {
@@ -77,23 +83,30 @@ export interface FileRouteTypes {
id:
| '__root__'
| '/'
- | '/(app)/_authed'
- | '/(app)/login'
+ | '/_app'
+ | '/_app/_protected'
+ | '/_app/login'
| '/api/todos'
- | '/(app)/_authed/todos'
+ | '/_app/_protected/todos'
| '/api/auth/$'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
- appAuthedRouteRoute: typeof appAuthedRouteRouteWithChildren
- appLoginRoute: typeof appLoginRoute
+ AppRouteRoute: typeof AppRouteRouteWithChildren
ApiTodosRoute: typeof ApiTodosRoute
ApiAuthSplatRoute: typeof ApiAuthSplatRoute
}
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
+ '/_app': {
+ id: '/_app'
+ path: ''
+ fullPath: ''
+ preLoaderRoute: typeof AppRouteRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/': {
id: '/'
path: '/'
@@ -108,19 +121,19 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiTodosRouteImport
parentRoute: typeof rootRouteImport
}
- '/(app)/login': {
- id: '/(app)/login'
+ '/_app/login': {
+ id: '/_app/login'
path: '/login'
fullPath: '/login'
- preLoaderRoute: typeof appLoginRouteImport
- parentRoute: typeof rootRouteImport
+ preLoaderRoute: typeof AppLoginRouteImport
+ parentRoute: typeof AppRouteRoute
}
- '/(app)/_authed': {
- id: '/(app)/_authed'
+ '/_app/_protected': {
+ id: '/_app/_protected'
path: ''
fullPath: ''
- preLoaderRoute: typeof appAuthedRouteRouteImport
- parentRoute: typeof rootRouteImport
+ preLoaderRoute: typeof AppProtectedRouteRouteImport
+ parentRoute: typeof AppRouteRoute
}
'/api/auth/$': {
id: '/api/auth/$'
@@ -129,32 +142,44 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ApiAuthSplatRouteImport
parentRoute: typeof rootRouteImport
}
- '/(app)/_authed/todos': {
- id: '/(app)/_authed/todos'
+ '/_app/_protected/todos': {
+ id: '/_app/_protected/todos'
path: '/todos'
fullPath: '/todos'
- preLoaderRoute: typeof appAuthedTodosRouteImport
- parentRoute: typeof appAuthedRouteRoute
+ preLoaderRoute: typeof AppProtectedTodosRouteImport
+ parentRoute: typeof AppProtectedRouteRoute
}
}
}
-interface appAuthedRouteRouteChildren {
- appAuthedTodosRoute: typeof appAuthedTodosRoute
+interface AppProtectedRouteRouteChildren {
+ AppProtectedTodosRoute: typeof AppProtectedTodosRoute
+}
+
+const AppProtectedRouteRouteChildren: AppProtectedRouteRouteChildren = {
+ AppProtectedTodosRoute: AppProtectedTodosRoute,
+}
+
+const AppProtectedRouteRouteWithChildren =
+ AppProtectedRouteRoute._addFileChildren(AppProtectedRouteRouteChildren)
+
+interface AppRouteRouteChildren {
+ AppProtectedRouteRoute: typeof AppProtectedRouteRouteWithChildren
+ AppLoginRoute: typeof AppLoginRoute
}
-const appAuthedRouteRouteChildren: appAuthedRouteRouteChildren = {
- appAuthedTodosRoute: appAuthedTodosRoute,
+const AppRouteRouteChildren: AppRouteRouteChildren = {
+ AppProtectedRouteRoute: AppProtectedRouteRouteWithChildren,
+ AppLoginRoute: AppLoginRoute,
}
-const appAuthedRouteRouteWithChildren = appAuthedRouteRoute._addFileChildren(
- appAuthedRouteRouteChildren,
+const AppRouteRouteWithChildren = AppRouteRoute._addFileChildren(
+ AppRouteRouteChildren,
)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
- appAuthedRouteRoute: appAuthedRouteRouteWithChildren,
- appLoginRoute: appLoginRoute,
+ AppRouteRoute: AppRouteRouteWithChildren,
ApiTodosRoute: ApiTodosRoute,
ApiAuthSplatRoute: ApiAuthSplatRoute,
}
@@ -162,7 +187,7 @@ export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes()
-import type { getRouter } from './router.tsx'
+import type { getRouter } from './index.tsx'
import type { createStart } from '@tanstack/react-start'
declare module '@tanstack/react-start' {
interface Register {
diff --git a/src/routing/routes/__root.tsx b/src/router/routes/__root.tsx
similarity index 81%
rename from src/routing/routes/__root.tsx
rename to src/router/routes/__root.tsx
index 9abdffb..32d38b9 100644
--- a/src/routing/routes/__root.tsx
+++ b/src/router/routes/__root.tsx
@@ -7,14 +7,10 @@ import {
} from "@tanstack/react-router";
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
import { AppWrapper } from "@/client/components/AppWrapper";
-import appCss from "@/client/styles.css?url";
-import { getAuthSession } from "@/core/lib/getAuthSession";
-import type { RouterContext } from "../router";
+import type { RouterContext } from "@/router";
+import appCss from "@/router/routes/styles.css?url";
export const Route = createRootRouteWithContext()({
- beforeLoad: async ({ context }) => {
- return await getAuthSession(context.queryClient);
- },
head: () => ({
meta: [
{
@@ -25,7 +21,11 @@ export const Route = createRootRouteWithContext()({
content: "width=device-width, initial-scale=1",
},
{
- title: "TanStack Start Starter",
+ title: "pengwu",
+ },
+ {
+ name: "description",
+ content: "Jaime's personal portfolio",
},
],
links: [
@@ -33,6 +33,11 @@ export const Route = createRootRouteWithContext()({
rel: "stylesheet",
href: appCss,
},
+ {
+ rel: "icon",
+ href: "/favicon.ico",
+ sizes: "any",
+ },
],
}),
shellComponent: RootDocument,
diff --git a/src/routing/routes/(app)/_authed/route.tsx b/src/router/routes/_app/_protected/route.tsx
similarity index 84%
rename from src/routing/routes/(app)/_authed/route.tsx
rename to src/router/routes/_app/_protected/route.tsx
index 919bfa7..c09bf0a 100644
--- a/src/routing/routes/(app)/_authed/route.tsx
+++ b/src/router/routes/_app/_protected/route.tsx
@@ -1,6 +1,6 @@
import { createFileRoute } from "@tanstack/react-router";
-export const Route = createFileRoute("/(app)/_authed")({
+export const Route = createFileRoute("/_app/_protected")({
beforeLoad: async ({ context }) => {
const authSession = context.session;
diff --git a/src/routing/routes/(app)/_authed/todos.tsx b/src/router/routes/_app/_protected/todos.tsx
similarity index 98%
rename from src/routing/routes/(app)/_authed/todos.tsx
rename to src/router/routes/_app/_protected/todos.tsx
index fb9a507..1423b64 100644
--- a/src/routing/routes/(app)/_authed/todos.tsx
+++ b/src/router/routes/_app/_protected/todos.tsx
@@ -3,7 +3,7 @@ import { createFileRoute } from "@tanstack/react-router";
import { createTodo } from "@/server/functions/createTodos";
import { getTodos } from "@/server/functions/getTodos";
-export const Route = createFileRoute("/(app)/_authed/todos")({
+export const Route = createFileRoute("/_app/_protected/todos")({
component: DemoDrizzle,
loader: async ({ context }) => {
await context.queryClient.ensureQueryData({
diff --git a/src/routing/routes/(app)/login.tsx b/src/router/routes/_app/login.tsx
similarity index 97%
rename from src/routing/routes/(app)/login.tsx
rename to src/router/routes/_app/login.tsx
index eed109a..7087086 100644
--- a/src/routing/routes/(app)/login.tsx
+++ b/src/router/routes/_app/login.tsx
@@ -5,7 +5,7 @@ import { Input } from "@/client/components/ui/input";
import { useAuthHandlers } from "@/client/hooks/useAuthHandlers";
import { cn } from "@/client/lib/utils";
-export const Route = createFileRoute("/(app)/login")({
+export const Route = createFileRoute("/_app/login")({
component: RouteComponent,
});
diff --git a/src/router/routes/_app/route.tsx b/src/router/routes/_app/route.tsx
new file mode 100644
index 0000000..5a93276
--- /dev/null
+++ b/src/router/routes/_app/route.tsx
@@ -0,0 +1,13 @@
+import { createFileRoute, Outlet } from "@tanstack/react-router";
+import { getAuthSession } from "@/core/lib/getAuthSession";
+
+export const Route = createFileRoute("/_app")({
+ beforeLoad: async ({ context }) => {
+ return await getAuthSession(context.queryClient);
+ },
+ component: RouteComponent,
+});
+
+function RouteComponent() {
+ return ;
+}
diff --git a/src/routing/routes/api/auth.$.ts b/src/router/routes/api/auth.$.ts
similarity index 100%
rename from src/routing/routes/api/auth.$.ts
rename to src/router/routes/api/auth.$.ts
diff --git a/src/routing/routes/api/todos.ts b/src/router/routes/api/todos.ts
similarity index 100%
rename from src/routing/routes/api/todos.ts
rename to src/router/routes/api/todos.ts
diff --git a/src/routing/routes/index.tsx b/src/router/routes/index.tsx
similarity index 100%
rename from src/routing/routes/index.tsx
rename to src/router/routes/index.tsx
diff --git a/src/client/styles.css b/src/router/routes/styles.css
similarity index 100%
rename from src/client/styles.css
rename to src/router/routes/styles.css
diff --git a/vite.config.ts b/vite.config.ts
index 8d95471..6caad34 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -26,9 +26,9 @@ const config = defineConfig({
tailwindcss(),
tanstackStart({
router: {
- entry: "./routing/router.tsx",
- routesDirectory: "./routing/routes",
- generatedRouteTree: "./routing/routeTree.gen.ts",
+ entry: "./router/index.tsx",
+ routesDirectory: "./router/routes",
+ generatedRouteTree: "./router/routeTree.gen.ts",
},
}),
viteReact({