import { getSiteConfig } from "@/lib/trpc/memoizedRequests"

import SiteWideAlertClient from "./Client"

export function preload() {
  void getSiteConfig()
}

export default async function SitewideAlert() {
  const siteConfig = await getSiteConfig()

  if (!siteConfig?.sitewideAlert) {
    return null
  }

  return <SiteWideAlertClient alert={siteConfig.sitewideAlert} />
}
