UNPKG

@inngest/workflow-kit

Version:
19 lines 1.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InputFormUI = exports.SidebarActionForm = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const SidebarActionForm = ({ workflowAction, engineAction }) => { if (engineAction === undefined) { return ((0, jsx_runtime_1.jsx)("div", { className: "wf-sidebar-form", children: (0, jsx_runtime_1.jsx)("div", { className: "wf-sidebar-content wf-sidebar-error", children: `Action ${workflowAction.kind} not found in provider.` }) })); } return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: "wf-sidebar-action", children: [(0, jsx_runtime_1.jsx)("p", { className: "wf-sidebar-action-name", children: engineAction.name }), (0, jsx_runtime_1.jsx)("p", { className: "wf-sidebar-action-description", children: engineAction.description })] }), (0, jsx_runtime_1.jsxs)("div", { className: "wf-sidebar-form", children: [(0, jsx_runtime_1.jsx)("span", { className: "wf-sidebar-configure", children: "Configure" }), (0, exports.InputFormUI)(engineAction.inputs || {})] })] })); }; exports.SidebarActionForm = SidebarActionForm; const InputFormUI = (inputs) => { // TODO: Handle different input types // TODO: Allow variables to be inserted into the input, based off of the event // or previous actions. return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: Object.entries(inputs).map(([key, input]) => ((0, jsx_runtime_1.jsxs)("label", { children: [input.type.title || key, input.fieldType === "textarea" ? (0, jsx_runtime_1.jsx)("textarea", {}) : (0, jsx_runtime_1.jsx)("input", { type: "text" })] }, key))) })); }; exports.InputFormUI = InputFormUI; //# sourceMappingURL=ActionForm.js.map