@enumura/chatbot-flow-editor
Version:
Visual chatbot flow editor - Development tool for creating conversational flows
48 lines (47 loc) • 1.66 kB
JavaScript
import { j as jsxRuntimeExports } from "./index-BV-DVq2p.js";
import { S as SimpleDialog } from "./Dialog-C2qkkdLN.js";
const ExportDialog = ({
open,
onClose,
flow,
onExport
}) => {
const jsonString = JSON.stringify(flow, null, 2);
const handleDownload = () => {
onExport();
onClose();
};
return /* @__PURE__ */ jsxRuntimeExports.jsx(
SimpleDialog,
{
open,
onClose,
title: "Export JSON",
footer: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
/* @__PURE__ */ jsxRuntimeExports.jsx(
"button",
{
className: "px-3 py-1 border rounded-md",
onClick: onClose,
children: "Cancel"
}
),
/* @__PURE__ */ jsxRuntimeExports.jsx(
"button",
{
className: "px-3 py-1 bg-green-600 text-white rounded-md ml-2",
onClick: handleDownload,
children: "Download"
}
)
] }),
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
/* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm", children: "Below is the JSON representation of your chatbot flow. Review it and click Download to save it as a file." }),
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "border rounded-md bg-gray-50 dark:bg-gray-800 h-80 overflow-y-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "p-4 text-xs font-mono whitespace-pre-wrap break-words", children: jsonString }) })
] })
}
);
};
export {
ExportDialog as default
};