"use client";

import { useRouter } from "next/navigation";

/**
 * The live `#select_trigger` dropdown (`samplelanding.php`) navigates
 * between the real sibling "sample landing" pages on change
 * (`getajaxSample`) — real internal routes, not an invented set.
 */
export function SampleTypeSelect({
  current,
  options,
}: {
  current: string;
  options: { alias: string; label: string }[];
}) {
  const router = useRouter();
  return (
    <select
      aria-label="Sample type"
      defaultValue={current}
      onChange={(e) => router.push(`/${e.target.value}`)}
      className="rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm text-slate-700"
    >
      {options.map((nav) => (
        <option key={nav.alias} value={nav.alias}>
          {nav.label}
        </option>
      ))}
    </select>
  );
}
