'use client';

import { CheckBanned, UpdateProfile } from '@/components/auth';
import { BottomNav } from '@/components/navigation';
import { EmptyProvider } from '@/providers/empty';
import { TelegramProvider } from '@/providers/telegram';
import { isTMA } from '@telegram-apps/sdk-react';
import { type PropsWithChildren } from 'react';

export default function Layout({ children }: Readonly<PropsWithChildren>) {
  const isTG = isTMA('simple');

  const Provider = isTG ? TelegramProvider : EmptyProvider;

  return (
    <CheckBanned>
      <Provider>
        <UpdateProfile />
        <main className="grow">{children}</main>
        <BottomNav />
      </Provider>
    </CheckBanned>
  );
}
