"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Clock, Filter } from "lucide-react";
import { Button } from "../../primitives/button.js";
import { useT } from "@open-mercato/shared/lib/i18n/context";
const ICONS = { clock: Clock, filter: Filter };
function QuickFilters({ presets, userId, onApply }) {
  const t = useT();
  const availablePresets = React.useMemo(
    () => presets.filter((preset) => !preset.requiresUser || userId.trim().length > 0),
    [presets, userId]
  );
  if (!availablePresets.length) return null;
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
    /* @__PURE__ */ jsx("div", { className: "text-overline font-medium uppercase tracking-widest text-muted-foreground", children: t("ui.advancedFilter.quickFilters.heading", "Quick filters") }),
    /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: availablePresets.map((p) => {
      const Icon = p.iconName ? ICONS[p.iconName] ?? Filter : Filter;
      return /* @__PURE__ */ jsxs(
        Button,
        {
          type: "button",
          variant: "outline",
          size: "sm",
          className: "rounded-full h-8 px-3 gap-1.5",
          onClick: () => onApply(p.build({ userId, now: /* @__PURE__ */ new Date() }), p),
          children: [
            /* @__PURE__ */ jsx(Icon, { className: "size-3.5 text-muted-foreground" }),
            t(p.labelKey, p.labelKey)
          ]
        },
        p.id
      );
    }) }),
    /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("ui.advancedFilter.quickFilters.hint", "Click a quick filter to apply it instantly. Editable after applying.") })
  ] });
}
export {
  QuickFilters
};
//# sourceMappingURL=QuickFilters.js.map
