Initial commit
Next.js + Express event management app for Hope Family Church.
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
import { EventCard } from "@/components/events/EventCard";
|
||||
import { Navbar } from "@/components/layout/Navbar";
|
||||
import { Footer } from "@/components/layout/Footer";
|
||||
import { SectionHeader } from "@/components/shared/SectionHeader";
|
||||
import { ContactSection } from "@/components/shared/ContactSection";
|
||||
import { appName } from "@/lib/siteConfig";
|
||||
|
||||
|
||||
type Event = {
|
||||
id: string;
|
||||
title: string;
|
||||
description?: string;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
registrationDeadline?: string | null;
|
||||
goLiveAt?: string;
|
||||
price: number;
|
||||
picture?: string;
|
||||
};
|
||||
|
||||
import { apiFetch } from "@/lib/api";
|
||||
|
||||
export default async function HomePage() {
|
||||
const events = await apiFetch<Event[]>("/api/events", { nextOptions: { next: { revalidate: 60 } } });
|
||||
const now = Date.now();
|
||||
const upcoming = (events || []).filter(e => {
|
||||
const t = new Date(e.startDate).getTime();
|
||||
return !isNaN(t) && t > now;
|
||||
});
|
||||
const sorted = [...upcoming].sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime());
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col">
|
||||
<Navbar />
|
||||
|
||||
<main className="flex-1">
|
||||
<section className="bg-gradient-to-br from-blue-100 to-white py-16 text-center">
|
||||
<h1 className="text-4xl font-bold mb-4">Welcome to {appName}</h1>
|
||||
<p className="text-gray-600 text-lg mb-6">Experience unforgettable moments. Powered by purpose.</p>
|
||||
<div className="space-x-4">
|
||||
<a href="/events" className="px-6 py-2 bg-blue-600 text-white rounded-xl hover:bg-blue-700">
|
||||
View Events
|
||||
</a>
|
||||
<a href="/register" className="px-6 py-2 border border-blue-600 text-blue-600 rounded-xl hover:bg-blue-50">
|
||||
Join Us
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="py-12 px-4 max-w-7xl mx-auto">
|
||||
<SectionHeader title="Upcoming Events" />
|
||||
<div className="grid gap-6 md:grid-cols-3 sm:grid-cols-2">
|
||||
{sorted.slice(0, 3).map(event => (
|
||||
<EventCard key={event.id} event={event} />
|
||||
))}
|
||||
</div>
|
||||
<div className="text-center mt-8">
|
||||
<a href="/events" className="text-blue-600 hover:underline text-sm">
|
||||
View all events →
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<ContactSection />
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user