import React, { useEffect, useMemo, useState } from "react" import { Avatar, Card } from "antd" import { AnimatePresence, motion } from "framer-motion" // 使用 CSS-in-JS 方式 import styled, { keyframes } from "styled-components" import CountUp from "react-countup" import { TalentPoolIcon } from "@/components/Icons/TalentPool .tsx" import { ResearchPaperIcon } from "@/components/Icons/ResearchPaper.tsx" import { DataProjectIcon } from "@/components/Icons/DataProject.tsx" import { DatasetIcon } from "@/components/Icons/Dataset.tsx" import { TechCompanyIcon } from "@/components/Icons/TechCompany.tsx" import { ResearchInstitutesIcon } from "@/components/Icons/ResearchInstitutes.tsx" import { NSDCIcon } from "@/components/Icons/NSDC.tsx" import { useIodPlaygroundContext } from "@/components/Option/Playground/PlaygroundIod.tsx" import { totalSearchResults } from "@/services/search.ts" const rotate = keyframes` 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } ` const breathe = keyframes` 0% { box-shadow: 0 0 5px rgba(37, 231, 232, 0.3); } 50% { box-shadow: 0 0 20px rgba(37, 231, 232, 0.8); } 100% { box-shadow: 0 0 5px rgba(37, 231, 232, 0.3); } ` // 花瓣 /* ${(props) => (props.playing ? "running" : "paused")}; */ const CircleElement = styled.div<{ delay: number }>` position: absolute; width: 300px; height: 160px; background: #3b82f6; // blue-500 opacity: 0.2; border-radius: 50%; top: 55%; left: 50%; animation: ${rotate} 6s linear infinite, ${breathe} 2s infinite alternate; animation-delay: ${(props) => props.delay}s; animation-play-state: running; animation-duration: 3s; /* 添加动画总持续时间 */ animation-fill-mode: forwards; /* 保持动画结束时的状态 */ ` const FrostedGlassCard = styled(Card)` background: rgba(255, 255, 255, 0.25) !important; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.18); ` const SuccessIcon = React.forwardRef< SVGSVGElement, React.SVGProps >((props, ref) => { return ( ) }) const LoadingIcon = React.forwardRef< SVGSVGElement, React.SVGProps >((props, ref) => { return ( ) }) const SearchIcon = () => { return ( ) } // 自定义统计卡片组件 const StatCard: React.FC<{ number: number unit?: string label: string decimals?: number icon: React.ReactNode }> = ({ number, unit, label, decimals, icon }) => { return (
{unit}
{" "} {label}
) } export const StatisticGrid: React.FC = () => { return (
{/* 第一行:3 个卡片 */}
} number={11} unit="家" label="国家科学数据中心" /> } number={763} unit="家" label="高等院校和科研机构" /> } number={2.1} decimals={1} unit="万" label="科技型企业" />
{/* 第二行:4 个卡片 */}
} number={537163} label="数据集" /> } number={183729} label="数据项目" /> } number={1380026} label="数据论文" /> } number={2} unit="万" label="科创人才" />
) } type Props = { className?: string } export const PlaygroundIodRelevant: React.FC = ({ className }) => { const { iodLoading, iodSearch } = useMessageOption() const { currentIodMessage } = useIodPlaygroundContext() const showSearchData = useMemo(() => { return currentIodMessage && !iodLoading }, [currentIodMessage, iodLoading]) const [count, setCount] = useState(0) useEffect(() => { totalSearchResults().then((res) => { setCount(res) }) }, []) const getMinNum = (n1: number) => { return Math.min(n1, count) } const data = useMemo(() => { const loading = iodSearch && iodLoading const text = loading ? "正" : "已" const text2 = loading ? "进行" : "完成" const text3 = loading ? "……" : "" const duration = loading ? 2.5 : 0 return [ { title: (

{text}在 国家和省部级科学数据中心、 {" "} 高等院校的 万个 科学数据集中{text2}搜索{text3}

), description: showSearchData ? (

已发现 {" "} 个{" "} 数据集,引用 {getMinNum(currentIodMessage?.data.total ?? 0)}个 数据集作为参考

) : ( "" ) }, { title: (

{text}在 万篇 数据论文、 万个 数据项目中{text2}搜索{text3}

), description: showSearchData ? (

已发现 {" "} 个{" "} 场景,引用 {getMinNum(currentIodMessage?.scenario.total ?? 0)}个 场景作为参考

) : ( "" ) }, { title: (

{text}在 高等院校和科研机构、 {" "} 家科技型企业、 {" "} 科技人才中{text2}搜索{text3}

), description: showSearchData ? (

已发现 {" "} 个{" "} 组织,引用 {getMinNum(currentIodMessage?.organization.total ?? 0)}个 组织作为参考

) : ( "" ) } ] }, [showSearchData, iodLoading, count]) return (
{/* 花瓣效果 */}
{/* Header */}

{currentIodMessage ? "科创数联网深度搜索" : "科创数联网连接资源"}
{/**/}

{currentIodMessage ? "下面是在科创数联网上进行深度搜索得到的相关数据、场景和团队" : "下面是科创数联网连接的数据、场景和团队"}

{/* Content */}
{currentIodMessage ? ( {data.map((item, index) => (
{iodSearch && iodLoading ? ( ) : ( )}
{item.title}
{item.description && (
{item.description}
)}
))}
) : ( )}
) }