"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Plus } from "lucide-react";
import { Button } from "@open-mercato/ui/primitives/button";
import { useLocale, useT } from "@open-mercato/shared/lib/i18n/context";
function CalendarHeader({ view, anchor, onNewEvent }) {
  const t = useT();
  const locale = useLocale();
  const title = React.useMemo(() => {
    if (view === "agenda") return t("customers.calendar.header.titleAgenda", "Upcoming");
    if (view === "month") {
      return new Intl.DateTimeFormat(locale, { month: "long", year: "numeric" }).format(anchor);
    }
    return new Intl.DateTimeFormat(locale, { month: "short", day: "2-digit", year: "numeric" }).format(anchor);
  }, [view, anchor, locale, t]);
  return /* @__PURE__ */ jsxs("header", { className: "flex items-center gap-3 border-b py-4", children: [
    /* @__PURE__ */ jsx("h1", { className: "min-w-0 truncate text-xl font-semibold text-foreground", children: title }),
    onNewEvent ? /* @__PURE__ */ jsx("div", { className: "ml-auto flex shrink-0 items-center", children: /* @__PURE__ */ jsxs(
      Button,
      {
        type: "button",
        onClick: onNewEvent,
        "aria-label": t("customers.calendar.actions.newEvent", "New event"),
        children: [
          /* @__PURE__ */ jsx(Plus, { "aria-hidden": "true" }),
          /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: t("customers.calendar.actions.newEvent", "New event") })
        ]
      }
    ) }) : null
  ] });
}
export {
  CalendarHeader
};
//# sourceMappingURL=CalendarHeader.js.map
