From c5c19362c529c5501597722e7554f073495dec10 Mon Sep 17 00:00:00 2001 From: ittoview Date: Sun, 8 Mar 2026 03:26:34 +0000 Subject: [PATCH] =?UTF-8?q?refactor(=E6=95=B4=E5=90=88):=20=E5=B0=86?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=A5=E5=BF=97=E6=94=B9=E4=B8=BA=E6=A8=A1?= =?UTF-8?q?=E6=80=81=E6=A1=86=E5=AE=9E=E7=8E=B0=E5=B9=B6=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E6=9C=80=E8=BF=9120=E6=9D=A1=E6=9B=B4=E6=96=B0=E8=AE=B0?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 ChangelogPage 改为 ChangelogModal 模态框组件 - 移除 /changelog 和 /updates 路由,改为模态框弹出 - 修改 Header 按钮点击行为,触发模态框而非路由跳转 - 根据最近20条 git 提交记录补充更新数据 - 优化模态框样式,支持响应式布局和深色模式 - 修复 JSON 中的引号转义问题 via [HAPI](https://hapi.run) Co-Authored-By: HAPI --- src/App.tsx | 5 +- src/components/ChangelogModal.tsx | 171 ++++++++++++++++++++++++++++++ src/components/layout/Header.tsx | 17 ++- src/data/changelog.json | 135 ++++++++++++++++++++++- src/pages/ChangelogPage.tsx | 131 ----------------------- src/pages/index.ts | 1 - 6 files changed, 314 insertions(+), 146 deletions(-) create mode 100644 src/components/ChangelogModal.tsx delete mode 100644 src/pages/ChangelogPage.tsx diff --git a/src/App.tsx b/src/App.tsx index 807a18c..6f29766 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { Routes, Route, Navigate } from 'react-router-dom' +import { Routes, Route } from 'react-router-dom' import { Layout } from './components/layout/Layout' import { HomePage } from './pages/HomePage' import { KnowledgeAreasPage } from './pages/KnowledgeAreasPage' @@ -8,7 +8,6 @@ import { ProcessMatrixPage } from './pages/ProcessMatrixPage' import { ProcessGraphPage } from './pages/ProcessGraphPage' import { ArtifactDetailPage } from './pages/ArtifactDetailPage' import { ToolDetailPage } from './pages/ToolDetailPage' -import { ChangelogPage } from './pages/ChangelogPage' import { SettingsPage } from './pages/SettingsPage' import ProcessPracticePage from './pages/ProcessPracticePage' @@ -27,8 +26,6 @@ function App() { } /> } /> } /> - } /> - } /> } /> diff --git a/src/components/ChangelogModal.tsx b/src/components/ChangelogModal.tsx new file mode 100644 index 0000000..c1f1480 --- /dev/null +++ b/src/components/ChangelogModal.tsx @@ -0,0 +1,171 @@ +import { motion, AnimatePresence } from 'framer-motion' +import { X, History, CalendarDays, Tag } from 'lucide-react' +import { changelogEntries } from '@/data' +import type { ChangelogType } from '@/types/itto' + +interface ChangelogModalProps { + isOpen: boolean + onClose: () => void +} + +const containerVariants = { + hidden: { opacity: 0 }, + visible: { + opacity: 1, + transition: { + staggerChildren: 0.06, + }, + }, +} + +const itemVariants = { + hidden: { opacity: 0, y: 12 }, + visible: { + opacity: 1, + y: 0, + transition: { + duration: 0.25, + }, + }, +} + +const typeMeta: Record = { + feat: { label: '新功能', className: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300' }, + fix: { label: '修复', className: 'bg-rose-100 text-rose-700 dark:bg-rose-900/30 dark:text-rose-300' }, + style: { label: '样式', className: 'bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-300' }, + refactor: { label: '重构', className: 'bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-300' }, + docs: { label: '文档', className: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300' }, + perf: { label: '性能', className: 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300' }, + test: { label: '测试', className: 'bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300' }, + chore: { label: '工程', className: 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300' }, +} + +function formatDate(date: string) { + const [year, month, day] = date.split('-').map(Number) + if (!year || !month || !day) return date + return `${year}年${month}月${day}日` +} + +export function ChangelogModal({ isOpen, onClose }: ChangelogModalProps) { + return ( + + {isOpen && ( + <> + {/* 背景遮罩 */} + + + {/* 模态框 */} + +
+ {/* 头部 */} +
+
+
+ +
+
+

更新日志

+

+ 共 {changelogEntries.length} 条记录 +

+
+
+ +
+ + {/* 内容区域 */} +
+ {changelogEntries.length > 0 ? ( + + {/* 时间轴竖线 */} +
+ + {/* 更新记录列表 */} +
+ {changelogEntries.map((entry, index) => { + const meta = typeMeta[entry.type] + return ( + + {/* 时间轴节点 */} +
+
+
+
+
+ + {/* 更新卡片 */} +
+
+ {/* 标签行 */} +
+ {/* 类型标签 */} + + + {meta.label} + + + {/* 范围标签 */} + {entry.scope && ( + + {entry.scope} + + )} + + {/* 日期(桌面端靠右,移动端换行) */} + + + {formatDate(entry.date)} + +
+ + {/* 标题 */} +

+ {entry.title} +

+
+
+ + ) + })} +
+
+ ) : ( +
+ +

暂无更新记录

+
+ )} +
+
+
+ + )} + + ) +} diff --git a/src/components/layout/Header.tsx b/src/components/layout/Header.tsx index 33c0af9..a9a330c 100644 --- a/src/components/layout/Header.tsx +++ b/src/components/layout/Header.tsx @@ -1,8 +1,9 @@ import { useAppStore } from '@/stores/useAppStore' import { Menu, Search, Sun, Moon, X, History } from 'lucide-react' import { useState, useMemo, useRef, useEffect } from 'react' -import { useNavigate, useLocation } from 'react-router-dom' +import { useNavigate } from 'react-router-dom' import { processes, artifacts, tools, knowledgeAreaMap } from '@/data' +import { ChangelogModal } from '@/components/ChangelogModal' interface SearchResult { type: 'process' | 'artifact' | 'tool' @@ -21,11 +22,10 @@ export function Header() { const searchQuery = useAppStore((s) => s.searchQuery) const setSearchQuery = useAppStore((s) => s.setSearchQuery) const [isSearchOpen, setIsSearchOpen] = useState(false) + const [isChangelogOpen, setIsChangelogOpen] = useState(false) const searchRef = useRef(null) const inputRef = useRef(null) const navigate = useNavigate() - const location = useLocation() - const isChangelogPage = location.pathname === '/changelog' || location.pathname === '/updates' // 搜索结果 const searchResults = useMemo(() => { @@ -244,12 +244,8 @@ export function Header() {
{/* 更新日志 */}
+ + {/* 更新日志模态框 */} + setIsChangelogOpen(false)} /> ) } diff --git a/src/data/changelog.json b/src/data/changelog.json index 7209881..5cc714c 100644 --- a/src/data/changelog.json +++ b/src/data/changelog.json @@ -1,11 +1,144 @@ { "changelogEntries": [ { - "id": "2026-03-08-changelog-page", + "id": "2026-03-08-changelog-modal", "date": "2026-03-08", "type": "feat", "title": "新增更新时间轴浏览页面与顶部快捷入口", "scope": "整合" + }, + { + "id": "2026-03-08-practice-fix-offset", + "date": "2026-03-08", + "type": "fix", + "title": "修正底部固定区域偏移方式", + "scope": "练习" + }, + { + "id": "2026-03-08-practice-optimize-layout", + "date": "2026-03-08", + "type": "feat", + "title": "优化辅助信息显示和布局", + "scope": "练习" + }, + { + "id": "2026-03-07-practice-show-itto", + "date": "2026-03-07", + "type": "feat", + "title": "答对后显示ITTO明细信息", + "scope": "练习" + }, + { + "id": "2026-03-04-stakeholder-fix-p10-4", + "date": "2026-03-04", + "type": "fix", + "title": "修复P10.4监督干系人参与输出重复项目管理计划", + "scope": "相关方" + }, + { + "id": "2026-03-04-stakeholder-fix-p10-3", + "date": "2026-03-04", + "type": "fix", + "title": "修复P10.3管理干系人参与输出重复项目管理计划", + "scope": "相关方" + }, + { + "id": "2026-03-04-stakeholder-fix-identify", + "date": "2026-03-04", + "type": "fix", + "title": "修正识别干系人输出项目管理计划更新", + "scope": "相关方" + }, + { + "id": "2026-03-04-procurement-fix-output", + "date": "2026-03-04", + "type": "fix", + "title": "修正实施采购输出项目文件更新明细", + "scope": "采购" + }, + { + "id": "2026-03-04-risk-fix-quantitative-tool", + "date": "2026-03-04", + "type": "fix", + "title": "修正实施定量风险分析工具从决策树分析改为数据分析", + "scope": "风险" + }, + { + "id": "2026-03-04-risk-fix-identify-output", + "date": "2026-03-04", + "type": "fix", + "title": "修正识别风险输出项目文件更新明细", + "scope": "风险" + }, + { + "id": "2026-03-04-communication-add-detail", + "date": "2026-03-04", + "type": "feat", + "title": "为管理沟通输出项目沟通记录添加明细", + "scope": "沟通" + }, + { + "id": "2026-03-04-communication-add-report-tool", + "date": "2026-03-04", + "type": "feat", + "title": "新增项目报告工具并修正管理沟通工具列表", + "scope": "沟通" + }, + { + "id": "2026-03-04-communication-add-analysis-tool", + "date": "2026-03-04", + "type": "feat", + "title": "新增沟通需求分析工具并修正规划沟通管理工具列表", + "scope": "沟通" + }, + { + "id": "2026-03-04-resource-add-eef-update", + "date": "2026-03-04", + "type": "feat", + "title": "新增事业环境因素更新并修正资源管理过程输出", + "scope": "资源" + }, + { + "id": "2026-03-04-quality-fix-tool-name", + "date": "2026-03-04", + "type": "fix", + "title": "修正TT066名称从「测试与检查的规则」改为「测试/产品评估」", + "scope": "质量" + }, + { + "id": "2026-03-04-quality-add-decision-tool", + "date": "2026-03-04", + "type": "feat", + "title": "新增决策技术工具并应用于规划质量管理和管理质量", + "scope": "质量" + }, + { + "id": "2026-03-04-close-fix-output", + "date": "2026-03-04", + "type": "fix", + "title": "修复P1.7输出应为项目文件更新而非项目管理计划更新", + "scope": "整合" + }, + { + "id": "2026-03-04-process-name-fix", + "date": "2026-03-04", + "type": "fix", + "title": "修正P1.2和P3.5过程名称「制定」为「制订」", + "scope": "整合" + }, + { + "id": "2026-03-04-change-control-fix", + "date": "2026-03-04", + "type": "fix", + "title": "修复P1.6输出移除变更日志保留项目管理计划更新", + "scope": "整合" + }, + { + "id": "2026-03-03-dify-integration", + "date": "2026-03-03", + "type": "feat", + "title": "集成Dify智能对话助手", + "scope": "整合" } ] } diff --git a/src/pages/ChangelogPage.tsx b/src/pages/ChangelogPage.tsx deleted file mode 100644 index 7e3fc16..0000000 --- a/src/pages/ChangelogPage.tsx +++ /dev/null @@ -1,131 +0,0 @@ -import { motion } from 'framer-motion' -import { History, CalendarDays, Tag } from 'lucide-react' -import { changelogEntries } from '@/data' -import type { ChangelogType } from '@/types/itto' - -const containerVariants = { - hidden: { opacity: 0 }, - visible: { - opacity: 1, - transition: { - staggerChildren: 0.06, - }, - }, -} - -const itemVariants = { - hidden: { opacity: 0, y: 12 }, - visible: { - opacity: 1, - y: 0, - transition: { - duration: 0.25, - }, - }, -} - -const typeMeta: Record = { - feat: { label: '新功能', className: 'bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300' }, - fix: { label: '修复', className: 'bg-rose-100 text-rose-700 dark:bg-rose-900/30 dark:text-rose-300' }, - style: { label: '样式', className: 'bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-300' }, - refactor: { label: '重构', className: 'bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-300' }, - docs: { label: '文档', className: 'bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300' }, - perf: { label: '性能', className: 'bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300' }, - test: { label: '测试', className: 'bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300' }, - chore: { label: '工程', className: 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300' }, -} - -function formatDate(date: string) { - const [year, month, day] = date.split('-').map(Number) - if (!year || !month || !day) return date - return `${year}年${month}月${day}日` -} - -export function ChangelogPage() { - return ( -
- {/* 页面标题 */} -
-

更新日志

-

- 记录项目的演进历史和重要变更 · 共 {changelogEntries.length} 条记录 -

-
- - {/* 时间轴列表 */} - {changelogEntries.length > 0 ? ( - - {/* 时间轴竖线 */} -
- - {/* 更新记录列表 */} -
- {changelogEntries.map((entry, index) => { - const meta = typeMeta[entry.type] - return ( - - {/* 时间轴节点 */} -
-
-
-
-
- - {/* 更新卡片 */} -
-
- {/* 标签行 */} -
- {/* 类型标签 */} - - - {meta.label} - - - {/* 范围标签 */} - {entry.scope && ( - - {entry.scope} - - )} - - {/* 日期(桌面端靠右,移动端换行) */} - - - {formatDate(entry.date)} - -
- - {/* 标题 */} -

- {entry.title} -

-
-
- - ) - })} -
-
- ) : ( - - -

暂无更新记录

-
- )} -
- ) -} diff --git a/src/pages/index.ts b/src/pages/index.ts index bc703c8..b46808f 100644 --- a/src/pages/index.ts +++ b/src/pages/index.ts @@ -7,5 +7,4 @@ export { ProcessRoadmapPage } from './ProcessRoadmapPage' export { ProcessGraphPage } from './ProcessGraphPage' export { ArtifactDetailPage } from './ArtifactDetailPage' export { ToolDetailPage } from './ToolDetailPage' -export { ChangelogPage } from './ChangelogPage' export { SettingsPage } from './SettingsPage'