import React, { useState } from "react"; import { BsArrowsAngleExpand, BsArrowsAngleContract } from "react-icons/bs"; import { motion, AnimatePresence } from "framer-motion"; import { Prompt } from "../../../hooks/usePrompts"; import DashboardChatArea from './DashboardChatArea/DashboardChatArea'; import DashboardChatHistory from './DashboardChatHistory/DashboardChatHistory'; import styles from './DashboardChat.module.css'; interface DashboardChatProps { isExpanded: boolean; onToggleExpand: () => void; selectedPrompt?: Prompt | null; onPromptUsed?: () => void; onWorkflowIdChange?: (workflowId: string | null) => void; onWorkflowResume?: (workflowId: string) => void; } const DashboardChat: React.FC = ({ isExpanded, onToggleExpand, selectedPrompt, onPromptUsed, onWorkflowIdChange, onWorkflowResume }) => { const [activeTab, setActiveTab] = useState("Chat Area"); const [resumeWorkflowId, setResumeWorkflowId] = useState(null); const handleWorkflowResume = (workflowId: string) => { // Switch to Chat Area tab first setActiveTab("Chat Area"); // Set the workflow ID to resume setResumeWorkflowId(workflowId); // Then call the parent's resume handler if (onWorkflowResume) { onWorkflowResume(workflowId); } // Clear the resume ID after a short delay to allow processing setTimeout(() => { setResumeWorkflowId(null); }, 100); }; return (
{["Chat Area", "Workflow History"].map((tab) => (
setActiveTab(tab)} whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.98 }} > {tab} {activeTab === tab && ( )}
))}
{isExpanded ? : }
{activeTab === "Chat Area" ? ( ) : ( )}
); }; export default DashboardChat;