From e7960893e07d55d0aab02fe092293b3b020858a1 Mon Sep 17 00:00:00 2001
From: sherifButt <90522472+sherifButt@users.noreply.github.com>
Date: Thu, 28 Mar 2024 12:45:05 +0000
Subject: [PATCH] - added range slider support - added five-rating support -
enhanced movile experiance
---
.../Generic/Blocks/ToggleBlock/index.jsx | 4 +-
.../Generic/Buttons/Button/index.jsx | 9 +-
.../Generic/Typography/Label/index.jsx | 19 +++
.../MetaInputs/OptionSelect/index.jsx | 40 ++---
.../MetaInputs/RangeSlider/index.jsx | 83 ++++++++++
.../ChatContainer/MetaInputs/Rating/index.jsx | 65 ++++++++
.../ChatContainer/MetaInputs/index.jsx | 149 ++++++++++++------
.../WorkspaceChat/ChatContainer/index.jsx | 6 +-
.../WorkspaceSettings/MetaResponse/index.jsx | 7 +-
frontend/src/utils/chat/extractMetaData.js | 3 +-
server/models/workspaceMetaResponse.js | 20 +++
11 files changed, 316 insertions(+), 89 deletions(-)
create mode 100644 frontend/src/components/Generic/Typography/Label/index.jsx
create mode 100644 frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/RangeSlider/index.jsx
create mode 100644 frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/Rating/index.jsx
diff --git a/frontend/src/components/Generic/Blocks/ToggleBlock/index.jsx b/frontend/src/components/Generic/Blocks/ToggleBlock/index.jsx
index 33bc2b0c..8601f92c 100644
--- a/frontend/src/components/Generic/Blocks/ToggleBlock/index.jsx
+++ b/frontend/src/components/Generic/Blocks/ToggleBlock/index.jsx
@@ -1,9 +1,10 @@
import React from "react";
import Badge from "@/components/Generic/Badges/Badge";
import ToggleButton from "@/components/Generic/Inputs/ToggleSwitch";
+import TitleBlock from "../TitleBlock";
export default function ToggleBlock({
- content, // toggle content goes here
+ content, // toggled content goes here
initialChecked,
label,
onToggle,
@@ -17,7 +18,6 @@ export default function ToggleBlock({
border,
bg,
Icon,
- contentLocation,
disabled,
inline = false,
}) {
diff --git a/frontend/src/components/Generic/Buttons/Button/index.jsx b/frontend/src/components/Generic/Buttons/Button/index.jsx
index ba4f2a0a..5df8e54e 100644
--- a/frontend/src/components/Generic/Buttons/Button/index.jsx
+++ b/frontend/src/components/Generic/Buttons/Button/index.jsx
@@ -1,6 +1,7 @@
import React from "react";
export default function Button({
+ children,
onClick,
disabled,
icon: Icon,
@@ -9,6 +10,7 @@ export default function Button({
iconSize = 18,
iconColor = "#D3D4D4",
textClass = "",
+ iconRight = false,
}) {
return (
);
}
diff --git a/frontend/src/components/Generic/Typography/Label/index.jsx b/frontend/src/components/Generic/Typography/Label/index.jsx
new file mode 100644
index 00000000..54ce1e93
--- /dev/null
+++ b/frontend/src/components/Generic/Typography/Label/index.jsx
@@ -0,0 +1,19 @@
+export default function Label({ label, description }) {
+ return (
+
+ {label && (
+
+ )}
+ {description && (
+
+ {description}
+
+ )}
+
+ );
+}
diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/OptionSelect/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/OptionSelect/index.jsx
index 1e7ebcf6..1716a72d 100644
--- a/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/OptionSelect/index.jsx
+++ b/frontend/src/components/WorkspaceChat/ChatContainer/MetaInputs/OptionSelect/index.jsx
@@ -1,7 +1,8 @@
+import Label from "@/components/Generic/Typography/Label";
import { PaperPlaneRight } from "@phosphor-icons/react";
import { useEffect, useState } from "react";
-const OptionSelect = ({ data, settings, submit, message, setMessage ,workspace}) => {
+const OptionSelect = ({ data, settings,type, submit, message, setMessage ,workspace}) => {
const [selectedOptions, setSelectedOptions] = useState([]);
const [submitMessage, setSubmitMessage] = useState(false);
@@ -12,6 +13,7 @@ const OptionSelect = ({ data, settings, submit, message, setMessage ,workspace})
}
}, [message]);
+console.log("settings?.type.includes(dropdown)", settings)
const handleSelection = (value) => {
const currentIndex = selectedOptions.indexOf(value);
@@ -33,7 +35,7 @@ const OptionSelect = ({ data, settings, submit, message, setMessage ,workspace})
};
// Normal List with Hyperlinks
- if (settings.displayType.includes("list") && workspace?.metaResponseSettings?.inputs?.config?.components?.optionsList?.isEnabled) {
+ if (settings?.displayType?.includes("list") || type?.includes("list") && workspace?.metaResponseSettings?.inputs?.config?.components?.optionsList?.isEnabled) {
return (
@@ -60,10 +62,10 @@ const OptionSelect = ({ data, settings, submit, message, setMessage ,workspace})
}
// Checkbox
- if (settings.displayType.includes("checkbox") && workspace?.metaResponseSettings?.inputs?.config?.components?.multiSelectCheckboxes?.isEnabled) {
+ if (settings?.displayType?.includes("checkbox") || type?.includes("checkbox") && workspace?.metaResponseSettings?.inputs?.config?.components?.multiSelectCheckboxes?.isEnabled) {
return (
-
+
{data.options.map((option, index) => (