"use client";
import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { Languages } from "lucide-react";
import { Button } from "@open-mercato/ui/primitives/button";
import {
  Drawer,
  DrawerBody,
  DrawerContent,
  DrawerDescription,
  DrawerHeader,
  DrawerTitle
} from "@open-mercato/ui/primitives/drawer";
import { useT } from "@open-mercato/shared/lib/i18n/context";
import { TranslationManager } from "./TranslationManager.js";
function TranslationDrawerAction({ config }) {
  const t = useT();
  const [open, setOpen] = React.useState(false);
  const canRender = Boolean(
    config?.entityType && config?.recordId && String(config.recordId).trim().length > 0
  );
  if (!canRender) return null;
  return /* @__PURE__ */ jsxs(Drawer, { open, onOpenChange: setOpen, children: [
    /* @__PURE__ */ jsx(
      Button,
      {
        type: "button",
        variant: "ghost",
        size: "icon",
        onClick: () => setOpen(true),
        "aria-label": t("translations.widgets.translationManager.fullManager", "Translation manager"),
        title: t("translations.widgets.translationManager.fullManager", "Translation manager"),
        children: /* @__PURE__ */ jsx(Languages, { className: "size-4" })
      }
    ),
    /* @__PURE__ */ jsxs(DrawerContent, { className: "max-w-4xl", children: [
      /* @__PURE__ */ jsxs(DrawerHeader, { children: [
        /* @__PURE__ */ jsx(DrawerTitle, { children: t("translations.widgets.translationManager.groupLabel", "Translations") }),
        /* @__PURE__ */ jsx(DrawerDescription, { children: t(
          "translations.widgets.translationManager.groupDescription",
          "Manage translations for this record across supported locales."
        ) })
      ] }),
      /* @__PURE__ */ jsx(DrawerBody, { children: /* @__PURE__ */ jsx(
        TranslationManager,
        {
          mode: "embedded",
          entityType: config.entityType,
          recordId: config.recordId,
          baseValues: config.baseValues
        }
      ) })
    ] })
  ] });
}
export {
  TranslationDrawerAction
};
//# sourceMappingURL=TranslationDrawerAction.js.map
