--- import AnnouncementBanner from '../components/AnnouncementBanner.astro' import BaseHead from '../components/BaseHead.astro' import Footer from '../components/Footer.astro' import Header from '../components/Header.astro' import { cn } from '../lib/cn' import { prisma } from '../lib/prisma' import type { AstroChildren } from '../lib/astro' import type { ComponentProps } from 'astro/types' import '@fontsource-variable/space-grotesk' import '../styles/global.css' type Props = ComponentProps & { children: AstroChildren errors?: string[] success?: string[] className?: { body?: string main?: string footer?: string } showSplashText?: boolean widthClassName?: | 'container' | 'max-w-none' | 'max-w-screen-2xl' | 'max-w-screen-lg' | 'max-w-screen-md' | 'max-w-screen-sm' | 'max-w-screen-xl' | 'max-w-screen-xs' } const { errors = [], success = [], className, widthClassName = 'max-w-screen-2xl', showSplashText, ...baseHeadProps } = Astro.props const actualErrors = [...errors, ...Astro.locals.banners.errors] const actualSuccess = [...success, ...Astro.locals.banners.successes] const currentDate = new Date() const announcement = await Astro.locals.banners.try( 'Unable to load announcements.', () => prisma.announcement.findFirst({ where: { isActive: true, startDate: { lte: currentDate }, OR: [{ endDate: null }, { endDate: { gt: currentDate } }], }, select: { id: true, content: true, type: true, link: true, linkText: true, startDate: true, endDate: true, isActive: true, }, orderBy: [{ type: 'desc' }, { createdAt: 'desc' }], }), null ) --- {announcement && }
{ actualSuccess.length > 0 && (
    {actualSuccess.map((message) => (
  • {message}
  • ))}
) } { actualErrors.length > 0 && (
    {actualErrors.map((error) => (
  • {error}
  • ))}
) }