diff --git a/frontend/src/components/Modals/ManageWorkspace/DataConnectors/Connectors/Gitlab/index.jsx b/frontend/src/components/Modals/ManageWorkspace/DataConnectors/Connectors/Gitlab/index.jsx index 0c37808e..68be5196 100644 --- a/frontend/src/components/Modals/ManageWorkspace/DataConnectors/Connectors/Gitlab/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/DataConnectors/Connectors/Gitlab/index.jsx @@ -6,6 +6,7 @@ import { TagsInput } from "react-tag-input-component"; import { Info, Warning } from "@phosphor-icons/react"; import { Tooltip } from "react-tooltip"; import { useTranslation } from "react-i18next"; +import Toggle from "@/components/lib/Toggle"; const DEFAULT_BRANCHES = ["main", "master"]; export default function GitlabOptions() { @@ -128,32 +129,18 @@ export default function GitlabOptions() {

- +
- +
{ - const newValue = e.target.checked; - setAutoSubmitSttInput(newValue); - Appearance.updateSettings({ autoSubmitSttInput: newValue }); + const handleChange = (checked) => { + setAutoSubmitSttInput(checked); + Appearance.updateSettings({ autoSubmitSttInput: checked }); }; return ( @@ -317,19 +317,7 @@ function AutoSubmitPreference() { -
- -
+ { - const newValue = e.target.checked; - setAutoPlayAssistantTtsResponse(newValue); - Appearance.updateSettings({ autoPlayAssistantTtsResponse: newValue }); + const handleChange = (checked) => { + setAutoPlayAssistantTtsResponse(checked); + Appearance.updateSettings({ autoPlayAssistantTtsResponse: checked }); }; return ( @@ -375,19 +362,11 @@ function AutoSpeakPreference() { -
- -
+ void} [props.onChange] - Change handler receiving new checked state + * @param {boolean} [props.disabled=false] - Whether toggle is disabled + * @param {"sm" | "md" | "lg"} [props.size="sm"] - Toggle size + * @param {string} [props.name] - Input name for form submission + * @param {string} [props.label] - Label text next to toggle + * @param {string} [props.description] - Description text below label + * @param {"default" | "horizontal"} [props.variant="default"] - Layout variant + * @param {string} [props.hint] - Tooltip ID for info icon hint next to label + * @param {string} [props.value] - Input value for form submission + */ +export default function Toggle({ + className, + enabled, + onChange, + disabled = false, + size = "sm", + name, + label, + description, + variant = "default", + hint, + value, +}) { + const inputProps = + enabled !== undefined + ? { checked: enabled, onChange: (e) => onChange?.(e.target.checked) } + : { defaultChecked: false }; + + const labelStyles = LABEL_STYLES[size] || LABEL_STYLES.sm; + + if (variant === "horizontal") { + return ( + + ); + } + + return ( + + ); +} + +function ToggleSwitch({ name, disabled, size, inputProps, value }) { + return ( + <> + +
+ + ); +} + +function TextContent({ label, description, labelStyles = {}, hint }) { + if (!label && !description) return null; + return ( +
+ {label && ( + + {label} + {hint && ( + + )} + + )} + {description && ( + + {description} + + )} +
+ ); +} diff --git a/frontend/src/pages/Admin/AgentBuilder/BlockList/index.jsx b/frontend/src/pages/Admin/AgentBuilder/BlockList/index.jsx index c2440f3c..793d88d6 100644 --- a/frontend/src/pages/Admin/AgentBuilder/BlockList/index.jsx +++ b/frontend/src/pages/Admin/AgentBuilder/BlockList/index.jsx @@ -11,6 +11,7 @@ import { BracketsCurly, } from "@phosphor-icons/react"; import { Tooltip } from "react-tooltip"; +import Toggle from "@/components/lib/Toggle"; import StartNode from "../nodes/StartNode"; import ApiCallNode from "../nodes/ApiCallNode"; import WebsiteNode from "../nodes/WebsiteNode"; @@ -172,32 +173,20 @@ export default function BlockList({ return (
{renderBlockConfigContent(block, props)} -
-
- -

- The output of this block will be returned directly to the chat. -
- This will prevent any further tool calls from being executed. -

-
- +
+ + props.onConfigChange({ + ...props.config, + directOutput: checked, + }) + } + />
); diff --git a/frontend/src/pages/Admin/AgentBuilder/nodes/WebScrapingNode/index.jsx b/frontend/src/pages/Admin/AgentBuilder/nodes/WebScrapingNode/index.jsx index f1e48b24..6de3324d 100644 --- a/frontend/src/pages/Admin/AgentBuilder/nodes/WebScrapingNode/index.jsx +++ b/frontend/src/pages/Admin/AgentBuilder/nodes/WebScrapingNode/index.jsx @@ -1,5 +1,4 @@ -import { Info } from "@phosphor-icons/react"; -import React from "react"; +import Toggle from "@/components/lib/Toggle"; export default function WebScrapingNode({ config, @@ -72,35 +71,16 @@ export default function WebScrapingNode({
)} -
-
- - -
-
- -
-
+ + onConfigChange({ ...config, enableSummarization: checked }) + } + />