"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import Link from "next/link";
import { ChevronRight } from "lucide-react";
import {
  Dialog,
  DialogContent,
  DialogHeader,
  DialogTitle
} from "@open-mercato/ui/primitives/dialog";
import { Button } from "@open-mercato/ui/primitives/button";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { translateWithFallback } from "@open-mercato/shared/lib/i18n/translate";
function CustomizeViewDialog({
  open,
  resizedLanesCount = 0,
  onClose,
  onResetToDefault,
  onResetColumnWidths
}) {
  const t = useT();
  return /* @__PURE__ */ jsx(
    Dialog,
    {
      open,
      onOpenChange: (next) => {
        if (!next) onClose();
      },
      children: /* @__PURE__ */ jsxs(DialogContent, { className: "sm:max-w-md", children: [
        /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: translateWithFallback(t, "customers.deals.kanban.customize.title", "Customize view") }) }),
        /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-1", children: [
          /* @__PURE__ */ jsx("span", { className: "text-overline font-semibold uppercase tracking-wider text-muted-foreground", children: translateWithFallback(t, "customers.deals.kanban.customize.actions", "Actions") }),
          /* @__PURE__ */ jsxs(
            Link,
            {
              href: "/backend/config/customers/pipeline-stages",
              className: "flex items-center justify-between gap-2 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
              onClick: () => onClose(),
              children: [
                /* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.manageStages",
                    "Manage pipeline stages"
                  ) }),
                  /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.manageStages.help",
                    "Edit names, colors, required fields"
                  ) })
                ] }),
                /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 text-muted-foreground", "aria-hidden": "true" })
              ]
            }
          ),
          onResetColumnWidths ? /* @__PURE__ */ jsxs(
            Button,
            {
              variant: "ghost",
              type: "button",
              disabled: resizedLanesCount === 0,
              onClick: () => {
                onResetColumnWidths();
                onClose();
              },
              className: "flex items-center justify-between gap-2 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
              children: [
                /* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.resetWidths",
                    "Reset column widths"
                  ) }),
                  /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: resizedLanesCount > 0 ? translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.resetWidths.helpCount",
                    "Restore the default width on {count} resized column(s)",
                    { count: resizedLanesCount }
                  ) : translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.resetWidths.helpEmpty",
                    "No columns have been resized yet"
                  ) })
                ] }),
                /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 text-muted-foreground", "aria-hidden": "true" })
              ]
            }
          ) : null,
          /* @__PURE__ */ jsxs(
            Button,
            {
              variant: "ghost",
              type: "button",
              onClick: () => {
                onResetToDefault();
                onClose();
              },
              className: "flex items-center justify-between gap-2 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
              children: [
                /* @__PURE__ */ jsxs("span", { className: "flex flex-col", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-foreground", children: translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.resetDefault",
                    "Reset to default"
                  ) }),
                  /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: translateWithFallback(
                    t,
                    "customers.deals.kanban.customize.resetDefault.help",
                    "Clear filters and restore columns"
                  ) })
                ] }),
                /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 text-muted-foreground", "aria-hidden": "true" })
              ]
            }
          )
        ] }) })
      ] })
    }
  );
}
var CustomizeViewDialog_default = CustomizeViewDialog;
export {
  CustomizeViewDialog,
  CustomizeViewDialog_default as default
};
//# sourceMappingURL=CustomizeViewDialog.js.map
