import { HeaderClient } from '@/components/shared/layout/header/Header'
import { ModalProvider } from '@/components/shared/ModalContext'
import { FooterMain } from '@/globals/Footer/Component'
import { I18nProviderClient } from '@/locales/client'
import { ReactElement } from 'react'

// If you are using Next.js < 15, you don't need to await `params`:
// export default function SubLayout({ params: { locale }, children }: { params: { locale: string }, children: ReactElement }) {
export default async function SubLayout({
  params,
  children,
}: {
  params: Promise<{ locale: 'en' | 'ru' | 'es' }>
  children: ReactElement
}) {
  const { locale } = await params
  return (
    <I18nProviderClient locale={locale}>
      <ModalProvider>
        <HeaderClient />
        <main>{children}</main>
        <FooterMain />
      </ModalProvider>
    </I18nProviderClient>
  )
}
