alternative tangled frontend (extremely wip)

refactor: reorg routes

serenity f6558e01 dafc272a

+78 -40
+61 -37
src/routeTree.gen.ts
··· 9 9 // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified. 10 10 11 11 import { Route as rootRouteImport } from './routes/__root' 12 + import { Route as LoginRouteImport } from './routes/login' 13 + import { Route as AuthedRouteImport } from './routes/_authed' 12 14 import { Route as IndexRouteImport } from './routes/index' 13 - import { Route as ReservedLoginRouteImport } from './routes/reserved/login' 14 - import { Route as ReservedOauthCallbackRouteImport } from './routes/reserved/oauth/callback' 15 + import { Route as AuthedOauthCallbackRouteImport } from './routes/_authed/oauth/callback' 15 16 17 + const LoginRoute = LoginRouteImport.update({ 18 + id: '/login', 19 + path: '/login', 20 + getParentRoute: () => rootRouteImport, 21 + } as any) 22 + const AuthedRoute = AuthedRouteImport.update({ 23 + id: '/_authed', 24 + getParentRoute: () => rootRouteImport, 25 + } as any) 16 26 const IndexRoute = IndexRouteImport.update({ 17 27 id: '/', 18 28 path: '/', 19 29 getParentRoute: () => rootRouteImport, 20 30 } as any) 21 - const ReservedLoginRoute = ReservedLoginRouteImport.update({ 22 - id: '/reserved/login', 23 - path: '/reserved/login', 24 - getParentRoute: () => rootRouteImport, 25 - } as any) 26 - const ReservedOauthCallbackRoute = ReservedOauthCallbackRouteImport.update({ 27 - id: '/reserved/oauth/callback', 28 - path: '/reserved/oauth/callback', 29 - getParentRoute: () => rootRouteImport, 31 + const AuthedOauthCallbackRoute = AuthedOauthCallbackRouteImport.update({ 32 + id: '/oauth/callback', 33 + path: '/oauth/callback', 34 + getParentRoute: () => AuthedRoute, 30 35 } as any) 31 36 32 37 export interface FileRoutesByFullPath { 33 38 '/': typeof IndexRoute 34 - '/reserved/login': typeof ReservedLoginRoute 35 - '/reserved/oauth/callback': typeof ReservedOauthCallbackRoute 39 + '/login': typeof LoginRoute 40 + '/oauth/callback': typeof AuthedOauthCallbackRoute 36 41 } 37 42 export interface FileRoutesByTo { 38 43 '/': typeof IndexRoute 39 - '/reserved/login': typeof ReservedLoginRoute 40 - '/reserved/oauth/callback': typeof ReservedOauthCallbackRoute 44 + '/login': typeof LoginRoute 45 + '/oauth/callback': typeof AuthedOauthCallbackRoute 41 46 } 42 47 export interface FileRoutesById { 43 48 __root__: typeof rootRouteImport 44 49 '/': typeof IndexRoute 45 - '/reserved/login': typeof ReservedLoginRoute 46 - '/reserved/oauth/callback': typeof ReservedOauthCallbackRoute 50 + '/_authed': typeof AuthedRouteWithChildren 51 + '/login': typeof LoginRoute 52 + '/_authed/oauth/callback': typeof AuthedOauthCallbackRoute 47 53 } 48 54 export interface FileRouteTypes { 49 55 fileRoutesByFullPath: FileRoutesByFullPath 50 - fullPaths: '/' | '/reserved/login' | '/reserved/oauth/callback' 56 + fullPaths: '/' | '/login' | '/oauth/callback' 51 57 fileRoutesByTo: FileRoutesByTo 52 - to: '/' | '/reserved/login' | '/reserved/oauth/callback' 53 - id: '__root__' | '/' | '/reserved/login' | '/reserved/oauth/callback' 58 + to: '/' | '/login' | '/oauth/callback' 59 + id: '__root__' | '/' | '/_authed' | '/login' | '/_authed/oauth/callback' 54 60 fileRoutesById: FileRoutesById 55 61 } 56 62 export interface RootRouteChildren { 57 63 IndexRoute: typeof IndexRoute 58 - ReservedLoginRoute: typeof ReservedLoginRoute 59 - ReservedOauthCallbackRoute: typeof ReservedOauthCallbackRoute 64 + AuthedRoute: typeof AuthedRouteWithChildren 65 + LoginRoute: typeof LoginRoute 60 66 } 61 67 62 68 declare module '@tanstack/react-router' { 63 69 interface FileRoutesByPath { 70 + '/login': { 71 + id: '/login' 72 + path: '/login' 73 + fullPath: '/login' 74 + preLoaderRoute: typeof LoginRouteImport 75 + parentRoute: typeof rootRouteImport 76 + } 77 + '/_authed': { 78 + id: '/_authed' 79 + path: '' 80 + fullPath: '' 81 + preLoaderRoute: typeof AuthedRouteImport 82 + parentRoute: typeof rootRouteImport 83 + } 64 84 '/': { 65 85 id: '/' 66 86 path: '/' ··· 68 88 preLoaderRoute: typeof IndexRouteImport 69 89 parentRoute: typeof rootRouteImport 70 90 } 71 - '/reserved/login': { 72 - id: '/reserved/login' 73 - path: '/reserved/login' 74 - fullPath: '/reserved/login' 75 - preLoaderRoute: typeof ReservedLoginRouteImport 76 - parentRoute: typeof rootRouteImport 77 - } 78 - '/reserved/oauth/callback': { 79 - id: '/reserved/oauth/callback' 80 - path: '/reserved/oauth/callback' 81 - fullPath: '/reserved/oauth/callback' 82 - preLoaderRoute: typeof ReservedOauthCallbackRouteImport 83 - parentRoute: typeof rootRouteImport 91 + '/_authed/oauth/callback': { 92 + id: '/_authed/oauth/callback' 93 + path: '/oauth/callback' 94 + fullPath: '/oauth/callback' 95 + preLoaderRoute: typeof AuthedOauthCallbackRouteImport 96 + parentRoute: typeof AuthedRoute 84 97 } 85 98 } 86 99 } 87 100 101 + interface AuthedRouteChildren { 102 + AuthedOauthCallbackRoute: typeof AuthedOauthCallbackRoute 103 + } 104 + 105 + const AuthedRouteChildren: AuthedRouteChildren = { 106 + AuthedOauthCallbackRoute: AuthedOauthCallbackRoute, 107 + } 108 + 109 + const AuthedRouteWithChildren = 110 + AuthedRoute._addFileChildren(AuthedRouteChildren) 111 + 88 112 const rootRouteChildren: RootRouteChildren = { 89 113 IndexRoute: IndexRoute, 90 - ReservedLoginRoute: ReservedLoginRoute, 91 - ReservedOauthCallbackRoute: ReservedOauthCallbackRoute, 114 + AuthedRoute: AuthedRouteWithChildren, 115 + LoginRoute: LoginRoute, 92 116 } 93 117 export const routeTree = rootRouteImport 94 118 ._addFileChildren(rootRouteChildren)
+14
src/routes/_authed.tsx
··· 1 + import { createFileRoute, Outlet } from '@tanstack/react-router' 2 + 3 + export const Route = createFileRoute('/_authed')({ 4 + component: RouteComponent, 5 + }) 6 + 7 + function RouteComponent() { 8 + return ( 9 + <div> 10 + <p>Hello "/_authed"!</p> 11 + <Outlet /> 12 + </div> 13 + ) 14 + }
+1 -1
src/routes/index.tsx
··· 9 9 The better frontend for the better forge. 10 10 </h1> 11 11 <Link 12 - to="/reserved/login" 12 + to="/login" 13 13 className="transition-all hover:bg-overlay0 bg-surface0 text-text p-2 rounded-xs" 14 14 > 15 15 Sign in
+1 -1
src/routes/reserved/login.tsx src/routes/login.tsx
··· 1 1 import { SignIn } from '@/components/Auth/SignIn' 2 2 import { createFileRoute } from '@tanstack/react-router' 3 3 4 - export const Route = createFileRoute('/reserved/login')({ 4 + export const Route = createFileRoute('/login')({ 5 5 component: RouteComponent, 6 6 }) 7 7
+1 -1
src/routes/reserved/oauth/callback.tsx src/routes/_authed/oauth/callback.tsx
··· 1 1 import { createFileRoute } from '@tanstack/react-router' 2 2 3 - export const Route = createFileRoute('/reserved/oauth/callback')({ 3 + export const Route = createFileRoute('/_authed/oauth/callback')({ 4 4 component: RouteComponent, 5 5 }) 6 6