File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { useRouter } from "next/router";
44
55import { Button } from "@/components/ui/button" ;
66import TagList from "@/components/ui/tag-list" ;
7- import { useEvent } from "@/hooks/event " ;
7+ import { useEvent } from "@/hooks/events " ;
88
99import ActionLayout from "../layouts/actionlayout" ;
1010
Original file line number Diff line number Diff line change @@ -2,11 +2,15 @@ import Link from "next/link";
22import { useRouter } from "next/router" ;
33
44import { Button } from "@/components/ui/button" ;
5+ import { useEvent } from "@/hooks/events" ;
56import ActionLayout from "@/pages/layouts/actionlayout" ;
67
78export default function ParticipantsPage ( ) {
89 const router = useRouter ( ) ;
910 const { id } = router . query ;
11+ const eventId = Number ( id ) ;
12+
13+ const { data : event , isLoading } = useEvent ( eventId ) ;
1014
1115 return (
1216 < >
@@ -21,12 +25,25 @@ export default function ParticipantsPage() {
2125 </ Button >
2226 }
2327 primaryAction = {
24- < Link href = { "/events/" + id + "/participants" } className = "flex-1" >
28+ < Link
29+ href = { "/events/" + eventId + "/participants" }
30+ className = "flex-1"
31+ >
2532 < Button className = "w-full rounded-full" > Unused Button</ Button >
2633 </ Link >
2734 }
2835 >
29- < div > Participants for event { id } </ div >
36+ { ! isLoading && event ?. participants && event . participants . length > 0 && (
37+ < div >
38+ { event . participants . map ( ( p ) => (
39+ < p key = { p . id } > { p . username } </ p >
40+ ) ) }
41+ </ div >
42+ ) }
43+
44+ { ! isLoading && event ?. participants ?. length === 0 && (
45+ < p > No participants yet.</ p >
46+ ) }
3047 </ ActionLayout >
3148 </ >
3249 ) ;
You can’t perform that action at this time.
0 commit comments