fix: FINNALY FIXED AND COMPILABLE
This commit is contained in:
+4
-4
@@ -2,13 +2,13 @@
|
||||
// Events listing page
|
||||
|
||||
import { query } from '@/lib/db';
|
||||
import { Event } from '@/types/racing';
|
||||
import { EventWithRegistrations } from '@/types/racing';
|
||||
import Link from 'next/link';
|
||||
import Image from "next/image";
|
||||
import { TrophyIcon, UsersIcon, MapPinIcon, ClockIcon, CalendarIcon } from '@/components/ui/icons';
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
async function getEvents(): Promise<Event[]> {
|
||||
async function getEvents(): Promise<EventWithRegistrations[]> {
|
||||
const sql = `
|
||||
SELECT
|
||||
e.*,
|
||||
@@ -21,7 +21,7 @@ async function getEvents(): Promise<Event[]> {
|
||||
`;
|
||||
|
||||
const rows = await query(sql);
|
||||
return rows as Event[];
|
||||
return rows as EventWithRegistrations[];
|
||||
}
|
||||
|
||||
function formatDate(date: Date): string {
|
||||
@@ -67,7 +67,7 @@ export default async function EventsPage() {
|
||||
<p className="text-white/20 text-sm mt-2">Check back soon for new racing events</p>
|
||||
</div>
|
||||
) : (
|
||||
events.map((event: unknown) => {
|
||||
events.map((event) => {
|
||||
const isOpen = event.event_status === 'OPEN';
|
||||
const isFull = event.registrations_count >= event.max_participants;
|
||||
const deadlinePassed = event.registration_deadline && new Date(event.registration_deadline) < new Date();
|
||||
|
||||
Reference in New Issue
Block a user