import { getHeader, getLanguageSwitcher } from "@/lib/trpc/memoizedRequests"

import MobileMenu from "../MobileMenu"

export default async function MobileMenuWrapper({
  children,
}: React.PropsWithChildren) {
  // preloaded
  const languages = await getLanguageSwitcher()
  const header = await getHeader()

  if (!languages || !header) {
    return null
  }

  return (
    <MobileMenu languageUrls={languages.urls} topLink={header.data.topLink}>
      {children}
    </MobileMenu>
  )
}
