'use client';

import { usePathname } from '@/shared/config/i18n/navigation';
import Footer from '@/widgets/footer/ui';
import Navbar from '@/widgets/navbar/ui';
import { Suspense } from 'react';

const HIDE_FOOTER_ROUTES = ['/auth', '/checkout'];

export default function LayoutShell({
  children,
}: {
  children: React.ReactNode;
}) {
  const pathname = usePathname();

  const hideFooter = HIDE_FOOTER_ROUTES.some((route) =>
    pathname.startsWith(route),
  );

  return (
    <Suspense>
      <div className="flex min-h-screen flex-col">
        <Navbar />
        <main className="flex-1 max-lg:mb-20">{children}</main>
        {!hideFooter && <Footer />}
      </div>
    </Suspense>
  );
}
