diff --git a/src/frontend/src/alerts/alertDropDown/index.tsx b/src/frontend/src/alerts/alertDropDown/index.tsx index cd1ed9137..c14c1806d 100644 --- a/src/frontend/src/alerts/alertDropDown/index.tsx +++ b/src/frontend/src/alerts/alertDropDown/index.tsx @@ -24,7 +24,7 @@ export default function AlertDropdown({}: AlertDropdownType) { return (
Notifications diff --git a/src/frontend/src/components/chatComponent/index.tsx b/src/frontend/src/components/chatComponent/index.tsx index 850837f6b..58c058866 100644 --- a/src/frontend/src/components/chatComponent/index.tsx +++ b/src/frontend/src/components/chatComponent/index.tsx @@ -72,7 +72,7 @@ export default function Chat({ flow }: ChatType) { } prevNodesRef.current = currentNodes; - }, [tabsState, flow.id, nodes]); + }, [tabsState, flow.id]); return ( <> diff --git a/src/frontend/src/components/headerComponent/index.tsx b/src/frontend/src/components/headerComponent/index.tsx index 895f01d79..8f8618eff 100644 --- a/src/frontend/src/components/headerComponent/index.tsx +++ b/src/frontend/src/components/headerComponent/index.tsx @@ -121,7 +121,7 @@ export default function Header() { <>
diff --git a/src/frontend/src/components/ui/separator.tsx b/src/frontend/src/components/ui/separator.tsx index a770af987..1fa0287d8 100644 --- a/src/frontend/src/components/ui/separator.tsx +++ b/src/frontend/src/components/ui/separator.tsx @@ -17,7 +17,7 @@ const Separator = React.forwardRef< decorative={decorative} orientation={orientation} className={cn( - "shrink-0 bg-border", + "shrink-0 bg-ring/40", orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]", className )} diff --git a/src/frontend/src/constants.tsx b/src/frontend/src/constants.tsx index 25c0dc7d5..108b6780b 100644 --- a/src/frontend/src/constants.tsx +++ b/src/frontend/src/constants.tsx @@ -551,10 +551,3 @@ export const NOUNS: string[] = [ * */ export const USER_PROJECTS_HEADER = "My Collection"; -/** - * CSS for highlight HTML - * @constant - * - */ -export const HIGHLIGHT_CSS = - "block pl-3 pr-14 py-2 w-full h-full text-sm outline-0 border-0 break-all overflow-y-hidden max-w-[75vw]"; diff --git a/src/frontend/src/index.css b/src/frontend/src/index.css index 31d48bf77..ca77405a2 100644 --- a/src/frontend/src/index.css +++ b/src/frontend/src/index.css @@ -62,7 +62,7 @@ .dark { --background: 224 35% 7.5%; /* hsl(224 40% 10%) */ - --foreground: 213 31% 85%; /* hsl(213 31% 91%) */ + --foreground: 213 31% 80%; /* hsl(213 31% 91%) */ --muted: 223 27% 11%; /* hsl(223 27% 11%) */ --muted-foreground: 215.4 16.3% 56.9%; /* hsl(215 16% 56%) */ @@ -76,13 +76,13 @@ --border: 216 24% 17%; /* hsl(216 34% 17%) */ --input: 216 24% 17%; /* hsl(216 34% 17%) */ - --primary: 210 20% 80%; /* hsl(210 40% 98%) */ + --primary: 210 20% 80%; /* hsl(210 20% 80%) */ --primary-foreground: 222.2 27.4% 1.2%; /* hsl(222 47% 1%) */ - --secondary: 222.2 47.4% 11.2%; /* hsl(222 47% 11%) */ - --secondary-foreground: 210 40% 98%; /* hsl(210 40% 98%) */ + --secondary: 222.2 37.4% 7.2%; /* hsl(222 47% 11%) */ + --secondary-foreground: 210 40% 80%; /* hsl(210 40% 80%) */ - --accent: 216 24% 17%; /* hsl(216 34% 17%) */ + --accent: 216 24% 20%; /* hsl(216 34% 17%) */ --accent-foreground: 210 30% 98%; /* hsl(210 40% 98%) */ --destructive: 0 63% 31%; /* hsl(0 63% 31%) */ @@ -93,7 +93,7 @@ --radius: 0.5rem; --round-btn-shadow: #00000063; - + --success-background: #022c22; --success-foreground: #ecfdf5; @@ -925,13 +925,16 @@ The cursor: default; property value restores the browser's default cursor style } .form-modal-lock-true { - @apply bg-input text-black + @apply bg-input text-primary } .form-modal-no-input { - @apply bg-input text-center text-black dark:bg-gray-700 dark:text-gray-300 + @apply bg-input text-center text-primary dark:bg-gray-700 dark:text-gray-300 } .form-modal-lock-false { - @apply bg-white text-black + @apply bg-white text-primary + } + .code-highlight{ + @apply block px-3 py-2 w-full h-full text-sm outline-0 border-0 break-all overflow-y-hidden } .form-modal-lockchat { @apply form-input focus:ring-ring focus:border-ring block w-full rounded-md border-border p-4 pr-16 custom-scroll sm:text-sm @@ -1084,5 +1087,9 @@ The cursor: default; property value restores the browser's default cursor style @apply font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 } + .chat-message-highlight { + @apply px-0.5 rounded-md bg-indigo-100 dark:bg-indigo-900 + } + } diff --git a/src/frontend/src/modals/formModal/chatMessage/index.tsx b/src/frontend/src/modals/formModal/chatMessage/index.tsx index 7737a171b..8cbf0877c 100644 --- a/src/frontend/src/modals/formModal/chatMessage/index.tsx +++ b/src/frontend/src/modals/formModal/chatMessage/index.tsx @@ -150,8 +150,8 @@ export default function ChatMessage({
) : ( -
- {template && ( +
+ {template ? ( <> - {promptOpen && - template?.split("\n")?.map((line, index) => { - const regex = /{([^}]+)}/g; - let match; - let parts = []; - let lastIndex = 0; - while ((match = regex.exec(line)) !== null) { - // Push text up to the match - if (match.index !== lastIndex) { - parts.push(line.substring(lastIndex, match.index)); - } - // Push div with matched text - if (chat.message[match[1]]) { - parts.push( - - {chat.message[match[1]]} - - ); - } + {promptOpen + ? template?.split("\n")?.map((line, index) => { + const regex = /{([^}]+)}/g; + let match; + let parts = []; + let lastIndex = 0; + while ((match = regex.exec(line)) !== null) { + // Push text up to the match + if (match.index !== lastIndex) { + parts.push(line.substring(lastIndex, match.index)); + } + // Push div with matched text + if (chat.message[match[1]]) { + parts.push( + + {chat.message[match[1]]} + + ); + } - // Update last index - lastIndex = regex.lastIndex; - } - // Push text after the last match - if (lastIndex !== line.length) { - parts.push(line.substring(lastIndex)); - } - return

{parts}

; - })} + // Update last index + lastIndex = regex.lastIndex; + } + // Push text after the last match + if (lastIndex !== line.length) { + parts.push(line.substring(lastIndex)); + } + return

{parts}

; + }) + : chat.message[chat.chatKey]}
+ ) : ( + {chat.message[chat.chatKey]} )} -
- {chat.message[chat.chatKey]}
)}
diff --git a/src/frontend/src/modals/formModal/index.tsx b/src/frontend/src/modals/formModal/index.tsx index e17c6c2e9..56e79979a 100644 --- a/src/frontend/src/modals/formModal/index.tsx +++ b/src/frontend/src/modals/formModal/index.tsx @@ -50,7 +50,7 @@ export default function FormModal({ const handleKeys = formKeysData.handle_keys; const keyToUse = Object.keys(inputKeys).find( - (k) => !handleKeys.some((j) => j === k) + (k) => !handleKeys.some((j) => j === k) && inputKeys[k] === "" ); return inputKeys[keyToUse]; @@ -73,7 +73,9 @@ export default function FormModal({ const tabsStateFlowIdFormKeysData = tabsStateFlowId.formKeysData; const [chatKey, setChatKey] = useState( Object.keys(tabsState[flow.id].formKeysData.input_keys).find( - (k) => !tabsState[flow.id].formKeysData.handle_keys.some((j) => j === k) + (k) => + !tabsState[flow.id].formKeysData.handle_keys.some((j) => j === k) && + tabsState[flow.id].formKeysData.input_keys[k] === "" ) ); @@ -381,6 +383,9 @@ export default function FormModal({ if (checked === true) { setChatKey(i); setChatValue(tabsState[flow.id].formKeysData.input_keys[i]); + } else { + setChatKey(null); + setChatValue(""); } } return ( diff --git a/src/frontend/src/modals/genericModal/index.tsx b/src/frontend/src/modals/genericModal/index.tsx index 1f7335fd8..b61ebcab6 100644 --- a/src/frontend/src/modals/genericModal/index.tsx +++ b/src/frontend/src/modals/genericModal/index.tsx @@ -4,21 +4,9 @@ import SanitizedHTMLWrapper from "../../components/SanitizedHTMLWrapper"; import ShadTooltip from "../../components/ShadTooltipComponent"; import { Badge } from "../../components/ui/badge"; import { Button } from "../../components/ui/button"; -import { - Dialog, - DialogContent, - DialogDescription, - DialogFooter, - DialogHeader, - DialogTitle, - DialogTrigger, -} from "../../components/ui/dialog"; +import { DialogTitle } from "../../components/ui/dialog"; import { Textarea } from "../../components/ui/textarea"; -import { - HIGHLIGHT_CSS, - PROMPT_DIALOG_SUBTITLE, - TEXT_DIALOG_SUBTITLE, -} from "../../constants"; +import { PROMPT_DIALOG_SUBTITLE, TEXT_DIALOG_SUBTITLE } from "../../constants"; import { alertContext } from "../../contexts/alertContext"; import { darkContext } from "../../contexts/darkContext"; import { PopUpContext } from "../../contexts/popUpContext"; @@ -32,6 +20,7 @@ import { regexHighlight, varHighlightHTML, } from "../../utils"; +import BaseModal from "../baseModal"; export default function GenericModal({ field_name = "", @@ -119,7 +108,7 @@ export default function GenericModal({ const TextAreaContentView = () => { return ( { setIsEdit(true); @@ -166,133 +155,138 @@ export default function GenericModal({ } return ( - - - - - - {myModalTitle} - - - {(() => { - switch (myModalTitle) { - case "Edit Text": - return TEXT_DIALOG_SUBTITLE; + + { + switch (myModalTitle) { + case "Edit Text": + return TEXT_DIALOG_SUBTITLE; - case "Edit Prompt": - return PROMPT_DIALOG_SUBTITLE; + case "Edit Prompt": + return PROMPT_DIALOG_SUBTITLE; - default: - return null; - } - })()} - - -
- {type === TypeModal.PROMPT && isEdit ? ( -