import { useEffect, useRef } from 'react' import { Link, useParams } from 'react-router-dom' import { motion } from 'framer-motion' import { ArrowRight, FileText, Wrench, FileOutput, Lightbulb } from 'lucide-react' import { knowledgeAreas, processesByKnowledgeArea, knowledgeAreaMap, processGroupMap } from '@/data' const containerVariants = { hidden: { opacity: 0 }, visible: { opacity: 1, transition: { staggerChildren: 0.03 } }, } const itemVariants = { hidden: { opacity: 0, y: 10 }, visible: { opacity: 1, y: 0 }, } // 跳过动画时的变体(立即显示) const skipAnimationVariants = { hidden: { opacity: 1, y: 0 }, visible: { opacity: 1, y: 0 }, } export function KnowledgeAreasPage() { const { id } = useParams() const selectedKA = id ? knowledgeAreaMap.get(id) : null const processes = id ? processesByKnowledgeArea.get(id) || [] : [] // 检测是否应该跳过动画(返回页面时) const hasVisitedRef = useRef(false) const shouldSkipAnimation = hasVisitedRef.current useEffect(() => { // 标记已访问,下次渲染时跳过动画 hasVisitedRef.current = true }, []) // 根据是否跳过动画选择变体 const activeItemVariants = shouldSkipAnimation ? skipAnimationVariants : itemVariants if (selectedKA) { return (
{selectedKA.nameEn}
{selectedKA.description}
{factor.description}
{process.nameEn}
10大项目管理知识领域
{ka.nameEn}