'use client'

import type { ReactNode } from 'react'
import AdminSidebar from './AdminSidebar'

type AdminShellProps = {
  title: string
  subtitle?: string
  actions?: ReactNode
  rail?: ReactNode
  children: ReactNode
}

export default function AdminShell({ title, subtitle, actions, rail, children }: AdminShellProps) {
  const hasRail = Boolean(rail)

  return (
    <div className={`admin-shell ${hasRail ? 'admin-shell--with-rail' : 'admin-shell--no-rail'}`}>
      <aside className="admin-shell-nav">
        <AdminSidebar />
      </aside>
      <main className="card admin-card">
        <div className="admin-header">
          <div>
            <span className="section-kicker">Beta stream</span>
            <h1>{title}</h1>
            {subtitle && <p className="lede">{subtitle}</p>}
          </div>
          {actions}
        </div>
        {children}
      </main>
      {hasRail ? <aside className="admin-shell-rail">{rail}</aside> : null}
    </div>
  )
}
