'use client'

import dynamic from 'next/dynamic'
import { useLocale } from '../../contexts/LocaleContext'

// Динамический импорт клиентского компонента без SSR
const DashboardClient = dynamic(() => import('./DashboardClient'), {
  ssr: false,
  loading: () => {
    // eslint-disable-next-line react-hooks/rules-of-hooks
    const { t } = useLocale()
    return (
      <div className="d-flex justify-content-center align-items-center min-vh-100">
        <div className="text-center">
          <div className="spinner-border text-primary" role="status">
            <span className="visually-hidden">{t('common.loading')}</span>
          </div>
          <p className="mt-3">{t('dashboard.title')} {t('common.loading')}...</p>
        </div>
      </div>
    )
  }
})

export default function DashboardPage() {
  return <DashboardClient />
}
