-
Notifications
You must be signed in to change notification settings - Fork 1
update camel tool and header #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
import { motion } from "framer-motion" | ||
|
||
import SwipeCard from "./swipe.card" | ||
export function Header() { | ||
return ( | ||
<header className="pt-32 pb-16 text-center"> | ||
<div className="flex flex-col sm:flex-row md:flex-row lg:flex-row xl:flex-row 2xl:flex-row items-center justify-center text-6xl font-bold mb-6"> | ||
<motion.div | ||
className="flex flex-col sm:flex-row md:flex-row lg:flex-row xl:flex-row 2xl:flex-row items-center gap-2" | ||
layout | ||
transition={{ type: "spring", damping: 30, stiffness: 400 }} | ||
> | ||
<motion.span | ||
<header className="pt-22 pb-8"> | ||
<div className="flex flex-col lg:flex-row items-center justify-between flex-1 w-full max-w-[1600px] mx-auto py-8"> | ||
{/* Left: Text Content */} | ||
<div className="flex-1 min-w-0 text-center mb-8 lg:mb-0 lg:w-1/2"> | ||
<div className="text-6xl font-bold mb-6"> | ||
<motion.div | ||
className="flex flex-col gap-2 items-center" | ||
layout | ||
transition={{ type: "spring", damping: 30, stiffness: 400 }} | ||
> | ||
CAMEL with MCP | ||
</motion.span> | ||
</motion.div> | ||
<motion.span | ||
layout | ||
transition={{ type: "spring", damping: 30, stiffness: 400 }} | ||
> | ||
CAMEL with MCP | ||
</motion.span> | ||
</motion.div> | ||
</div> | ||
<p className="text-lg text-muted-foreground max-w-3xl mx-auto"> | ||
Discover and compare Model Context Protocol Servers to build your Agents | ||
</p> | ||
</div> | ||
|
||
<p className="text-lg text-muted-foreground max-w-3xl mx-auto"> | ||
Discover and compare Model Context Protocol Servers to build your Agents | ||
</p> | ||
</header> | ||
{/* Right: Blog Thumbnail Card */} | ||
<div className="flex-1 min-w-0 lg:w-1/2 flex items-center justify-center"> | ||
<SwipeCard /> | ||
</div> | ||
</div> | ||
</header> | ||
) | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import { motion, useMotionValue, useTransform } from "framer-motion"; | ||
import Image from "next/image"; | ||
|
||
interface BlogCardData { | ||
id: number; | ||
src: string; | ||
title: string; | ||
description: string; | ||
link: string; | ||
} | ||
|
||
const blogCards: BlogCardData[] = [ | ||
{ | ||
id: 1, | ||
src: "/camel-ai-agent-mcp-integration.png", | ||
title: "How to Connect Your CAMEL-AI Agent to External Tools via MCP", | ||
description: "Seamlessly integrate databases, APIs, and web services into your CAMEL-AI agents using the Model Context Protocol.", | ||
link: "https://www.camel-ai.org/blogs/camel-ai-agent-mcp-integration", | ||
}, | ||
{ | ||
id: 2, | ||
src: "/connect-your-owl-agent-to-notion-via-the-mcp-server.png", | ||
title: "How to Connect Your OWL Agent to Notion via the MCP Server", | ||
description: "Empower your CAMEL-AI OWL agent to interact with Notion using the MCP server.", | ||
link: "https://www.camel-ai.org/blogs/connect-your-owl-agent-to-notion-via-the-mcp-server", | ||
}, | ||
{ | ||
id: 3, | ||
src: "/camel-mcp-servers-model-context-protocol-ai-agents.png", | ||
title: "CAMEL x MCP: Making AI Agents Accessible to All Tools", | ||
description: "A lightweight server that exports Camel framework toolkits as MCP-compatible tools.", | ||
link: "https://www.camel-ai.org/blogs/camel-mcp-servers-model-context-protocol-ai-agents", | ||
}, | ||
]; | ||
|
||
const ArrowButton = ({ direction, onClick }: { direction: 'left' | 'right', onClick: () => void }) => ( | ||
<button | ||
onClick={onClick} | ||
aria-label={direction === 'left' ? 'Previous card' : 'Next card'} | ||
className="mx-2 p-2 rounded-full bg-card border shadow hover:bg-muted transition-colors focus:outline-none focus:ring-2 focus:ring-primary" | ||
type="button" | ||
> | ||
{direction === 'left' ? ( | ||
<svg width="24" height="24" fill="none" stroke="currentColor" strokeWidth="2" viewBox="0 0 24 24"><path d="M15 19l-7-7 7-7"/></svg> | ||
) : ( | ||
<svg width="24" height="24" fill="none" stroke="currentColor" strokeWidth="2" viewBox="0 0 24 24"><path d="M9 5l7 7-7 7"/></svg> | ||
)} | ||
</button> | ||
); | ||
|
||
const SwipeCards = () => { | ||
const [cards, setCards] = useState<BlogCardData[]>(blogCards); | ||
|
||
// Auto-rotate cards effect | ||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
if (cards.length > 0) { | ||
setCards(prevCards => { | ||
const newCards = [...prevCards]; | ||
const lastCard = newCards.pop(); | ||
if (lastCard) { | ||
newCards.unshift(lastCard); | ||
} | ||
return newCards; | ||
}); | ||
} | ||
}, 10000); | ||
|
||
return () => clearInterval(interval); | ||
}, [cards]); | ||
|
||
// Manual navigation handlers | ||
const handlePrev = () => { | ||
setCards(prevCards => { | ||
if (prevCards.length === 0) return prevCards; | ||
const newCards = [...prevCards]; | ||
const firstCard = newCards.shift(); | ||
if (firstCard) { | ||
newCards.push(firstCard); | ||
} | ||
return newCards; | ||
}); | ||
}; | ||
|
||
const handleNext = () => { | ||
setCards(prevCards => { | ||
if (prevCards.length === 0) return prevCards; | ||
const newCards = [...prevCards]; | ||
const lastCard = newCards.pop(); | ||
if (lastCard) { | ||
newCards.unshift(lastCard); | ||
} | ||
return newCards; | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className="relative w-full h-[350px] flex flex-col items-center justify-center"> | ||
<div className="relative w-full h-full flex items-center justify-center"> | ||
{cards.map((card) => ( | ||
<BlogSwipeCard key={card.id} cards={cards} setCards={setCards} {...card} /> | ||
))} | ||
</div> | ||
<div className="flex items-center justify-center mt-12"> | ||
<ArrowButton direction="left" onClick={handlePrev} /> | ||
<ArrowButton direction="right" onClick={handleNext} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const BlogSwipeCard = ({ id, src, title, description, link, setCards, cards }: BlogCardData & { | ||
setCards: React.Dispatch<React.SetStateAction<BlogCardData[]>>; | ||
cards: BlogCardData[]; | ||
}) => { | ||
const x = useMotionValue(0); | ||
const rotateRaw = useTransform(x, [-150, 150], [-18, 18]); | ||
const opacity = useTransform(x, [-150, 0, 150], [0, 1, 0]); | ||
|
||
const isFront = id === cards[cards.length - 1].id; | ||
|
||
const rotate = useTransform(() => { | ||
const offset = isFront ? 0 : id % 2 ? 6 : -6; | ||
return `${rotateRaw.get() + offset}deg`; | ||
}); | ||
|
||
const handleDragEnd = () => { | ||
if (Math.abs(x.get()) > 100) { | ||
setCards((prevCards: BlogCardData[]) => { | ||
const filtered = prevCards.filter((card: BlogCardData) => card.id !== id); | ||
filtered.unshift({ id, src, title, description, link }); | ||
return filtered; | ||
}); | ||
} | ||
}; | ||
|
||
return ( | ||
<motion.div | ||
className="absolute w-full h-full flex items-center justify-center" | ||
style={{ | ||
x, | ||
opacity, | ||
rotate, | ||
zIndex: isFront ? 1 : 0, | ||
transition: "0.125s transform", | ||
}} | ||
animate={{ | ||
scale: isFront ? 1 : 0.95, | ||
}} | ||
drag={isFront ? "x" : false} | ||
dragConstraints={{ | ||
left: 0, | ||
right: 0, | ||
}} | ||
onDragEnd={handleDragEnd} | ||
> | ||
<div className="flex-shrink-0 w-full max-w-xs lg:max-w-sm"> | ||
<a | ||
href={link} | ||
className="block bg-card rounded-xl shadow-lg overflow-hidden border p-4 transition-all duration-300 hover:border-secondary focus:border-primary outline-none" | ||
tabIndex={0} | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
<div className="relative w-full h-48 rounded-lg"> | ||
<Image | ||
src={src} | ||
alt={title} | ||
fill | ||
style={{ objectFit: 'cover', borderRadius: '0.5rem' }} | ||
priority={isFront} | ||
/> | ||
</div> | ||
<div className="mt-4"> | ||
<h3 className="text-xl font-semibold mb-2">{title}</h3> | ||
</div> | ||
</a> | ||
</div> | ||
</motion.div> | ||
); | ||
}; | ||
|
||
export default SwipeCards; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
[ | ||
{ | ||
"name": "camel-tool", | ||
"key": "camel-tool", | ||
"description": "add description here", | ||
"name": "Camel Toolkits", | ||
"key": "camel-toolkits", | ||
"description": "A lightweight server that exports Camel framework toolkits as MCP-compatible tools.", | ||
"command": "uvx", | ||
"args": ["add args here"], | ||
"args": ["camel-toolkits-mcp"], | ||
"env": { | ||
"add env name here": "add env value here" | ||
"OPENAI_API_KEY": "apiKey@string::Your-OpenAI-API-Key", | ||
"NOTION_TOKEN": "token@string::Your-Notion-Token" | ||
}, | ||
"homepage": "https://github.com/camel-ai/mcp-hub" | ||
"homepage": "https://github.com/camel-ai/Camel-toolkits-mcp" | ||
} | ||
] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The auto-rotate interval is recreated on every change to 'cards' due to its dependency array including 'cards'. Consider using an empty dependency array along with a functional state update or a ref to avoid unnecessary interval re-creations.
Copilot uses AI. Check for mistakes.