diff --git a/src/frontend/src/components/ui/badge.tsx b/src/frontend/src/components/ui/badge.tsx new file mode 100644 index 000000000..d8f6ca740 --- /dev/null +++ b/src/frontend/src/components/ui/badge.tsx @@ -0,0 +1,35 @@ +import * as React from "react"; +import { cva, type VariantProps } from "class-variance-authority"; +import { cn } from "../../utils"; + +const badgeVariants = cva( + "inline-flex items-center border rounded-full px-2.5 h-6 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", + { + variants: { + variant: { + default: + "bg-primary hover:bg-primary/80 border-transparent text-primary-foreground", + secondary: + "bg-secondary hover:bg-secondary/80 border-transparent text-secondary-foreground", + destructive: + "bg-destructive hover:bg-destructive/80 border-transparent text-destructive-foreground", + outline: "text-foreground", + }, + }, + defaultVariants: { + variant: "default", + }, + } +); + +export interface BadgeProps + extends React.HTMLAttributes, + VariantProps {} + +function Badge({ className, variant, ...props }: BadgeProps) { + return ( +
+ ); +} + +export { Badge, badgeVariants }; diff --git a/src/frontend/src/components/ui/card.tsx b/src/frontend/src/components/ui/card.tsx index a5e794a60..7c63ef2ed 100644 --- a/src/frontend/src/components/ui/card.tsx +++ b/src/frontend/src/components/ui/card.tsx @@ -8,7 +8,7 @@ const Card = React.forwardRef<
(({ className, ...props }, ref) => (
)); @@ -59,7 +59,7 @@ const CardContent = React.forwardRef< HTMLDivElement, React.HTMLAttributes >(({ className, ...props }, ref) => ( -
+
)); CardContent.displayName = "CardContent"; @@ -69,7 +69,7 @@ const CardFooter = React.forwardRef< >(({ className, ...props }, ref) => (
)); diff --git a/src/frontend/src/components/ui/rename-label.tsx b/src/frontend/src/components/ui/rename-label.tsx index 9f9a69137..1ee79808b 100644 --- a/src/frontend/src/components/ui/rename-label.tsx +++ b/src/frontend/src/components/ui/rename-label.tsx @@ -7,9 +7,14 @@ export default function RenameLabel(props) { ? [props.rename, props.setRename] : [internalState, setInternalState]; + useEffect(() => { + if (props.value) setMyValue(props.value); + }, [props.value]); + const [myValue, setMyValue] = useState(props.value); useEffect(() => { if (isRename) { + setMyValue(props.value); document.addEventListener("keydown", (e) => { if (e.key === "Escape") { setIsRename(false); diff --git a/src/frontend/src/pages/MainPage/index.tsx b/src/frontend/src/pages/MainPage/index.tsx index b341275de..b247253b3 100644 --- a/src/frontend/src/pages/MainPage/index.tsx +++ b/src/frontend/src/pages/MainPage/index.tsx @@ -17,6 +17,7 @@ import { PopUpContext } from "../../contexts/popUpContext"; import { typesContext } from "../../contexts/typesContext"; import { ArrowDownTrayIcon, + ArrowTopRightOnSquareIcon, ArrowUpTrayIcon, ChevronDownIcon, CodeBracketSquareIcon, @@ -44,11 +45,15 @@ import { FaGithub } from "react-icons/fa"; import { Card, CardContent, + CardDescription, CardFooter, CardHeader, CardTitle, } from "../../components/ui/card"; import RenameLabel from "../../components/ui/rename-label"; +import _ from "lodash"; +import { Badge } from "../../components/ui/badge"; +import { OpenAiIcon } from "../../icons/OpenAi"; export default function HomePage() { const { @@ -61,6 +66,7 @@ export default function HomePage() { downloadFlow, } = useContext(TabsContext); const { openPopUp } = useContext(PopUpContext); + const { updateFlow } = useContext(TabsContext); const { templates } = useContext(typesContext); const AlertWidth = 384; const { dark, setDark } = useContext(darkContext); @@ -89,7 +95,13 @@ export default function HomePage() { {}} + setValue={(value) => { + if (value !== "") { + let newFlow = _.cloneDeep(flows[tabIndex]); + newFlow.name = value; + updateFlow(newFlow); + } + }} rename={rename} setRename={setRename} /> @@ -251,28 +263,60 @@ export default function HomePage() { {flows.map((flow, idx) => ( - - {flow.name} + +
+ + {idx === 0 ? "🤖" : "🛠️"} + + {flow.name} +
+ + {/* {flow.description} */} + {idx === 0 ? "This is a new agent" : "This is a new tool"} +
+ - +
+
+ + {idx === 0 ? "Agent" : "Tool"} + + {idx === 0 && ( + +
+ +
+  OpenAI+ +
+ )} +
+ +
))}