Skip to content

Commit 4890648

Browse files
committed
fix(bus&club)the dynamic parameter do ot have generate static params error 2
1 parent 242d917 commit 4890648

2 files changed

Lines changed: 27 additions & 9 deletions

File tree

src/app/bus/[busNumber]/page.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,32 @@
77
// This approach avoids creating multiple static pages and keeps the code DRY.
88
// app/bus/[busNumber]/page.tsx
99

10+
// src/app/bus/[busNumber]/page.tsx
11+
interface BusPageProps {
12+
params: {
13+
busNumber: string;
14+
};
15+
}
16+
17+
// This generates static pages for known bus numbers at build time
1018
export async function generateStaticParams() {
1119
return [
1220
{ busNumber: '1' },
1321
{ busNumber: '2' },
1422
{ busNumber: '3' },
15-
// Add more known bus numbers here
23+
{ busNumber: '4' },
24+
{ busNumber: '5' },
25+
{ busNumber: '6' },
1626
];
1727
}
1828

19-
export default function BusPage({ params }: { params: { busNumber: string } }) {
29+
// This is the dynamic page that receives the busNumber from the URL
30+
export default function BusPage({ params }: BusPageProps) {
2031
return (
21-
<div>
22-
<h1>Bus Number: {params.busNumber}</h1>
23-
<p>
24-
In this dynamic page, the UI/UX remains consistent across all buses, but
25-
the content updates based on the bus number.
32+
<div className="p-4">
33+
<h1 className="text-2xl font-bold">Bus Number: {params.busNumber}</h1>
34+
<p className="mt-2">
35+
This is a dynamic page. The layout is consistent, but the content changes based on the bus number.
2636
</p>
2737
</div>
2838
);

src/app/studymaterial/page.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
export default function Home() {
2-
return <div></div>;
3-
}
2+
return (
3+
<div>
4+
<p>
5+
In this dynamic page, when you click any bus button, the UI/UX for all bus locations remains the same.
6+
We use a dynamic page system so that clicking on, for example, the "Bus 1" button redirects here,
7+
but the displayed content updates to show the respective bus's location.
8+
</p>
9+
</div>
10+
);
11+
}

0 commit comments

Comments
 (0)