import { Box, Card, CardBody, Container, Heading, Link, Stack, StackDivider, Text, VStack, } from "@chakra-ui/react"; import { useLoaderData } from "@remix-run/react"; import { type ReactNode } from "react"; export async function loader({ context }: { context: RequestContext }) { const now = new Date(); const monthEventList = await context.env.D1.prepare( "SELECT * FROM events WHERE month = ? AND year = ?;", ) .bind(now.getUTCMonth() + 1, now.getUTCFullYear()) .all(); if (monthEventList.error) throw new Response(null, { status: 500, }); return monthEventList.results; } export default function () { const data: { [k: string]: any }[] = useLoaderData(); const eventCards: ReactNode[] = []; for (const event of data) { eventCards.push( } spacing="4"> Date {event.year}-{event.month}-{event.day} Event Type {event.type.toUpperCase()} Host {event.created_by} , ); } return ( {eventCards} Book an Event
Events Team Member Management
); }