Skip to content

Add Open Library page#87

Open
fttawa wants to merge 2 commits into
Open-Source-Bazaar:mainfrom
fttawa:add-open-library-page
Open

Add Open Library page#87
fttawa wants to merge 2 commits into
Open-Source-Bazaar:mainfrom
fttawa:add-open-library-page

Conversation

@fttawa

@fttawa fttawa commented Jul 10, 2026

Copy link
Copy Markdown

PR-87 PR-87 PR-87 Powered by Pull Request Badge

Summary

  • Adds a new /library Open Library landing page with catalog browsing, detail cards, availability badges, shelf codes, and borrowing information.
  • Adds a borrowing guide and CTA for submitting books or borrowing requests.
  • Adds the Open Library navigation entry under Open Source Projects.
  • Adds zh-CN, zh-TW, and en-US translations for all new user-facing strings.

Closes #15

Validation

  • pnpm exec tsc --noEmit
  • pnpm exec eslint pages/library.tsx
  • pnpm build reaches production compilation, then stops while collecting page data because the local environment does not have Lark App Id/Secret for existing NGO/wiki pages.

Reward

This PR is for the 270 TQT reward on #15. Please let me know what account or payout information is needed after review.

Summary by CodeRabbit

  • 新功能
    • 新增“开源图书馆”页面,展示图书目录、作者、分类、借阅状态及书架编号。
    • 提供图书总数、可借数量和已借数量统计。
    • 新增借阅指南和提交借阅入口。
    • 在主导航的开源项目菜单中加入“开放图书馆”入口。

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@fttawa, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 39 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fe8f7adf-357c-48ce-bbdf-e9ea1b48908b

📥 Commits

Reviewing files that changed from the base of the PR and between 74ca977 and 4c5c31b.

📒 Files selected for processing (1)
  • pages/library.tsx
📝 Walkthrough

Walkthrough

新增开源图书馆页面,展示图书统计、目录、借阅状态与借阅指南,并在主导航的开源项目菜单中增加 /library 入口。

Changes

开源图书馆

Layer / File(s) Summary
图书馆页面实现
pages/library.tsx
定义图书条目、状态映射和借阅指南配置,使用 I18nContextt() 渲染统计卡片、图书目录、状态信息及借阅指南,并导出 observer 包装的 LibraryPage
主导航入口
components/Navigator/MainNavigator.tsx
open_source_projects 子菜单中新增指向 /libraryopen_library 导航项。

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题简洁且准确概括了本次新增 Open Library 页面。
Linked Issues check ✅ Passed 已新增 /library 页面、导航入口、图书目录、状态标记、借阅信息和借阅指南,符合 #15 的核心要求。
Out of Scope Changes check ✅ Passed 变更集中在 Open Library 页面及其导航入口,没有明显无关的额外改动。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pages/library.tsx (2)

145-145: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

统计卡片重复调用 filter 可提取为变量

两处分别对 libraryBooks 调用 filter 计算 availableborrowed 数量。虽然当前 6 条数据影响可忽略,但提取为变量可提升可读性,也便于未来数据量增长时扩展。

♻️ 建议重构
   const LibraryPage: FC = observer(() => {
     const { t } = useContext(I18nContext);
+    const availableCount = libraryBooks.filter(({ status }) => status === 'available').length;
+    const borrowedCount = libraryBooks.length - availableCount;

     return (

然后在统计卡片中:

-              {libraryBooks.filter(({ status }) => status === 'available').length}
+              {availableCount}
-              {libraryBooks.filter(({ status }) => status === 'borrowed').length}
+              {borrowedCount}

Also applies to: 156-156

🤖 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/library.tsx` at line 145, 在页面组件中为可借阅和已借阅图书数量提取复用的变量,避免统计卡片分别对
libraryBooks 重复调用 filter;使用这些变量替换对应的 available 和 borrowed 数量表达式,保持现有统计结果不变。

232-234: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

站内跳转改为 next/link
这里是站内路由,Button href="/bounty" 会按普通 <a> 处理并触发整页刷新;建议改成 next/link 包裹 Button,保留样式并走客户端导航。

🤖 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/library.tsx` around lines 232 - 234, Update the library submit-books
navigation around the Button component to use next/link for the internal
“/bounty” route, wrapping Button with Link while preserving its existing styling
and label so navigation occurs client-side without a full-page reload.
🤖 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.

Nitpick comments:
In `@pages/library.tsx`:
- Line 145: 在页面组件中为可借阅和已借阅图书数量提取复用的变量,避免统计卡片分别对 libraryBooks 重复调用
filter;使用这些变量替换对应的 available 和 borrowed 数量表达式,保持现有统计结果不变。
- Around line 232-234: Update the library submit-books navigation around the
Button component to use next/link for the internal “/bounty” route, wrapping
Button with Link while preserving its existing styling and label so navigation
occurs client-side without a full-page reload.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6c1b367b-7152-4648-8581-1df6b286b66b

📥 Commits

Reviewing files that changed from the base of the PR and between 58126ca and 74ca977.

⛔ Files ignored due to path filters (3)
  • translation/en-US.ts is excluded by none and included by none
  • translation/zh-CN.ts is excluded by none and included by none
  • translation/zh-TW.ts is excluded by none and included by none
📒 Files selected for processing (2)
  • components/Navigator/MainNavigator.tsx
  • pages/library.tsx

@fttawa

fttawa commented Jul 10, 2026

Copy link
Copy Markdown
Author

Addressed CodeRabbit's two nitpicks in the latest commit: extracted reusable available/borrowed counters and switched the internal /bounty navigation to next/link. Re-ran:\n\n- pnpm exec prettier --write pages/library.tsx\n- pnpm exec eslint pages/library.tsx\n- pnpm exec tsc --noEmit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

开发【开源图书馆】前端页面

1 participant