Skip to content

Commit 057c731

Browse files
committed
fix bug
1 parent 40fe1ec commit 057c731

File tree

4 files changed

+43
-7
lines changed

4 files changed

+43
-7
lines changed

app/course/[slug]/page.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { notFound } from 'next/navigation'
22
import { CustomMDX } from '@/components/mdx'
33
import { getCourseModules } from '../utils'
4+
import { Button } from '@/components/button'
5+
import Link from 'next/link'
46

57
const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000'
68

@@ -55,12 +57,18 @@ export async function generateMetadata({ params }: { params: Promise<{ slug: str
5557

5658
export default async function CourseModule({ params }: { params: Promise<{ slug: string }> }) {
5759
const { slug } = await params
58-
const courseModule = getCourseModules().find((module) => module.slug === slug)
60+
const allModules = getCourseModules()
61+
const courseModule = allModules.find((module) => module.slug === slug)
5962

6063
if (!courseModule) {
6164
notFound()
6265
}
6366

67+
// Find current module index
68+
const currentIndex = allModules.findIndex((module) => module.slug === slug)
69+
const prevModule = currentIndex > 0 ? allModules[currentIndex - 1] : null
70+
const nextModule = currentIndex < allModules.length - 1 ? allModules[currentIndex + 1] : null
71+
6472
return (
6573
<section className="items-center justify-center">
6674
<script
@@ -85,6 +93,8 @@ export default async function CourseModule({ params }: { params: Promise<{ slug:
8593
}),
8694
}}
8795
/>
96+
<div className="flex flex-col items-center rounded-xl gap-8 w-full py-12">
97+
</div>
8898
<div className="max-w-[900px] min-h-screen mx-auto justify-center items-center py-24">
8999
<div className="flex flex-col items-center rounded-xl gap-8 w-full">
90100
<h1 className="title font-semibold text-4xl tracking-tighter leading-tight text-center font-[family-name:var(--font-main)]">
@@ -101,9 +111,33 @@ export default async function CourseModule({ params }: { params: Promise<{ slug:
101111
</div>
102112
)}
103113
</div>
104-
<article className="prose prose-lg max-w-none font-[family-name:var(--font-sans)]">
114+
<article className="prose prose-lg pb-12 max-w-none font-[family-name:var(--font-sans)]">
105115
{await CustomMDX({ source: courseModule.content })}
106116
</article>
117+
<div className="flex flex-row w-full py-12 justify-between border-t border-neutral-200">
118+
{prevModule ? (
119+
<Link href={`/course/${prevModule.slug}`}>
120+
<Button variant="default" className="rounded-full">
121+
Previous
122+
</Button>
123+
</Link>
124+
) : (
125+
<Button variant="default" disabled className="rounded-full">
126+
Previous
127+
</Button>
128+
)}
129+
{nextModule ? (
130+
<Link href={`/course/${nextModule.slug}`}>
131+
<Button variant="default" className="rounded-full">
132+
Next: {nextModule.metadata.title}
133+
</Button>
134+
</Link>
135+
) : (
136+
<Button variant="default" disabled className="rounded-full">
137+
End
138+
</Button>
139+
)}
140+
</div>
107141
</div>
108142
</section>
109143
)

app/course/modules/module6.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ Export your CAMEL `ChatAgent` as an MCP server so other clients (e.g., Claude, C
4747

4848
Attached screenshots shows Claude calls the CAMEL MCP servers.
4949

50-
![chatagent-as-mcp.png](mcp.camel-ai.org/course/module6/chatagent-as-mcp.png)
50+
![chatagent-as-mcp.png](https://mcp.camel-ai.org/course/module6/chatagent-as-mcp.png)
5151

52-
![chatagent-as-mcp2.png](mcp.camel-ai.org/course/module6/chatagent-as-mcp2.png)
52+
![chatagent-as-mcp2.png](https://mcp.camel-ai.org/course/module6/chatagent-as-mcp2.png)
5353

5454
2. Using the `to_mcp()` function, as simple as the following script, it turns your agent into a MCP server.
5555

app/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
}
166166

167167
.prose code {
168-
@apply bg-gray-100 px-1 py-0.5 rounded text-sm font-mono;
168+
@apply bg-gray-200 px-1 py-0.5 rounded text-sm font-[family-name:var(--font-mono)];
169169
}
170170

171171
.prose pre {

components/nav.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ export function Nav() {
3030
<Image
3131
src="https://camel-ai.github.io/camel_asset/logo/camel_logo.svg"
3232
alt="CAMEL AI Logo"
33+
className="mb-2"
3334
width={140}
3435
height={36}
3536
/>
3637
</Link>
3738
<Button
38-
className="hidden md:hidden flex-row items-center gap-2 font-bold text-primary"
39+
variant="link"
40+
className="flex flex-row items-center gap-2 font-bold text-primary"
3941
onClick={() => router.push('/course')}
4042
>
4143
MCP Course
@@ -44,7 +46,7 @@ export function Nav() {
4446
<div className="flex flex-row items-center gap-6">
4547
<Button
4648
variant="link"
47-
className="hidden md:hidden flex-row items-center gap-2 font-bold text-primary"
49+
className="flex flex-row items-center gap-2 font-bold text-primary"
4850
onClick={() => window.open('https://github.com/camel-ai/camel', '_blank')}
4951
>
5052
CAMEL GitHub 🌟: {stars.toLocaleString()}

0 commit comments

Comments
 (0)