Skip to content

Commit 4789ab0

Browse files
added basic event detail display page
1 parent 3f5ca20 commit 4789ab0

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

client/src/pages/events/[id].tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { useRouter } from "next/router";
2+
3+
import { useEvent } from "@/hooks/event";
4+
5+
import DockLayout from "../layouts/docklayout";
6+
7+
export default function EventDetailsPage() {
8+
// useRouter allows access to URL parameters
9+
const router = useRouter();
10+
const id = Number(router.query.id);
11+
12+
const { data: event, isLoading } = useEvent(id);
13+
if (isLoading) {
14+
return <p>Loading event...</p>;
15+
}
16+
17+
if (!event) {
18+
return <p>Event not found</p>;
19+
}
20+
21+
return (
22+
<>
23+
<DockLayout>
24+
<div>
25+
<h1>{event.event_name}</h1>
26+
<p>{event.event_description}</p>
27+
</div>
28+
</DockLayout>
29+
</>
30+
);
31+
}

0 commit comments

Comments
 (0)