From b7ee0b27f4d2cac9591b9a1e27729a207013f411 Mon Sep 17 00:00:00 2001 From: sherifButt <90522472+sherifButt@users.noreply.github.com> Date: Wed, 20 Mar 2024 00:37:38 +0000 Subject: [PATCH] - added meta respons page - added checkbox,toggleSwitch,textarea generic components --- .../Generic/Blocks/CheckBoxBlock/index.jsx | 82 +++++++ .../Generic/Blocks/TextAreaBlock/index.jsx | 45 ++++ .../Generic/Blocks/ToggleBlock/index.jsx | 71 ++++-- .../Generic/Inputs/CheckBox/index.jsx | 29 +++ .../Generic/Inputs/TextArea/index.jsx | 54 +++++ .../ToggleSwitch}/index.jsx | 6 +- frontend/src/models/metaResponse.js | 224 ++---------------- .../ChatEnableMetaResponse/index.jsx | 4 +- .../WorkspaceSettings/ChatSettings/index.jsx | 4 +- .../MetaResponse/EnableFeatures/index.jsx | 27 +++ .../MetaResponse/EnableInputs/index.jsx | 19 ++ .../EnableSystemPrompt/index.jsx | 26 ++ .../MetaResponse/InputsFeature/index.jsx | 16 ++ .../WorkspaceSettings/MetaResponse/index.jsx | 86 +++++++ .../src/pages/WorkspaceSettings/index.jsx | 32 ++- frontend/src/utils/paths.js | 3 + server/endpoints/workspaceMetaResponse.js | 5 +- server/endpoints/workspaces.js | 91 ++++++- 18 files changed, 586 insertions(+), 238 deletions(-) create mode 100644 frontend/src/components/Generic/Blocks/CheckBoxBlock/index.jsx create mode 100644 frontend/src/components/Generic/Blocks/TextAreaBlock/index.jsx create mode 100644 frontend/src/components/Generic/Inputs/CheckBox/index.jsx create mode 100644 frontend/src/components/Generic/Inputs/TextArea/index.jsx rename frontend/src/components/Generic/{Buttons/ToggleButton => Inputs/ToggleSwitch}/index.jsx (76%) create mode 100644 frontend/src/pages/WorkspaceSettings/MetaResponse/EnableFeatures/index.jsx create mode 100644 frontend/src/pages/WorkspaceSettings/MetaResponse/EnableInputs/index.jsx create mode 100644 frontend/src/pages/WorkspaceSettings/MetaResponse/InputsFeature/EnableSystemPrompt/index.jsx create mode 100644 frontend/src/pages/WorkspaceSettings/MetaResponse/InputsFeature/index.jsx create mode 100644 frontend/src/pages/WorkspaceSettings/MetaResponse/index.jsx diff --git a/frontend/src/components/Generic/Blocks/CheckBoxBlock/index.jsx b/frontend/src/components/Generic/Blocks/CheckBoxBlock/index.jsx new file mode 100644 index 00000000..de87cb93 --- /dev/null +++ b/frontend/src/components/Generic/Blocks/CheckBoxBlock/index.jsx @@ -0,0 +1,82 @@ +import React from "react"; +import Badge from "@/components/Generic/Badges/Badge"; +import CheckBox from "../../Inputs/CheckBox"; + +export default function CheckBoxBlock({ + initialChecked, + label, + onToggle, + description, + name, + badge = false, + badgeLabel, + badgeAnimated, + badgeBg, + border, + Icon, + contentLocation, + disabled, + inline = false, +}) { + const borderStyle = border ? "border border-gray-600 rounded-2xl p-4" : ""; + const contentPosition = { + middle: "middle", + top: "top", + bottom: "bottom", + }[contentLocation]; + + return ( +
+
+
+
+
+ {Icon && ( + + )} +
+
+ {inline && ( +
+ +
+ )} + + {badge && ( + + )} +
+ {!inline && ( + + )} +
+
+
+
+
+

+ {description} +

+
+ +
+
+ ); +} diff --git a/frontend/src/components/Generic/Blocks/TextAreaBlock/index.jsx b/frontend/src/components/Generic/Blocks/TextAreaBlock/index.jsx new file mode 100644 index 00000000..8534156a --- /dev/null +++ b/frontend/src/components/Generic/Blocks/TextAreaBlock/index.jsx @@ -0,0 +1,45 @@ +import TextArea from "../../Inputs/TextArea"; + +export default function TextAreaBlock({ + label, + description, + defaultValue, + required, + placeholder, + onChange, + name, + disabled, + initialRows, + className, + autoComplete, + wrap, +}) { + return ( +
+
+ {label && ( + + )} + {description && ( +

+ {description} +

+ )} +
+