🔨 refactor(chatComponent): remove unused import of ChatModal to improve code cleanliness

🔨 refactor(chatComponent): update code to correctly access template value from node data

🔨 refactor(chatInput): update button styling and positioning

🔨 refactor(chatInput): update Lock icon styling and positioning

🔨 refactor(chatInput): update Send icon styling and positioning

🔨 refactor(formModal): update setKeysValue function to correctly update the value at a specific index in the array
This commit is contained in:
Lucas Oliveira 2023-06-28 11:51:21 -03:00
commit c76b8766c0
3 changed files with 7 additions and 7 deletions

View file

@ -3,7 +3,6 @@ import { useNodes } from "reactflow";
import { ChatType } from "../../types/chat"; import { ChatType } from "../../types/chat";
import ChatTrigger from "./chatTrigger"; import ChatTrigger from "./chatTrigger";
import BuildTrigger from "./buildTrigger"; import BuildTrigger from "./buildTrigger";
import ChatModal from "../../modals/chatModal";
import { getBuildStatus } from "../../controllers/API"; import { getBuildStatus } from "../../controllers/API";
import { NodeType } from "../../types/flow"; import { NodeType } from "../../types/flow";
@ -45,10 +44,11 @@ export default function Chat({ flow }: ChatType) {
const prevNodesRef = useRef<any[] | undefined>(); const prevNodesRef = useRef<any[] | undefined>();
const nodes = useNodes(); const nodes = useNodes();
useEffect(() => { useEffect(() => {
const prevNodes = prevNodesRef.current; const prevNodes = prevNodesRef.current;
const currentNodes = nodes.map( const currentNodes = nodes.map(
(node: NodeType) => node.data.node.template.value (node: NodeType) => node.data.node.template
); );
if ( if (
prevNodes && prevNodes &&

View file

@ -59,15 +59,15 @@ export default function ChatInput({
placeholder={"Send a message..."} placeholder={"Send a message..."}
/> />
<div className="absolute bottom-2 right-4"> <div className="absolute bottom-2 right-4">
<button className={classNames("p-2 pl-1 pr-3 transition-all duration-300 rounded-md",chatValue == "" ? "text-primary" : " bg-indigo-600 text-background")} disabled={lockChat} onClick={() => sendMessage()}> <button className={classNames("p-2 px-1 transition-all duration-300 rounded-md",chatValue == "" ? "text-primary" : " bg-indigo-600 text-background")} disabled={lockChat} onClick={() => sendMessage()}>
{lockChat ? ( {lockChat ? (
<Lock <Lock
className="h-5 w-5 text-primary animate-pulse" className="h-5 w-5 ml-1 mr-11 animate-pulse"
aria-hidden="true" aria-hidden="true"
/> />
) : ( ) : (
<LucideSend <LucideSend
className="h-5 w-5 rotate-[44deg] " className="h-5 w-5 mr-2 rotate-[44deg] "
aria-hidden="true" aria-hidden="true"
/> />
)} )}

View file

@ -414,7 +414,7 @@ export default function FormModal({
<Textarea <Textarea
value={keysValue[k]} value={keysValue[k]}
onChange={(e) => onChange={(e) =>
setKeysValue({ ...keysValue, [k]: e.target.value }) setKeysValue((old) => [...old.slice(0, k), e.target.value, ...old.slice(k + 1)])
} }
disabled={chatKey === k} disabled={chatKey === k}
placeholder="Enter text..." placeholder="Enter text..."