fix: 重建 WuHan-2020 新冠救援信息平台前台页面以开放数据存档 - #103
Conversation
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
📝 WalkthroughWalkthroughChanges武汉2020救援信息归档
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Warning |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@models/Wuhan2020.ts`:
- Around line 1-8: 在 models/Wuhan2020.ts 的模型定义顶部补充对 ./Base 的导入,遵循 models/**/*.ts
统一初始化 GitHub 客户端的约定;保持现有 RescueCategory 等类型定义不变。
In `@pages/wuhan2020.tsx`:
- Around line 140-147: 将统计筛选项的 Card 改为 React Bootstrap Button,保留 activeCategory
切换逻辑并确保支持键盘激活;在搜索区域使用 Form.Control 和 Button 替换原生 input/button。为清除按钮添加
aria-label={t('wuhan2020_clear_search')} 等本地化可访问名称,并确保所有用户可见文本均通过 t() 提供。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 6bbcf82a-d9f7-4696-a631-c5a6ebf96e44
⛔ Files ignored due to path filters (4)
styles/Wuhan2020.module.lessis excluded by none and included by nonetranslation/en-US.tsis excluded by none and included by nonetranslation/zh-CN.tsis excluded by none and included by nonetranslation/zh-TW.tsis excluded by none and included by none
📒 Files selected for processing (3)
components/Navigator/MainNavigator.tsxmodels/Wuhan2020.tspages/wuhan2020.tsx
| /** | ||
| * WuHan-2020 新冠救援信息平台 — 归档数据模型 | ||
| * | ||
| * 数据来源:https://github.com/nicedoc/wuhan2020 | ||
| * 最后更新时间:2020 年春季 | ||
| */ | ||
|
|
||
| export type RescueCategory = |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
补充模型层的 Base 初始化导入。
该模型文件缺少 ./Base 导入,未遵循模型层统一初始化 GitHub 客户端的约定。
建议修改
+import './Base';
+
/**
* WuHan-2020 新冠救援信息平台 — 归档数据模型As per coding guidelines, models/**/*.ts 中的模型文件必须导入 ./Base。
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| /** | |
| * WuHan-2020 新冠救援信息平台 — 归档数据模型 | |
| * | |
| * 数据来源:https://github.com/nicedoc/wuhan2020 | |
| * 最后更新时间:2020 年春季 | |
| */ | |
| export type RescueCategory = | |
| import './Base'; | |
| /** | |
| * WuHan-2020 新冠救援信息平台 — 归档数据模型 | |
| * | |
| * 数据来源:https://github.com/nicedoc/wuhan2020 | |
| * 最后更新时间:2020 年春季 | |
| */ | |
| export type RescueCategory = |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@models/Wuhan2020.ts` around lines 1 - 8, 在 models/Wuhan2020.ts 的模型定义顶部补充对
./Base 的导入,遵循 models/**/*.ts 统一初始化 GitHub 客户端的约定;保持现有 RescueCategory 等类型定义不变。
Source: Coding guidelines
| <Card | ||
| className={`text-center p-3 ${styles.statCard} ${activeCategory === key ? styles.active : ''}`} | ||
| onClick={() => setActiveCategory(activeCategory === key ? null : key)} | ||
| > | ||
| <div className={styles.statIcon}>{icon}</div> | ||
| <div className={styles.statCount}>{count}</div> | ||
| <div className={styles.statLabel}>{t(`wuhan2020_cat_${key}`)}</div> | ||
| </Card> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
将筛选交互改为可访问的 React Bootstrap 控件。
统计卡片仅绑定 onClick,不支持键盘激活;搜索区仍使用原生 input/button,且清除按钮只有 ✕,屏幕阅读器没有可识别名称。请以 Button 承载可点击筛选项,使用 Form.Control 和 Button 替换原生控件,并为清除按钮添加如 aria-label={t('wuhan2020_clear_search')} 的本地化名称。
搜索控件示例
- <input
- type="text"
+ <Form.Control
+ type="search"
+ size="sm"
className="form-control form-control-sm border-0 bg-transparent"
placeholder={t('wuhan2020_search_placeholder')}
+ aria-label={t('wuhan2020_search_placeholder')}
value={searchTerm}
onChange={e => setSearchTerm(e.target.value)}
style={{ maxWidth: 220 }}
/>
- <button
- className="btn btn-sm btn-outline-secondary"
+ <Button
+ variant="outline-secondary"
+ size="sm"
+ aria-label={t('wuhan2020_clear_search')}
onClick={() => setSearchTerm('')}
>
✕
- </button>
+ </Button>As per coding guidelines, UI 交互应使用 React Bootstrap,且所有用户可见及可访问文本必须使用 t()。
Also applies to: 163-180
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pages/wuhan2020.tsx` around lines 140 - 147, 将统计筛选项的 Card 改为 React Bootstrap
Button,保留 activeCategory 切换逻辑并确保支持键盘激活;在搜索区域使用 Form.Control 和 Button 替换原生
input/button。为清除按钮添加 aria-label={t('wuhan2020_clear_search')}
等本地化可访问名称,并确保所有用户可见文本均通过 t() 提供。
Source: Coding guidelines
修复 Issue #99
Issue 标题: 重建 WuHan-2020 新冠救援信息平台前台页面以开放数据存档
平台: GITHUB
仓库: Open-Source-Bazaar/Open-Source-Bazaar.github.io
修复方案:
Inspect the existing Next.js pages/components and the referenced Wuhan-2020 WebApp. Implement a focused archival frontend page inside this repository using the existing design system, reuse available public/open data sources or clearly documented local archival data fixtures, add navigation, responsive states, and the most relevant tests/build validation. Keep scope to a coherent MVP that directly addresses issue #99 and does not replace unrelated site sections.
修改文件:
components/Navigator/MainNavigator.tsxtranslation/en-US.tstranslation/zh-CN.tstranslation/zh-TW.tsmodels/Wuhan2020.tspages/wuhan2020.tsxstyles/Wuhan2020.module.less自动化流水线:
此 PR 由 Bounty Hunter 自动生成
Summary by CodeRabbit