refactor: extract components folder

This commit is contained in:
Li Xin 2025-05-02 10:43:14 +08:00
parent 18d896d15d
commit fdfc607747
44 changed files with 44 additions and 44 deletions

View File

@ -11,6 +11,8 @@ import {
useState, useState,
} from "react"; } from "react";
import { Detective } from "~/components/deer-flow/icons/detective";
import { Tooltip } from "~/components/deer-flow/tooltip";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import type { Option } from "~/core/messages"; import type { Option } from "~/core/messages";
import { import {
@ -19,10 +21,6 @@ import {
} from "~/core/store"; } from "~/core/store";
import { cn } from "~/lib/utils"; import { cn } from "~/lib/utils";
import { Detective } from "../_icons/detective";
import { Tooltip } from "./tooltip";
export function InputBox({ export function InputBox({
className, className,
size, size,

View File

@ -6,6 +6,12 @@ import { motion } from "framer-motion";
import { Download, Headphones } from "lucide-react"; import { Download, Headphones } from "lucide-react";
import { useCallback, useMemo, useState } from "react"; import { useCallback, useMemo, useState } from "react";
import { LoadingAnimation } from "~/components/deer-flow/loading-animation";
import { Markdown } from "~/components/deer-flow/markdown";
import { RainbowText } from "~/components/deer-flow/rainbow-text";
import { RollingText } from "~/components/deer-flow/rolling-text";
import { ScrollContainer } from "~/components/deer-flow/scroll-container";
import { Tooltip } from "~/components/deer-flow/tooltip";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { import {
Card, Card,
@ -25,13 +31,6 @@ import {
import { parseJSON } from "~/core/utils"; import { parseJSON } from "~/core/utils";
import { cn } from "~/lib/utils"; import { cn } from "~/lib/utils";
import { LoadingAnimation } from "./loading-animation";
import { Markdown } from "./markdown";
import { RainbowText } from "./rainbow-text";
import { RollingText } from "./rolling-text";
import { ScrollContainer } from "./scroll-container";
import { Tooltip } from "./tooltip";
export function MessageListView({ export function MessageListView({
className, className,
onFeedback, onFeedback,

View File

@ -5,6 +5,7 @@ import { motion } from "framer-motion";
import { FastForward, Play } from "lucide-react"; import { FastForward, Play } from "lucide-react";
import { useCallback, useRef, useState } from "react"; import { useCallback, useRef, useState } from "react";
import { RainbowText } from "~/components/deer-flow/rainbow-text";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { import {
Card, Card,
@ -21,7 +22,6 @@ import { cn } from "~/lib/utils";
import { ConversationStarter } from "./conversation-starter"; import { ConversationStarter } from "./conversation-starter";
import { InputBox } from "./input-box"; import { InputBox } from "./input-box";
import { MessageListView } from "./message-list-view"; import { MessageListView } from "./message-list-view";
import { RainbowText } from "./rainbow-text";
import { Welcome } from "./welcome"; import { Welcome } from "./welcome";
export function MessagesBlock({ className }: { className?: string }) { export function MessagesBlock({ className }: { className?: string }) {

View File

@ -11,6 +11,12 @@ import SyntaxHighlighter from "react-syntax-highlighter";
import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs"; import { docco } from "react-syntax-highlighter/dist/esm/styles/hljs";
import { dark } from "react-syntax-highlighter/dist/esm/styles/prism"; import { dark } from "react-syntax-highlighter/dist/esm/styles/prism";
import { FavIcon } from "~/components/deer-flow/fav-icon";
import Image from "~/components/deer-flow/image";
import { LoadingAnimation } from "~/components/deer-flow/loading-animation";
import { Markdown } from "~/components/deer-flow/markdown";
import { RainbowText } from "~/components/deer-flow/rainbow-text";
import { Tooltip } from "~/components/deer-flow/tooltip";
import { import {
Accordion, Accordion,
AccordionContent, AccordionContent,
@ -24,13 +30,6 @@ import { useMessage, useStore } from "~/core/store";
import { parseJSON } from "~/core/utils"; import { parseJSON } from "~/core/utils";
import { cn } from "~/lib/utils"; import { cn } from "~/lib/utils";
import { FavIcon } from "./fav-icon";
import Image from "./image";
import { LoadingAnimation } from "./loading-animation";
import { Markdown } from "./markdown";
import { RainbowText } from "./rainbow-text";
import { Tooltip } from "./tooltip";
export function ResearchActivitiesBlock({ export function ResearchActivitiesBlock({
className, className,
researchId, researchId,

View File

@ -4,6 +4,8 @@
import { Check, Copy, Headphones, X } from "lucide-react"; import { Check, Copy, Headphones, X } from "lucide-react";
import { useCallback, useEffect, useState } from "react"; import { useCallback, useEffect, useState } from "react";
import { ScrollContainer } from "~/components/deer-flow/scroll-container";
import { Tooltip } from "~/components/deer-flow/tooltip";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { Card } from "~/components/ui/card"; import { Card } from "~/components/ui/card";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "~/components/ui/tabs";
@ -13,8 +15,6 @@ import { cn } from "~/lib/utils";
import { ResearchActivitiesBlock } from "./research-activities-block"; import { ResearchActivitiesBlock } from "./research-activities-block";
import { ResearchReportBlock } from "./research-report-block"; import { ResearchReportBlock } from "./research-report-block";
import { ScrollContainer } from "./scroll-container";
import { Tooltip } from "./tooltip";
export function ResearchBlock({ export function ResearchBlock({
className, className,
@ -102,7 +102,9 @@ export function ResearchBlock({
className="text-gray-400" className="text-gray-400"
size="sm" size="sm"
variant="ghost" variant="ghost"
onClick={() => { closeResearch(); }} onClick={() => {
closeResearch();
}}
> >
<X /> <X />
</Button> </Button>

View File

@ -3,14 +3,13 @@
import { useCallback, useRef } from "react"; import { useCallback, useRef } from "react";
import { LoadingAnimation } from "~/components/deer-flow/loading-animation";
import { Markdown } from "~/components/deer-flow/markdown";
import ReportEditor from "~/components/editor"; import ReportEditor from "~/components/editor";
import { useReplay } from "~/core/replay"; import { useReplay } from "~/core/replay";
import { useMessage, useStore } from "~/core/store"; import { useMessage, useStore } from "~/core/store";
import { cn } from "~/lib/utils"; import { cn } from "~/lib/utils";
import { LoadingAnimation } from "./loading-animation";
import { Markdown } from "./markdown";
export function ResearchReportBlock({ export function ResearchReportBlock({
className, className,
messageId, messageId,

View File

@ -8,8 +8,8 @@ import { useMemo } from "react";
import { useStore } from "~/core/store"; import { useStore } from "~/core/store";
import { cn } from "~/lib/utils"; import { cn } from "~/lib/utils";
import { MessagesBlock } from "../_components/messages-block"; import { MessagesBlock } from "./components/messages-block";
import { ResearchBlock } from "../_components/research-block"; import { ResearchBlock } from "./components/research-block";
export default function Main() { export default function Main() {
const openResearchId = useStore((state) => state.openResearchId); const openResearchId = useStore((state) => state.openResearchId);

View File

@ -10,10 +10,10 @@ import { Suspense } from "react";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { Logo } from "../_components/logo"; import { Logo } from "../../components/deer-flow/logo";
import { ThemeToggle } from "../_components/theme-toggle"; import { ThemeToggle } from "../../components/deer-flow/theme-toggle";
import { Tooltip } from "../_components/tooltip"; import { Tooltip } from "../../components/deer-flow/tooltip";
import { SettingsDialog } from "../_settings/dialogs/settings-dialog"; import { SettingsDialog } from "../settings/dialogs/settings-dialog";
const Main = dynamic(() => import("./main"), { ssr: false }); const Main = dynamic(() => import("./main"), { ssr: false });

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
"use client"; "use client";
import { import {
ReactFlow, ReactFlow,
Background, Background,
@ -31,12 +32,11 @@ import {
} from "react"; } from "react";
import "@xyflow/react/dist/style.css"; import "@xyflow/react/dist/style.css";
import { Tooltip } from "~/components/deer-flow/tooltip";
import { ShineBorder } from "~/components/magicui/shine-border"; import { ShineBorder } from "~/components/magicui/shine-border";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { useIntersectionObserver } from "~/hooks/use-intersection-observer"; import { useIntersectionObserver } from "~/hooks/use-intersection-observer";
import { Tooltip } from "../../_components/tooltip";
const ROW_HEIGHT = 85; const ROW_HEIGHT = 85;
const ROW_1 = 0; const ROW_1 = 0;
const ROW_2 = ROW_HEIGHT; const ROW_2 = ROW_HEIGHT;

View File

View File

@ -6,10 +6,10 @@ import "~/styles/globals.css";
import { type Metadata } from "next"; import { type Metadata } from "next";
import { Geist } from "next/font/google"; import { Geist } from "next/font/google";
import { ThemeProviderWrapper } from "~/app/_components/theme-provider-wrapper"; import { ThemeProviderWrapper } from "~/components/deer-flow/theme-provider-wrapper";
import { TooltipProvider } from "~/components/ui/tooltip"; import { TooltipProvider } from "~/components/ui/tooltip";
import { Toaster } from "./_components/toaster"; import { Toaster } from "../components/deer-flow/toaster";
export const metadata: Metadata = { export const metadata: Metadata = {
title: "🦌 DeerFlow", title: "🦌 DeerFlow",

View File

@ -5,14 +5,14 @@ import { GithubOutlined } from "@ant-design/icons";
import Link from "next/link"; import Link from "next/link";
import { useMemo } from "react"; import { useMemo } from "react";
import { Ray } from "~/components/deer-flow/ray";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { Ray } from "./_components/ray"; import { CaseStudySection } from "./landing/components/case-study-section";
import { CaseStudySection } from "./landing/_components/case-study-section"; import { CoreFeatureSection } from "./landing/components/core-features-section";
import { CoreFeatureSection } from "./landing/_components/core-features-section"; import { JoinCommunitySection } from "./landing/components/join-community-section";
import { JoinCommunitySection } from "./landing/_components/join-community-section"; import { Jumbotron } from "./landing/components/jumbotron";
import { Jumbotron } from "./landing/_components/jumbotron"; import { MultiAgentSection } from "./landing/components/multi-agent-section";
import { MultiAgentSection } from "./landing/_components/multi-agent-section";
export default function HomePage() { export default function HomePage() {
return ( return (

View File

@ -4,6 +4,7 @@
import { Settings } from "lucide-react"; import { Settings } from "lucide-react";
import { useCallback, useEffect, useMemo, useState } from "react"; import { useCallback, useEffect, useMemo, useState } from "react";
import { Tooltip } from "~/components/deer-flow/tooltip";
import { Badge } from "~/components/ui/badge"; import { Badge } from "~/components/ui/badge";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { import {
@ -25,7 +26,6 @@ import {
} from "~/core/store"; } from "~/core/store";
import { cn } from "~/lib/utils"; import { cn } from "~/lib/utils";
import { Tooltip } from "../../_components/tooltip";
import { SETTINGS_TABS } from "../tabs"; import { SETTINGS_TABS } from "../tabs";
export function SettingsDialog() { export function SettingsDialog() {

View File

@ -3,7 +3,7 @@
import { BadgeInfo } from "lucide-react"; import { BadgeInfo } from "lucide-react";
import { Markdown } from "~/app/_components/markdown"; import { Markdown } from "~/components/deer-flow/markdown";
import about from "./about.md"; import about from "./about.md";
import type { Tab } from "./types"; import type { Tab } from "./types";

View File

@ -5,7 +5,7 @@ import { motion } from "framer-motion";
import { Blocks, PencilRuler, Trash } from "lucide-react"; import { Blocks, PencilRuler, Trash } from "lucide-react";
import { useCallback, useState } from "react"; import { useCallback, useState } from "react";
import { Tooltip } from "~/app/_components/tooltip"; import { Tooltip } from "~/components/deer-flow/tooltip";
import { Button } from "~/components/ui/button"; import { Button } from "~/components/ui/button";
import { Switch } from "~/components/ui/switch"; import { Switch } from "~/components/ui/switch";
import type { MCPServerMetadata } from "~/core/mcp"; import type { MCPServerMetadata } from "~/core/mcp";

View File

@ -1,3 +1,6 @@
// Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
// SPDX-License-Identifier: MIT
export function Ray() { export function Ray() {
return ( return (
<svg <svg