import { serverClient } from "@/lib/trpc/server"

import MobileMenu from "../MobileMenu"

export default async function MobileMenuWrapper({
  children,
}: React.PropsWithChildren) {
  const [languages, headerData] = await Promise.all([
    serverClient().contentstack.languageSwitcher.get(),
    serverClient().contentstack.base.header(),
  ])

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

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