'use client';

import { usePathname } from 'next/navigation';
import { DataNav } from '@/components/admin/data-nav';

type NavLink = {
  title: string;
  href: string;
};

export function DataLayoutShell({
  title,
  links,
  children,
}: {
  title: string;
  links: NavLink[];
  children: React.ReactNode;
}) {
  const pathname = usePathname() || '';
  const isStandaloneDataPage = pathname.startsWith('/admin/data/real-estate');

  if (isStandaloneDataPage) {
    return <div className="mt-2">{children}</div>;
  }

  return (
    <>
      <h1 className="text-3xl font-semibold">{title}</h1>
      <div className="mt-4 w-full border-b">
        <DataNav links={links} />
      </div>
      <div className="mt-6">{children}</div>
    </>
  );
}
