forked from niharika-mente/DevEvent_Tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.tsx
More file actions
66 lines (57 loc) · 2.16 KB
/
Copy pathpage.tsx
File metadata and controls
66 lines (57 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { Suspense } from "react";
import ExploreBtn from "@/components/ExploreBtn";
import EventCard from "@/components/EventCard";
import SearchFilters from "@/components/SearchFilters";
import Footer from "@/components/Footer";
import { IEvent } from "@/database";
import { getAllEvents } from "@/lib/actions/event.actions";
interface PageProps {
searchParams: Promise<{
query?: string;
mode?: string;
tag?: string;
}>;
}
const Page = async ({ searchParams }: PageProps) => {
const resolvedParams = await searchParams;
const { events } = await getAllEvents({
query: resolvedParams.query,
mode: resolvedParams.mode,
tag: resolvedParams.tag,
});
return (
<section>
<h1 className="text-center">The Hub for Every Dev <br /> Event You Can't Miss</h1>
<p className="text-center mt-5 cursor-pointer select-none">Hackathons, Meetups, and Conferences, All in One Place</p>
<ExploreBtn />
<div className="mt-10">
<Suspense fallback={<div className="w-full h-16 animate-pulse rounded-xl bg-white/5" />}>
<SearchFilters />
</Suspense>
</div>
<div className="mt-20 space-y-7">
<h3>Featured Events</h3>
{events && events.length > 0 ? (
<ul className="events">
{events.map((event: IEvent) => (
<li key={event._id as string} className="list-none">
<EventCard {...event} />
</li>
))}
</ul>
) : (
/* Smooth Contextual Empty State displayed dynamically */
<div className="flex flex-col items-center justify-center text-center p-12 border border-dashed border-border rounded-2xl max-w-xl mx-auto bg-card/60">
<h4 className="text-lg font-semibold text-foreground mb-1">No events found</h4>
{/* Fixed Linting Error: Escaped the apostrophe here */}
<p className="text-sm text-muted-foreground max-w-xs">
We couldn't find any listings matching your search constraints. Try checking your spelling or adjusting filters.
</p>
</div>
)}
</div>
<Footer />
</section>
)
}
export default Page;