"use client"

import { usePathname } from "next/navigation"
import { AdminTabs } from "@/components/admin/admin-tabs"

/**
 * Wraps admin pages. Shows tabs on sub-pages (locations, resource-types, resources)
 * but not on the main /admin dashboard.
 */
export function AdminTabsWrapper({ children }: { children: React.ReactNode }) {
  const pathname = usePathname()

  // Show tabs on resource management pages, not on /admin dashboard
  const showTabs =
    pathname.startsWith("/admin/locations") ||
    pathname.startsWith("/admin/resource-types") ||
    pathname.startsWith("/admin/resources")

  return (
    <>
      {showTabs && (
        <div className="mb-[var(--ds-space-4x)]">
          <AdminTabs />
        </div>
      )}
      {children}
    </>
  )
}
