diff --git a/src/interface/web/app/components/suggestions/suggestionCard.tsx b/src/interface/web/app/components/suggestions/suggestionCard.tsx index 50127d510..173a8c29f 100644 --- a/src/interface/web/app/components/suggestions/suggestionCard.tsx +++ b/src/interface/web/app/components/suggestions/suggestionCard.tsx @@ -20,7 +20,7 @@ interface StepTwoSuggestionCardProps { } export function StepOneSuggestionCard(data: StepOneSuggestionCardProps) { - const cardClassName = `${styles.card} md:w-full md:h-fit sm:w-full h-fit md:w-[200px] cursor-pointer md:p-2 animate-fade-in-up`; + const cardClassName = `${styles.card} md:w-full md:h-fit sm:w-full h-fit md:w-[200px] cursor-pointer md:p-2`; const descriptionClassName = `${styles.text} dark:text-white`; const cardContent = ( diff --git a/src/interface/web/app/page.tsx b/src/interface/web/app/page.tsx index f7e669a9d..40e24a821 100644 --- a/src/interface/web/app/page.tsx +++ b/src/interface/web/app/page.tsx @@ -3,7 +3,7 @@ import "./globals.css"; import styles from "./page.module.css"; import "katex/dist/katex.min.css"; -import React, { useEffect, useRef, useState } from "react"; +import React, { useEffect, useRef, useState, useMemo } from "react"; import useSWR from "swr"; import { ArrowsVertical } from "@phosphor-icons/react"; @@ -60,6 +60,104 @@ interface ChatBodyDataProps { isLoadingUserConfig: boolean; } +function AgentCards({ + agents, + agentIcons, + selectedAgent, + isPopoverOpen, + debouncedHoveredAgent, + setHoveredAgent, + setIsPopoverOpen, + setSelectedAgent, + chatInputRef, + openAgentEditCard, + userConfig, + isMobileWidth, +}: { + agents: AgentData[]; + agentIcons: JSX.Element[]; + selectedAgent: string | null; + isPopoverOpen: boolean; + debouncedHoveredAgent: string | null; + setHoveredAgent: (agent: string | null) => void; + setIsPopoverOpen: (open: boolean) => void; + setSelectedAgent: (agent: string | null) => void; + chatInputRef: React.RefObject; + openAgentEditCard: (slug: string) => void; + userConfig: UserConfig | null; + isMobileWidth?: boolean; +}) { + return ( + +
+ {agents.map((agent, index) => ( + { + if (!open) { + setHoveredAgent(null); + setIsPopoverOpen(false); + } + }} + > + + openAgentEditCard(agent.slug)} + onClick={() => { + setSelectedAgent(agent.slug); + chatInputRef.current?.focus(); + setHoveredAgent(null); + setIsPopoverOpen(false); + }} + onMouseEnter={() => setHoveredAgent(agent.slug)} + onMouseLeave={() => { + setHoveredAgent(null); + setIsPopoverOpen(false); + }} + > + + {agentIcons[index]} {agent.name} + + + + { + setHoveredAgent(null); + setIsPopoverOpen(false); + }} + > + {}} + modelOptions={[]} + inputToolOptions={{}} + outputModeOptions={{}} + /> + + + ))} +
+ +
+ ); +} + function ChatBodyData(props: ChatBodyDataProps) { const [message, setMessage] = useState(""); const [prefillMessage, setPrefillMessage] = useState(""); @@ -223,73 +321,19 @@ function ChatBodyData(props: ChatBodyDataProps) { {!props.isMobileWidth && ( - -
- {agents.map((agent, index) => ( - { - if (!open) { - setHoveredAgent(null); - setIsPopoverOpen(false); - } - }} - > - - openAgentEditCard(agent.slug)} - onClick={() => { - setSelectedAgent(agent.slug); - chatInputRef.current?.focus(); - setHoveredAgent(null); - setIsPopoverOpen(false); - }} - onMouseEnter={() => setHoveredAgent(agent.slug)} - onMouseLeave={() => { - setHoveredAgent(null); - setIsPopoverOpen(false); - }} - > - - {agentIcons[index]} {agent.name} - - - - { - setHoveredAgent(null); - setIsPopoverOpen(false); - }} - > - {}} - modelOptions={[]} - inputToolOptions={{}} - outputModeOptions={{}} - /> - - - ))} -
- -
+ )}