import { ShoppingBasket } from 'lucide-react'
import { useHeapsQuery } from '../../hooks/useHeapsQuery'
import muliLogo from '../../assets/muli-logo.png'

/**
 * Slim top bar — just the logo and the active-heap pill. The search input
 * lives in the FilterBar now (next to the rest of the filter controls).
 */
export function TopBar() {
  const { data: heapsList = [] } = useHeapsQuery()
  const activeHeap = heapsList.find((h) => h.is_active)

  return (
    <header className="flex h-12 items-center justify-between border-b border-border bg-surface px-4">
      <div className="flex items-center gap-3">
        <div className="flex items-center gap-2">
          <img src={muliLogo} alt="Mulimago" className="h-7 w-7 object-contain" />
          <h1 className="text-lg font-semibold text-text">Mulimago</h1>
        </div>
        {activeHeap && (
          <span
            className="flex items-center gap-1 rounded bg-primary/20 px-2 py-0.5 text-xs text-primary"
            title="Active heap — press P to add selected photos here"
          >
            <ShoppingBasket className="h-3 w-3" />
            {activeHeap.name}
          </span>
        )}
      </div>

      <div className="flex items-center gap-2" />
    </header>
  )
}
