Initial Commit
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { lazy, Suspense } from "react"
|
||||
import { Navigate, type RouteObject } from "react-router-dom"
|
||||
import Layout from "@/shared/components/Layout"
|
||||
import ProtectedRoute from "@/shared/components/ProtectedRoute"
|
||||
import { SnapLayout } from "@/features/snap/components/SnapLayout"
|
||||
import { PaletteShell } from "@/shared/components/PaletteShell"
|
||||
import { PATHS } from "@/config/routes"
|
||||
|
||||
const LoginPage = lazy(() => import("@/features/auth/pages/LoginPage"))
|
||||
const SessionListPage = lazy(() => import("@/features/snap/pages/SessionListPage"))
|
||||
const NewChatPage = lazy(() => import("@/features/snap/pages/NewChatPage"))
|
||||
const SessionChatPage = lazy(() => import("@/features/snap/pages/SessionChatPage"))
|
||||
const SnippetPalettePage = lazy(() => import("@/features/snippets/pages/SnippetPalettePage"))
|
||||
|
||||
const fallback = <div className="text-muted-foreground">로딩...</div>
|
||||
|
||||
const wrap = (el: React.ReactNode) => <Suspense fallback={fallback}>{el}</Suspense>
|
||||
|
||||
export const routes: RouteObject[] = [
|
||||
{
|
||||
element: <Layout />,
|
||||
children: [{ path: PATHS.LOGIN.slice(1), element: wrap(<LoginPage />) }],
|
||||
},
|
||||
{
|
||||
element: <ProtectedRoute />,
|
||||
children: [
|
||||
{
|
||||
// 챗봇(snap)·스니펫 공통 래퍼 — 붙여넣기 대상 배지 등 공통 UI 를 여기 한 곳에.
|
||||
element: <PaletteShell />,
|
||||
children: [
|
||||
{
|
||||
element: <SnapLayout />,
|
||||
children: [
|
||||
{ path: PATHS.SNAP.slice(1), element: wrap(<SessionListPage />) },
|
||||
{ path: PATHS.SNAP_NEW.slice(1), element: wrap(<NewChatPage />) },
|
||||
{ path: PATHS.SNAP_SESSION.slice(1), element: wrap(<SessionChatPage />) },
|
||||
],
|
||||
},
|
||||
{
|
||||
// snap 헤더·Ctrl+N 없이 풀윈도우(Raycast). h-full 체인은 PaletteShell 의 h-screen 에 기댐.
|
||||
path: PATHS.SNIPPET.slice(1),
|
||||
element: wrap(<SnippetPalettePage />),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{ path: "*", element: <Navigate to={PATHS.SNAP} replace /> },
|
||||
]
|
||||
Reference in New Issue
Block a user