import Link from 'next/link';
import { LpIcon } from '@/features/list-page/ui/LpIcon';
import { NoMatchArt } from '@/features/list-page/ui/NoMatchArt';

/**
 * LD1: the Leads list's empty table (26 Nov design list-page.js:2262-2281). Filtered: the
 * "nothing matches" drawing, the design's words and Clear all filters. Empty: "No leads yet"
 * with Create lead (edit right) and Import leads (import right, to Data Integration as the
 * header's Import).
 */
export function LeadEmptyState({
  filtered,
  plural,
  singular,
  onClear,
  onCreate,
  importHref,
}: {
  filtered: boolean;
  /** Lower case ("leads"). */
  plural: string;
  /** Lower case ("lead"). */
  singular: string;
  onClear: () => void;
  /** Left out without the right to create. */
  onCreate?: () => void;
  /** Left out without the right to import. */
  importHref?: string | null;
}) {
  if (filtered) {
    return (
      <div className="lp-empty lp-empty--lead lp-empty--nomatch" role="status">
        <NoMatchArt />
        <div className="lp-empty__txt">
          <strong>No {plural} match your active filters</strong>
          <p>
            Try changing or removing filters to see more {plural}. Expecting new {plural}? They can
            take a few seconds to show up.
          </p>
          <button type="button" className="lp-btn lp-btn--outline lp-empty__btn" onClick={onClear}>
            Clear all filters
          </button>
        </div>
      </div>
    );
  }
  return (
    <div className="lp-empty lp-empty--lead">
      <LpIcon name="user" className="lp-empty__i" />
      <strong>No {plural} yet</strong>
      <p>Add {plural} to start building your database.</p>
      {onCreate || importHref ? (
        <div className="lp-empty__acts">
          {onCreate ? (
            <button type="button" className="lp-btn lp-btn--primary" onClick={onCreate}>
              Create {singular}
            </button>
          ) : null}
          {importHref ? (
            <Link className="lp-btn lp-btn--outline" href={importHref}>
              Import {plural}
            </Link>
          ) : null}
        </div>
      ) : null}
    </div>
  );
}
