Refactor frontend routing and component structure for improved navigation

- Update CLAUDE.md to reflect changes in the navigation model, emphasizing the use of App Router routes for sidebar sections.
- Refactor layout.tsx to wrap children in AppShell, enhancing the overall layout structure.
- Replace AppShell usage in page.tsx with HomePage component for better separation of concerns.
- Introduce new pages for assistants, components, dashboard, history, profile, and test, each rendering their respective components.
- Revise Sidebar component to utilize Next.js Link for navigation and improve active state handling based on the current pathname.
- Update AssistantPage to support routing-driven modes (list, choose, edit) and streamline form handling for assistant creation and editing.
This commit is contained in:
Xin Wang
2026-06-10 14:39:52 +08:00
parent 0adb3ed8a1
commit b711350c0c
17 changed files with 424 additions and 355 deletions

View File

@@ -0,0 +1,10 @@
import { AssistantPage } from "@/components/pages/AssistantPage";
export default async function Page({
params,
}: {
params: Promise<{ id: string }>;
}) {
const { id } = await params;
return <AssistantPage mode="edit" assistantId={id} />;
}

View File

@@ -0,0 +1,5 @@
import { AssistantPage } from "@/components/pages/AssistantPage";
export default function Page() {
return <AssistantPage mode="choose" />;
}

View File

@@ -0,0 +1,5 @@
import { AssistantPage } from "@/components/pages/AssistantPage";
export default function Page() {
return <AssistantPage mode="list" />;
}

View File

@@ -0,0 +1,5 @@
import { ComponentsKnowledgePage } from "@/components/pages/ComponentsKnowledgePage";
export default function Page() {
return <ComponentsKnowledgePage />;
}

View File

@@ -0,0 +1,5 @@
import { ComponentsModelsPage } from "@/components/pages/ComponentsModelsPage";
export default function Page() {
return <ComponentsModelsPage />;
}

View File

@@ -0,0 +1,5 @@
import { ComponentsToolsPage } from "@/components/pages/ComponentsToolsPage";
export default function Page() {
return <ComponentsToolsPage />;
}

View File

@@ -0,0 +1,5 @@
import { DashboardPage } from "@/components/pages/DashboardPage";
export default function Page() {
return <DashboardPage />;
}

View File

@@ -0,0 +1,5 @@
import { HistoryPage } from "@/components/pages/HistoryPage";
export default function Page() {
return <HistoryPage />;
}

View File

@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { Geist_Mono, Inter, Cormorant_Garamond } from "next/font/google";
import "./globals.css";
import { cn } from "@/lib/utils";
import { AppShell } from "@/components/layout/AppShell";
const inter = Inter({ subsets: ["latin"], variable: "--font-sans" });
@@ -48,7 +49,9 @@ export default function RootLayout({
<head>
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
</head>
<body className="min-h-full flex flex-col">{children}</body>
<body className="min-h-full flex flex-col">
<AppShell>{children}</AppShell>
</body>
</html>
);
}

View File

@@ -1,5 +1,5 @@
import { AppShell } from "@/components/layout/AppShell";
import { HomePage } from "@/components/pages/HomePage";
export default function Home() {
return <AppShell />;
}
return <HomePage />;
}

View File

@@ -0,0 +1,5 @@
import { ProfilePage } from "@/components/pages/ProfilePage";
export default function Page() {
return <ProfilePage />;
}

View File

@@ -0,0 +1,5 @@
import { TestPage } from "@/components/pages/TestPage";
export default function Page() {
return <TestPage />;
}