mirror of
https://gitee.com/wanwujie/deer-flow
synced 2026-04-22 05:34:45 +08:00
feat: implement the first version of landing page
This commit is contained in:
@@ -0,0 +1,652 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Folder,
|
||||
FileText,
|
||||
Search,
|
||||
Globe,
|
||||
Check,
|
||||
Sparkles,
|
||||
Terminal,
|
||||
Play,
|
||||
} from "lucide-react";
|
||||
import { motion, AnimatePresence } from "motion/react";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
|
||||
type AnimationPhase =
|
||||
| "idle"
|
||||
| "user-input"
|
||||
| "scanning"
|
||||
| "load-skill"
|
||||
| "load-template"
|
||||
| "researching"
|
||||
| "load-frontend"
|
||||
| "building"
|
||||
| "load-deploy"
|
||||
| "deploying"
|
||||
| "done";
|
||||
|
||||
interface FileItem {
|
||||
name: string;
|
||||
type: "folder" | "file";
|
||||
indent: number;
|
||||
highlight?: boolean;
|
||||
active?: boolean;
|
||||
done?: boolean;
|
||||
dragging?: boolean;
|
||||
}
|
||||
|
||||
const searchSteps = [
|
||||
{ type: "search", text: "mRNA lipid nanoparticle delivery 2024" },
|
||||
{ type: "fetch", text: "nature.com/articles/s41587-024..." },
|
||||
{ type: "search", text: "LNP ionizable lipids efficiency" },
|
||||
{ type: "fetch", text: "pubs.acs.org/doi/10.1021/..." },
|
||||
{ type: "search", text: "targeted mRNA tissue-specific" },
|
||||
];
|
||||
|
||||
// Animation duration configuration - adjust the duration for each step here
|
||||
const ANIMATION_DELAYS = {
|
||||
"user-input": 0, // User input phase duration (milliseconds)
|
||||
scanning: 2000, // Scanning phase duration
|
||||
"load-skill": 1500, // Load skill phase duration
|
||||
"load-template": 1200, // Load template phase duration
|
||||
researching: 800, // Researching phase duration
|
||||
"load-frontend": 800, // Load frontend phase duration
|
||||
building: 1200, // Building phase duration
|
||||
"load-deploy": 2500, // Load deploy phase duration
|
||||
deploying: 1200, // Deploying phase duration
|
||||
done: 2500, // Done phase duration (final step)
|
||||
} as const;
|
||||
|
||||
export default function ProgressiveSkillsAnimation() {
|
||||
const [phase, setPhase] = useState<AnimationPhase>("idle");
|
||||
const [searchIndex, setSearchIndex] = useState(0);
|
||||
const [buildIndex, setBuildIndex] = useState(0);
|
||||
const [, setChatMessages] = useState<React.ReactNode[]>([]);
|
||||
const [, setShowWorkspace] = useState(false);
|
||||
const [isPlaying, setIsPlaying] = useState(false);
|
||||
const [hasPlayed, setHasPlayed] = useState(false);
|
||||
const [hasAutoPlayed, setHasAutoPlayed] = useState(false);
|
||||
const chatMessagesRef = useRef<HTMLDivElement>(null);
|
||||
const containerRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// Additional display duration after the final step (done) completes, used to show the final result
|
||||
const FINAL_DISPLAY_DURATION = 3000; // milliseconds
|
||||
|
||||
// Play animation only when isPlaying is true
|
||||
useEffect(() => {
|
||||
if (!isPlaying) return;
|
||||
|
||||
const timeline = [
|
||||
{ phase: "user-input" as const, delay: ANIMATION_DELAYS["user-input"] },
|
||||
{ phase: "scanning" as const, delay: ANIMATION_DELAYS.scanning },
|
||||
{ phase: "load-skill" as const, delay: ANIMATION_DELAYS["load-skill"] },
|
||||
{
|
||||
phase: "load-template" as const,
|
||||
delay: ANIMATION_DELAYS["load-template"],
|
||||
},
|
||||
{ phase: "researching" as const, delay: ANIMATION_DELAYS.researching },
|
||||
{
|
||||
phase: "load-frontend" as const,
|
||||
delay: ANIMATION_DELAYS["load-frontend"],
|
||||
},
|
||||
{ phase: "building" as const, delay: ANIMATION_DELAYS.building },
|
||||
{ phase: "load-deploy" as const, delay: ANIMATION_DELAYS["load-deploy"] },
|
||||
{ phase: "deploying" as const, delay: ANIMATION_DELAYS.deploying },
|
||||
{ phase: "done" as const, delay: ANIMATION_DELAYS.done },
|
||||
];
|
||||
|
||||
let totalDelay = 0;
|
||||
const timeouts: NodeJS.Timeout[] = [];
|
||||
|
||||
timeline.forEach(({ phase, delay }) => {
|
||||
totalDelay += delay;
|
||||
timeouts.push(setTimeout(() => setPhase(phase), totalDelay));
|
||||
});
|
||||
|
||||
// Reset after animation completes
|
||||
// Total duration for the final step = ANIMATION_DELAYS["done"] + FINAL_DISPLAY_DURATION
|
||||
timeouts.push(
|
||||
setTimeout(() => {
|
||||
setPhase("idle");
|
||||
setChatMessages([]);
|
||||
setSearchIndex(0);
|
||||
setBuildIndex(0);
|
||||
setShowWorkspace(false);
|
||||
setIsPlaying(false);
|
||||
}, totalDelay + FINAL_DISPLAY_DURATION),
|
||||
);
|
||||
|
||||
return () => timeouts.forEach(clearTimeout);
|
||||
}, [isPlaying]);
|
||||
|
||||
const handlePlay = () => {
|
||||
setIsPlaying(true);
|
||||
setHasPlayed(true);
|
||||
setPhase("idle");
|
||||
setChatMessages([]);
|
||||
setSearchIndex(0);
|
||||
setBuildIndex(0);
|
||||
setShowWorkspace(false);
|
||||
};
|
||||
|
||||
// Auto-play when component enters viewport for the first time
|
||||
useEffect(() => {
|
||||
if (hasAutoPlayed || !containerRef.current) return;
|
||||
|
||||
const containerElement = containerRef.current;
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
entries.forEach((entry) => {
|
||||
if (entry.isIntersecting && !hasAutoPlayed && !isPlaying) {
|
||||
setHasAutoPlayed(true);
|
||||
// Small delay before auto-playing for better UX
|
||||
setTimeout(() => {
|
||||
setIsPlaying(true);
|
||||
setHasPlayed(true);
|
||||
setPhase("idle");
|
||||
setChatMessages([]);
|
||||
setSearchIndex(0);
|
||||
setBuildIndex(0);
|
||||
setShowWorkspace(false);
|
||||
}, 300);
|
||||
}
|
||||
});
|
||||
},
|
||||
{
|
||||
threshold: 0.3, // Trigger when 30% of the component is visible
|
||||
rootMargin: "0px",
|
||||
},
|
||||
);
|
||||
|
||||
observer.observe(containerElement);
|
||||
|
||||
return () => {
|
||||
if (containerElement) {
|
||||
observer.unobserve(containerElement);
|
||||
}
|
||||
};
|
||||
}, [hasAutoPlayed, isPlaying]);
|
||||
|
||||
// Handle search animation
|
||||
useEffect(() => {
|
||||
if (phase === "researching" && searchIndex < searchSteps.length) {
|
||||
const timer = setTimeout(() => {
|
||||
setSearchIndex((i) => i + 1);
|
||||
}, 350);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
}, [phase, searchIndex]);
|
||||
|
||||
// Handle build animation
|
||||
useEffect(() => {
|
||||
if (phase === "building" && buildIndex < 3) {
|
||||
const timer = setTimeout(() => {
|
||||
setBuildIndex((i) => i + 1);
|
||||
}, 600);
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
if (phase === "building") {
|
||||
setShowWorkspace(true);
|
||||
}
|
||||
}, [phase, buildIndex]);
|
||||
|
||||
// Auto scroll chat to bottom when messages change
|
||||
useEffect(() => {
|
||||
if (chatMessagesRef.current && phase !== "idle") {
|
||||
chatMessagesRef.current.scrollTo({
|
||||
top: chatMessagesRef.current.scrollHeight,
|
||||
behavior: "smooth",
|
||||
});
|
||||
}
|
||||
}, [phase, searchIndex, buildIndex]);
|
||||
|
||||
const getFileTree = (): FileItem[] => {
|
||||
const base: FileItem[] = [
|
||||
{
|
||||
name: "deep-search",
|
||||
type: "folder",
|
||||
indent: 0,
|
||||
highlight: phase === "scanning",
|
||||
active: ["load-skill", "load-template", "researching"].includes(phase),
|
||||
done: [
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "SKILL.md",
|
||||
type: "file",
|
||||
indent: 1,
|
||||
highlight: phase === "scanning",
|
||||
dragging: phase === "load-skill",
|
||||
done: [
|
||||
"load-template",
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "biotech.md",
|
||||
type: "file",
|
||||
indent: 1,
|
||||
highlight: phase === "load-template",
|
||||
dragging: phase === "load-template",
|
||||
done: [
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase),
|
||||
},
|
||||
{ name: "computer-science.md", type: "file", indent: 1 },
|
||||
{ name: "physics.md", type: "file", indent: 1 },
|
||||
{
|
||||
name: "frontend-design",
|
||||
type: "folder",
|
||||
indent: 0,
|
||||
highlight: phase === "scanning",
|
||||
active: ["load-frontend", "building"].includes(phase),
|
||||
done: ["building", "load-deploy", "deploying", "done"].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "SKILL.md",
|
||||
type: "file",
|
||||
indent: 1,
|
||||
highlight: phase === "scanning",
|
||||
dragging: phase === "load-frontend",
|
||||
done: ["building", "load-deploy", "deploying", "done"].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "deploy",
|
||||
type: "folder",
|
||||
indent: 0,
|
||||
highlight: phase === "scanning",
|
||||
active: ["load-deploy", "deploying"].includes(phase),
|
||||
done: ["deploying", "done"].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "SKILL.md",
|
||||
type: "file",
|
||||
indent: 1,
|
||||
highlight: phase === "scanning",
|
||||
dragging: phase === "load-deploy",
|
||||
done: ["deploying", "done"].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "scripts",
|
||||
type: "folder",
|
||||
indent: 1,
|
||||
done: ["deploying", "done"].includes(phase),
|
||||
},
|
||||
{
|
||||
name: "deploy.sh",
|
||||
type: "file",
|
||||
indent: 2,
|
||||
done: ["deploying", "done"].includes(phase),
|
||||
},
|
||||
];
|
||||
return base;
|
||||
};
|
||||
|
||||
const workspaceFiles = ["index.html", "index.css", "index.js"];
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={containerRef}
|
||||
className="relative flex h-[calc(100vh-280px)] w-full items-center justify-center overflow-hidden p-8"
|
||||
>
|
||||
{/* Overlay and Play Button */}
|
||||
<AnimatePresence>
|
||||
{!isPlaying && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
className="absolute inset-0 z-50 flex items-center justify-center"
|
||||
>
|
||||
<motion.button
|
||||
initial={{ scale: 0.8, opacity: 0 }}
|
||||
animate={{ scale: 1, opacity: 1 }}
|
||||
exit={{ scale: 0.8, opacity: 0 }}
|
||||
onClick={handlePlay}
|
||||
className="group flex flex-col items-center gap-4 transition-transform hover:scale-105 active:scale-95"
|
||||
>
|
||||
<div className="flex h-24 w-24 items-center justify-center rounded-full bg-white/10 backdrop-blur-md transition-all group-hover:bg-white/20">
|
||||
<Play
|
||||
size={48}
|
||||
className="ml-1 text-white transition-transform group-hover:scale-110"
|
||||
fill="white"
|
||||
/>
|
||||
</div>
|
||||
<span className="text-lg font-medium text-white">
|
||||
{hasPlayed ? "Click to replay" : "Click to play"}
|
||||
</span>
|
||||
</motion.button>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
|
||||
<div className="flex h-full max-h-[700px] w-full max-w-6xl gap-8">
|
||||
{/* Left: File Tree */}
|
||||
<div className="flex flex-1 flex-col">
|
||||
<motion.div
|
||||
className="mb-4 font-mono text-sm text-zinc-500"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
>
|
||||
/mnt/skills/
|
||||
</motion.div>
|
||||
|
||||
<div className="space-y-2">
|
||||
{getFileTree().map((item, index) => (
|
||||
<motion.div
|
||||
key={`${item.name}-${index}`}
|
||||
className={`flex items-center gap-3 text-lg font-medium transition-all duration-300 ${
|
||||
item.done
|
||||
? "text-green-500"
|
||||
: item.dragging
|
||||
? "translate-x-8 scale-105 text-blue-400"
|
||||
: item.active
|
||||
? "text-white"
|
||||
: item.highlight
|
||||
? "text-purple-400"
|
||||
: "text-zinc-600"
|
||||
}`}
|
||||
style={{ paddingLeft: `${item.indent * 24}px` }}
|
||||
animate={
|
||||
item.done
|
||||
? {
|
||||
scale: 1,
|
||||
opacity: 1,
|
||||
}
|
||||
: {}
|
||||
}
|
||||
>
|
||||
{item.type === "folder" ? (
|
||||
<Folder
|
||||
size={20}
|
||||
className={
|
||||
item.done
|
||||
? "text-green-500"
|
||||
: item.highlight
|
||||
? "text-purple-400"
|
||||
: ""
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<FileText
|
||||
size={20}
|
||||
className={
|
||||
item.done
|
||||
? "text-green-500"
|
||||
: item.highlight
|
||||
? "text-purple-400"
|
||||
: ""
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<span>{item.name}</span>
|
||||
{item.done && <Check size={16} className="text-green-500" />}
|
||||
{item.highlight && !item.done && (
|
||||
<Sparkles size={16} className="text-purple-400" />
|
||||
)}
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Right: Chat Interface */}
|
||||
<div className="flex flex-1 flex-col overflow-hidden rounded-2xl border border-zinc-800 bg-zinc-900/50">
|
||||
{/* Chat Header */}
|
||||
<div className="border-b border-zinc-800 p-4">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="h-3 w-3 rounded-full bg-green-500" />
|
||||
<span className="text-sm text-zinc-400">DeerFlow Agent</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Chat Messages */}
|
||||
<div
|
||||
ref={chatMessagesRef}
|
||||
className="flex-1 space-y-4 overflow-y-auto p-6"
|
||||
>
|
||||
{/* User Message */}
|
||||
<AnimatePresence>
|
||||
{phase !== "idle" && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="flex justify-end"
|
||||
>
|
||||
<div className="max-w-[90%] rounded-2xl rounded-tr-sm bg-blue-600 px-5 py-3">
|
||||
<p className="text-base">
|
||||
Research mRNA delivery, build a landing page, deploy to
|
||||
Vercel
|
||||
</p>
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
|
||||
{/* Agent Messages */}
|
||||
<AnimatePresence>
|
||||
{phase !== "idle" && phase !== "user-input" && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 20 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="space-y-3"
|
||||
>
|
||||
{/* Found Skills */}
|
||||
{[
|
||||
"scanning",
|
||||
"load-skill",
|
||||
"load-template",
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase) && (
|
||||
<div className="text-base text-zinc-300">
|
||||
<span className="text-purple-400">✨</span> Found 3 skills
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Researching Section */}
|
||||
{[
|
||||
"load-skill",
|
||||
"load-template",
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase) && (
|
||||
<div className="mt-4">
|
||||
<hr className="mb-3 border-zinc-700" />
|
||||
<div className="mb-3 text-zinc-300">
|
||||
🔬 Researching...
|
||||
</div>
|
||||
<div className="mb-3 space-y-2">
|
||||
{/* Loading SKILL.md */}
|
||||
{[
|
||||
"load-skill",
|
||||
"load-template",
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase) && (
|
||||
<div className="flex items-center gap-2 pl-4 text-zinc-400">
|
||||
<FileText size={16} />
|
||||
<span>Loading deep-search/SKILL.md...</span>
|
||||
</div>
|
||||
)}
|
||||
{/* Loading biotech.md */}
|
||||
{[
|
||||
"load-template",
|
||||
"researching",
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase) && (
|
||||
<div className="flex items-center gap-2 pl-4 text-zinc-400">
|
||||
<FileText size={16} />
|
||||
<span>
|
||||
Found biotech related topic, loading
|
||||
deep-search/biotech.md...
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{/* Search steps */}
|
||||
{phase === "researching" && (
|
||||
<div className="max-h-[180px] space-y-2 overflow-hidden pl-4">
|
||||
{searchSteps.slice(0, searchIndex).map((step, i) => (
|
||||
<motion.div
|
||||
key={i}
|
||||
initial={{ opacity: 0, y: 10 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="flex items-center gap-2 text-sm text-zinc-500"
|
||||
>
|
||||
{step.type === "search" ? (
|
||||
<Search size={14} className="text-blue-400" />
|
||||
) : (
|
||||
<Globe size={14} className="text-green-400" />
|
||||
)}
|
||||
<span className="truncate">{step.text}</span>
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
{[
|
||||
"load-frontend",
|
||||
"building",
|
||||
"load-deploy",
|
||||
"deploying",
|
||||
"done",
|
||||
].includes(phase) && (
|
||||
<div className="max-h-[180px] space-y-2 overflow-hidden pl-4">
|
||||
{searchSteps.map((step, i) => (
|
||||
<motion.div
|
||||
key={i}
|
||||
initial={{ opacity: 0, y: 10 }}
|
||||
animate={{ opacity: 1, y: 0 }}
|
||||
className="flex items-center gap-2 text-sm text-zinc-500"
|
||||
>
|
||||
{step.type === "search" ? (
|
||||
<Search size={14} className="text-blue-400" />
|
||||
) : (
|
||||
<Globe size={14} className="text-green-400" />
|
||||
)}
|
||||
<span className="truncate">{step.text}</span>
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Building */}
|
||||
{["building", "load-deploy", "deploying", "done"].includes(
|
||||
phase,
|
||||
) && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="mt-4"
|
||||
>
|
||||
<hr className="mb-3 border-zinc-700" />
|
||||
<div className="mb-3 text-zinc-300">🔨 Building...</div>
|
||||
<div className="mb-3 flex items-center gap-2 pl-4 text-zinc-400">
|
||||
<FileText size={16} />
|
||||
<span>Loading frontend-design/SKILL.md...</span>
|
||||
</div>
|
||||
<div className="space-y-2 pl-4">
|
||||
{workspaceFiles.slice(0, buildIndex).map((file) => (
|
||||
<motion.div
|
||||
key={file}
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="flex items-center gap-2 text-sm text-green-500"
|
||||
>
|
||||
<FileText size={14} />
|
||||
<span>{file}</span>
|
||||
<Check size={14} />
|
||||
</motion.div>
|
||||
))}
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
{/* Deploying */}
|
||||
{["load-deploy", "deploying", "done"].includes(phase) && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="mt-4"
|
||||
>
|
||||
<hr className="mb-3 border-zinc-700" />
|
||||
<div className="mb-3 text-zinc-300">🚀 Deploying...</div>
|
||||
<div className="mb-3 space-y-2">
|
||||
<div className="flex items-center gap-2 pl-4 text-zinc-400">
|
||||
<FileText size={16} />
|
||||
<span>Loading deploy/SKILL.md...</span>
|
||||
</div>
|
||||
{["deploying", "done"].includes(phase) && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
className="flex items-center gap-2 pl-4 text-zinc-400"
|
||||
>
|
||||
<Terminal size={16} />
|
||||
<span>Executing deploy.sh</span>
|
||||
</motion.div>
|
||||
)}
|
||||
</div>
|
||||
{phase === "done" && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, scale: 0.9 }}
|
||||
animate={{ opacity: 1, scale: 1 }}
|
||||
className="mt-4 rounded-xl border border-green-500/30 bg-green-500/10 p-4"
|
||||
>
|
||||
<div className="text-lg font-medium text-green-500">
|
||||
✅ Live at biotech-startup.vercel.app
|
||||
</div>
|
||||
</motion.div>
|
||||
)}
|
||||
</motion.div>
|
||||
)}
|
||||
</motion.div>
|
||||
)}
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
|
||||
{/* Chat Input (decorative) */}
|
||||
<div className="border-t border-zinc-800 p-4">
|
||||
<div className="rounded-xl bg-zinc-800 px-4 py-3 text-sm text-zinc-500">
|
||||
Ask DeerFlow anything...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
19
frontend/src/components/landing/footer.tsx
Normal file
19
frontend/src/components/landing/footer.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useMemo } from "react";
|
||||
|
||||
export function Footer() {
|
||||
const year = useMemo(() => new Date().getFullYear(), []);
|
||||
return (
|
||||
<footer className="container-md mx-auto mt-32 flex flex-col items-center justify-center">
|
||||
<hr className="from-border/0 to-border/0 m-0 h-px w-full border-none bg-linear-to-r via-white/20" />
|
||||
<div className="text-muted-foreground container flex h-20 flex-col items-center justify-center text-sm">
|
||||
<p className="text-center font-serif text-lg md:text-xl">
|
||||
"Originated from Open Source, give back to Open Source."
|
||||
</p>
|
||||
</div>
|
||||
<div className="text-muted-foreground container mb-8 flex flex-col items-center justify-center text-xs">
|
||||
<p>Licensed under MIT License</p>
|
||||
<p>© {year} DeerFlow</p>
|
||||
</div>
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
76
frontend/src/components/landing/header.tsx
Normal file
76
frontend/src/components/landing/header.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import { StarFilledIcon, GitHubLogoIcon } from "@radix-ui/react-icons";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { NumberTicker } from "@/components/ui/number-ticker";
|
||||
import { env } from "@/env";
|
||||
|
||||
export function Header() {
|
||||
return (
|
||||
<header className="container-md fixed top-0 right-0 left-0 z-20 mx-auto flex h-16 items-center justify-between backdrop-blur-xs">
|
||||
<div className="flex items-center gap-2">
|
||||
<a href="https://github.com/bytedance/deer-flow" target="_blank">
|
||||
<h1 className="font-serif text-xl">DeerFlow</h1>
|
||||
</a>
|
||||
</div>
|
||||
<div className="relative">
|
||||
<div
|
||||
className="pointer-events-none absolute inset-0 z-0 h-full w-full rounded-full opacity-30 blur-2xl"
|
||||
style={{
|
||||
background: "linear-gradient(90deg, #ff80b5 0%, #9089fc 100%)",
|
||||
filter: "blur(16px)",
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
asChild
|
||||
className="group relative z-10"
|
||||
>
|
||||
<a href="https://github.com/bytedance/deer-flow" target="_blank">
|
||||
<GitHubLogoIcon className="size-4" />
|
||||
Star on GitHub
|
||||
{env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true" &&
|
||||
env.GITHUB_OAUTH_TOKEN && <StarCounter />}
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
<hr className="from-border/0 via-border/70 to-border/0 absolute top-16 right-0 left-0 z-10 m-0 h-px w-full border-none bg-linear-to-r" />
|
||||
</header>
|
||||
);
|
||||
}
|
||||
|
||||
async function StarCounter() {
|
||||
let stars = 10000; // Default value
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
"https://api.github.com/repos/bytedance/deer-flow",
|
||||
{
|
||||
headers: env.GITHUB_OAUTH_TOKEN
|
||||
? {
|
||||
Authorization: `Bearer ${env.GITHUB_OAUTH_TOKEN}`,
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
: {},
|
||||
next: {
|
||||
revalidate: 3600,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
if (response.ok) {
|
||||
const data = await response.json();
|
||||
stars = data.stargazers_count ?? stars; // Update stars if API response is valid
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error fetching GitHub stars:", error);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<StarFilledIcon className="size-4 transition-colors duration-300 group-hover:text-yellow-500" />
|
||||
{stars && (
|
||||
<NumberTicker className="font-mono tabular-nums" value={stars} />
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,14 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import { ChevronRightIcon } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
import Galaxy from "@/components/Galaxy";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { FlickeringGrid } from "@/components/ui/flickering-grid";
|
||||
import Galaxy from "@/components/ui/galaxy";
|
||||
import { WordRotate } from "@/components/ui/word-rotate";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function Jumbotron({ className }: { className?: string }) {
|
||||
export function Hero({ className }: { className?: string }) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
@@ -16,30 +17,28 @@ export function Jumbotron({ className }: { className?: string }) {
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="absolute inset-0 z-0 bg-black">
|
||||
<div className="absolute inset-0 z-0 bg-black/40">
|
||||
<Galaxy
|
||||
mouseRepulsion={false}
|
||||
starSpeed={0.2}
|
||||
density={0.6}
|
||||
glowIntensity={0.3}
|
||||
glowIntensity={0.35}
|
||||
twinkleIntensity={0.3}
|
||||
speed={0.5}
|
||||
/>
|
||||
</div>
|
||||
<FlickeringGrid
|
||||
className="absolute inset-0 z-0 translate-y-[2vh] mask-[url(/images/deer.svg)] mask-size-[100vw] mask-center mask-no-repeat md:mask-size-[72vh]"
|
||||
className="absolute inset-0 z-0 mask-[url(/images/deer.svg)] mask-size-[100vw] mask-center mask-no-repeat md:mask-size-[72vh]"
|
||||
squareSize={4}
|
||||
gridGap={4}
|
||||
color={"white"}
|
||||
maxOpacity={0.2}
|
||||
maxOpacity={0.3}
|
||||
flickerChance={0.25}
|
||||
/>
|
||||
<div className="container-md relative z-10 mx-auto flex h-screen flex-col items-center justify-center">
|
||||
<h1 className="flex items-center gap-2 text-4xl font-bold md:text-6xl">
|
||||
<WordRotate
|
||||
words={[
|
||||
"Do Anything",
|
||||
"Learn Anything",
|
||||
"Deep Research",
|
||||
"Collect Data",
|
||||
"Analyze Data",
|
||||
@@ -51,21 +50,28 @@ export function Jumbotron({ className }: { className?: string }) {
|
||||
"Generate Videos",
|
||||
"Generate Songs",
|
||||
"Organize Emails",
|
||||
"Do Anything",
|
||||
"Learn Anything",
|
||||
]}
|
||||
/>{" "}
|
||||
<div>with DeerFlow</div>
|
||||
</h1>
|
||||
<p className="mt-8 scale-105 text-center text-2xl opacity-70">
|
||||
<p
|
||||
className="mt-8 scale-105 text-center text-2xl text-shadow-sm"
|
||||
style={{ color: "rgb(180,180,185)" }}
|
||||
>
|
||||
DeerFlow is an open-source SuperAgent that researches, codes, and
|
||||
<br />
|
||||
creates. With the help of sandboxes, tools and skills, it handles
|
||||
<br />
|
||||
different levels of tasks that could take minutes to hours.
|
||||
</p>
|
||||
<Button className="size-lg mt-8 scale-108" size="lg">
|
||||
<span className="text-md">Get Started with 2.0</span>
|
||||
<ChevronRightIcon className="size-4" />
|
||||
</Button>
|
||||
<Link href="/workspace">
|
||||
<Button className="size-lg mt-8 scale-108" size="lg">
|
||||
<span className="text-md">Get Started with 2.0</span>
|
||||
<ChevronRightIcon className="size-4" />
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
29
frontend/src/components/landing/section.tsx
Normal file
29
frontend/src/components/landing/section.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
export function Section({
|
||||
className,
|
||||
title,
|
||||
subtitle,
|
||||
children,
|
||||
}: {
|
||||
className?: string;
|
||||
title: React.ReactNode;
|
||||
subtitle?: React.ReactNode;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section className={cn("mx-auto flex flex-col py-16", className)}>
|
||||
<header className="flex flex-col items-center justify-between">
|
||||
<div className="mb-4 bg-linear-to-r from-white via-gray-200 to-gray-400 bg-clip-text text-center text-5xl font-bold text-transparent">
|
||||
{title}
|
||||
</div>
|
||||
{subtitle && (
|
||||
<div className="text-muted-foreground text-center text-xl">
|
||||
{subtitle}
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
<main className="mt-4">{children}</main>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { SparklesIcon } from "lucide-react";
|
||||
|
||||
import SpotlightCard from "@/components/ui/spotlight-card";
|
||||
|
||||
import { Section } from "../section";
|
||||
|
||||
export function CaseStudySection({ className }: { className?: string }) {
|
||||
const caseStudies = [
|
||||
{
|
||||
title: "2025 Survey",
|
||||
description:
|
||||
"A 12,000-word research report analyzing 47 papers on brain-inspired chips, covering Intel Loihi 2, IBM NorthPole, and SynSense's edge AI solutions.",
|
||||
},
|
||||
{
|
||||
title: "Indie Hacker's SaaS Landing Page",
|
||||
description:
|
||||
"A fully responsive landing page with hero section, pricing table, testimonials, and Stripe integration — shipped in one conversation.",
|
||||
},
|
||||
{
|
||||
title: "Transformer Architecture Explained",
|
||||
description:
|
||||
"A 25-slide presentation breaking down self-attention, positional encoding, and KV-cache with hand-drawn style diagrams for a university lecture.",
|
||||
},
|
||||
{
|
||||
title: "DeerDeer Explains RAG",
|
||||
description:
|
||||
"A series of 12 illustrations featuring a curious deer mascot explaining Retrieval-Augmented Generation through a library adventure story.",
|
||||
},
|
||||
{
|
||||
title: "AI Weekly: Your Tech Podcast",
|
||||
description:
|
||||
"A 20-minute podcast episode where two AI hosts debate whether AI agents will replace traditional SaaS, based on 5 articles you provided.",
|
||||
},
|
||||
{
|
||||
title: "How Diffusion Models Work",
|
||||
description:
|
||||
"A 3-minute animated explainer video visualizing the denoising process, from pure noise to a generated image, with voiceover narration.",
|
||||
},
|
||||
];
|
||||
return (
|
||||
<Section
|
||||
className={className}
|
||||
title="Case Studies"
|
||||
subtitle="See how DeerFlow is used in the wild"
|
||||
>
|
||||
<div className="mt-8 grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{caseStudies.map((caseStudy) => (
|
||||
<SpotlightCard className="h-64" key={caseStudy.title}>
|
||||
<div className="flex h-full w-full flex-col items-center justify-center">
|
||||
<div className="flex w-75 flex-col gap-4">
|
||||
<div>
|
||||
<SparklesIcon className="text-primary size-8" />
|
||||
</div>
|
||||
<div className="flex flex-col gap-2">
|
||||
<h3 className="text-2xl font-bold">{caseStudy.title}</h3>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{caseStudy.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</SpotlightCard>
|
||||
))}
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
"use client";
|
||||
|
||||
import { GitHubLogoIcon } from "@radix-ui/react-icons";
|
||||
import Link from "next/link";
|
||||
|
||||
import { AuroraText } from "@/components/ui/aurora-text";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
import { Section } from "../section";
|
||||
|
||||
export function CommunitySection() {
|
||||
return (
|
||||
<Section
|
||||
title={
|
||||
<AuroraText colors={["#60A5FA", "#A5FA60", "#A560FA"]}>
|
||||
Join the Community
|
||||
</AuroraText>
|
||||
}
|
||||
subtitle="Contribute brilliant ideas to shape the future of DeerFlow. Collaborate, innovate, and make impacts."
|
||||
>
|
||||
<div className="flex justify-center">
|
||||
<Button className="text-xl" size="lg" asChild>
|
||||
<Link href="https://github.com/bytedance/deer-flow" target="_blank">
|
||||
<GitHubLogoIcon />
|
||||
Contribute Now
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
125
frontend/src/components/landing/sections/sandbox-section.tsx
Normal file
125
frontend/src/components/landing/sections/sandbox-section.tsx
Normal file
@@ -0,0 +1,125 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
AnimatedSpan,
|
||||
Terminal,
|
||||
TypingAnimation,
|
||||
} from "@/components/ui/terminal";
|
||||
|
||||
import { Section } from "../section";
|
||||
|
||||
export function SandboxSection({ className }: { className?: string }) {
|
||||
return (
|
||||
<Section
|
||||
className={className}
|
||||
title="Sandbox"
|
||||
subtitle={
|
||||
<p>
|
||||
We gave DeerFlow a computer. It can execute code, manage files, and
|
||||
run long tasks — all in a secure Docker sandbox
|
||||
</p>
|
||||
}
|
||||
>
|
||||
<div className="mt-8 flex w-full max-w-6xl flex-col items-center gap-12 lg:flex-row lg:gap-16">
|
||||
{/* Left: Terminal */}
|
||||
<div className="w-full flex-1">
|
||||
<Terminal className="h-[360px] w-full">
|
||||
{/* Scene 1: Build a Game */}
|
||||
<TypingAnimation>$ cat requirements.txt</TypingAnimation>
|
||||
<AnimatedSpan delay={800} className="text-zinc-400">
|
||||
pygame==2.5.0
|
||||
</AnimatedSpan>
|
||||
|
||||
<TypingAnimation delay={1200}>
|
||||
$ pip install -r requirements.txt
|
||||
</TypingAnimation>
|
||||
<AnimatedSpan delay={2000} className="text-green-500">
|
||||
✔ Installed pygame
|
||||
</AnimatedSpan>
|
||||
|
||||
<TypingAnimation delay={2400}>
|
||||
$ write game.py --lines 156
|
||||
</TypingAnimation>
|
||||
<AnimatedSpan delay={3200} className="text-blue-500">
|
||||
✔ Written 156 lines
|
||||
</AnimatedSpan>
|
||||
|
||||
<TypingAnimation delay={3600}>
|
||||
$ python game.py --test
|
||||
</TypingAnimation>
|
||||
<AnimatedSpan delay={4200} className="text-green-500">
|
||||
✔ All sprites loaded
|
||||
</AnimatedSpan>
|
||||
<AnimatedSpan delay={4500} className="text-green-500">
|
||||
✔ Physics engine OK
|
||||
</AnimatedSpan>
|
||||
<AnimatedSpan delay={4800} className="text-green-500">
|
||||
✔ 60 FPS stable
|
||||
</AnimatedSpan>
|
||||
|
||||
{/* Scene 2: Data Analysis */}
|
||||
<TypingAnimation delay={5400}>
|
||||
$ curl -O sales-2024.csv
|
||||
</TypingAnimation>
|
||||
<AnimatedSpan delay={6200} className="text-zinc-400">
|
||||
Downloaded 12.4 MB
|
||||
</AnimatedSpan>
|
||||
</Terminal>
|
||||
</div>
|
||||
|
||||
{/* Right: Description */}
|
||||
<div className="w-full flex-1 space-y-6">
|
||||
<div className="space-y-4">
|
||||
<p className="text-sm font-medium tracking-wider text-purple-400 uppercase">
|
||||
Open-source
|
||||
</p>
|
||||
<h2 className="text-4xl font-bold tracking-tight lg:text-5xl">
|
||||
<a
|
||||
href="https://github.com/agent-infra/sandbox"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
AIO Sandbox
|
||||
</a>
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div className="space-y-4 text-lg text-zinc-400">
|
||||
<p>
|
||||
We recommend using{" "}
|
||||
<a
|
||||
href="https://github.com/agent-infra/sandbox"
|
||||
className="underline"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
All-in-One Sandbox
|
||||
</a>{" "}
|
||||
that combines Browser, Shell, File, MCP and VSCode Server in a
|
||||
single Docker container.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Feature Tags */}
|
||||
<div className="flex flex-wrap gap-3 pt-4">
|
||||
<span className="rounded-full border border-zinc-800 bg-zinc-900 px-4 py-2 text-sm text-zinc-300">
|
||||
Isolated
|
||||
</span>
|
||||
<span className="rounded-full border border-zinc-800 bg-zinc-900 px-4 py-2 text-sm text-zinc-300">
|
||||
Safe
|
||||
</span>
|
||||
<span className="rounded-full border border-zinc-800 bg-zinc-900 px-4 py-2 text-sm text-zinc-300">
|
||||
Persistent
|
||||
</span>
|
||||
<span className="rounded-full border border-zinc-800 bg-zinc-900 px-4 py-2 text-sm text-zinc-300">
|
||||
Mountable FS
|
||||
</span>
|
||||
<span className="rounded-full border border-zinc-800 bg-zinc-900 px-4 py-2 text-sm text-zinc-300">
|
||||
Long-running
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
28
frontend/src/components/landing/sections/skills-section.tsx
Normal file
28
frontend/src/components/landing/sections/skills-section.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
"use client";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
import ProgressiveSkillsAnimation from "../components/progressive-skills-animation";
|
||||
import { Section } from "../section";
|
||||
|
||||
export function SkillsSection({ className }: { className?: string }) {
|
||||
return (
|
||||
<Section
|
||||
className={cn("h-[calc(100vh-64px)] w-full bg-white/7", className)}
|
||||
title="Skill-based Architecture"
|
||||
subtitle={
|
||||
<div>
|
||||
Skills are loaded progressively — only what's needed, when
|
||||
it's needed.
|
||||
<br />
|
||||
Extend DeerFlow with your own skill files, or use our built-in
|
||||
library.
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="relative overflow-hidden">
|
||||
<ProgressiveSkillsAnimation />
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import MagicBento from "@/components/ui/magic-bento";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
import { Section } from "../section";
|
||||
|
||||
export function WhatsNewSection({ className }: { className?: string }) {
|
||||
return (
|
||||
<Section
|
||||
className={cn("", className)}
|
||||
title="Whats New in DeerFlow 2.0"
|
||||
subtitle="DeerFlow is now evolving from a Deep Research agent into a full-stack Super Agent"
|
||||
>
|
||||
<div className="flex w-full items-center justify-center">
|
||||
<MagicBento />
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user