Skip to content

Conversation

@arrow2nd
Copy link
Member

@arrow2nd arrow2nd commented Oct 12, 2025

Summary

This PR adds a new "すべて" (All) tab to the library page that displays all books across all reading statuses.

Changes

  • Added "all" status to ReadingStatus type
  • Added "すべて" tab with bookmarks icon to status metadata
  • Updated readingStatusOrder to include "all" as the first tab
  • Modified database query to fetch books from all statuses when "all" is selected
  • Updated page validation to support "all" status
  • Added empty state message for "all" status

Testing

  • Verify the "すべて" tab appears as the first tab
  • Verify all books from all statuses are displayed
  • Verify books are sorted by recently updated
  • Verify swipe navigation works with the new tab
  • Verify search and filtering work correctly

Resolves #172

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 新機能
    • ライブラリに新ステータス「すべて」を追加。フィルタで全件(「読みたい」「読書中」「読了」)を一括表示可能に。
    • ステータスの表示順を先頭に「すべて」を配置し、選択しやすく改善。
    • 「すべて」用のラベル(「すべて」)と対応アイコンを追加。
    • 「すべて」選択時のメッセージを追加(表示文言: 「ナニモナイ」)。

- Added "all" status to ReadingStatus type
- Added "すべて" tab with bookmarks icon to status metadata
- Updated readingStatusOrder to include "all" as the first tab
- Modified database query to fetch books from all statuses when "all" is selected
- Updated page validation to support "all" status
- Added empty state message for "all" status

Resolves #172

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: arrow2nd / tanida <[email protected]>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 12, 2025

Walkthrough

ライブラリ機能に「all」ステータスを追加。型・バリデーション・定数(表示順/メタデータ/メッセージ)・DB検索条件・ページのバリデーション利用箇所を更新し、ライブラリ横断検索に対応。

Changes

Cohort / File(s) Change summary
Types & Validation
src/types/readingStatus.ts
読み取りステータスに"all"を追加。libraryReadingStatusSchemaを新規公開し、ライブラリ文脈で"none"を除外したスキーマを提供。既存readingStatusSchemaWithoutNoneは値拡張に追随。
UI Constants (Status metadata & order)
src/constants/status.tsx
readingStatusMetadata"all"(ラベル「すべて」・IconBookmarks/…Filled)を追加。readingStatusOrder["all","want_read","reading","read"]に更新。
UI Constants (Messages)
src/constants/library-message.ts
LIBRARY_MESSAGE"all""ナニモナイ"を追加。
DB Query
src/db/queries/status.ts
searchBooksFromLibrarystatus === "all"時に["want_read","reading","read"]を包括する条件へ変更。それ以外は等価比較を維持。
Page Routing/Validation
src/app/(framed)/library/[status]/page.tsx
ステータス検証にreadingStatusSchemaWithoutNoneからlibraryReadingStatusSchemaへ切替(generateMetadataとメインフローのis(...))。インポートを更新。

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant P as Library/[status] Page
  participant V as libraryReadingStatusSchema
  participant Q as searchBooksFromLibrary
  participant DB as Database

  U->>P: アクセス / 検索 (status, q)
  P->>V: status検証
  alt 検証OK
    P->>Q: searchBooksFromLibrary(status, q)
    alt status == "all"
      Note over Q: 3状態(want_read, reading, read)で検索
      Q->>DB: WHERE status IN (...)
    else その他
      Q->>DB: WHERE status = status
    end
    DB-->>Q: 結果
    Q-->>P: 書籍一覧
    P-->>U: レンダリング
  else 検証NG
    P-->>U: 404/リダイレクト等(既存フロー)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed タイトルは新たにライブラリページに「すべて」タブを追加するというPRの主要な変更点を簡潔に表現しており、余計な情報や曖昧さがなく意図を正確に伝えています。
Linked Issues Check ✅ Passed PRでは新たな「all」ステータスの追加とそれに伴うビュー・DBクエリ・型定義の修正を通じて、タブを切り替えることなく全ステータス横断検索を可能にしており、Issue#172の目的を十分に満たしています。
Out of Scope Changes Check ✅ Passed 追加された変更はすべて「すべて」タブ実装に紐づくステータス定義・メタデータ・クエリ・バリデーションの修正に限られており、PRのスコープ外の機能やファイルへの影響は見当たりません。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/issue-172-20251012-1832

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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/types/readingStatus.ts (1)

17-20: スキーマの重複を検討してください。

readingStatusSchemaWithoutNonelibraryReadingStatusSchema は現在、同じフィルタ条件(v !== "none" を除外)を使用しており、機能的に等価です。この重複が将来的にメンテナンスの負担になる可能性があります。

もし両者が将来的に異なる動作を持つ予定であれば問題ありませんが、そうでない場合は統合を検討してください。または、コメントで使い分けの意図を明記することをお勧めします。

src/app/(framed)/library/[status]/page.tsx (1)

13-13: 重複バリデーションスキーマを整理
readingStatusSchemaWithoutNonelibraryReadingStatusSchema とフィルタ条件(v !== "none")が同一かつコードベースで未使用です。不要であれば削除するか、使い分けの意図をドキュメント化してください。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8bd609f and 636cc6b.

📒 Files selected for processing (5)
  • src/app/(framed)/library/[status]/page.tsx (3 hunks)
  • src/constants/library-message.ts (1 hunks)
  • src/constants/status.tsx (2 hunks)
  • src/db/queries/status.ts (2 hunks)
  • src/types/readingStatus.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/types/*.ts

⚙️ CodeRabbit configuration file

全体で使用する型定義を格納しています

Files:

  • src/types/readingStatus.ts
🧬 Code graph analysis (4)
src/constants/status.tsx (4)
src/types/readingStatus.ts (1)
  • ReadingStatus (11-11)
src/components/BookReadingStatusForm/index.tsx (1)
  • BookReadingStatusForm (31-95)
src/components/BookReadingStatusForm/ReadingStatusButton.tsx (1)
  • BookReadingStatusButton (15-40)
src/app/(framed)/library/[status]/_components/Tab/index.tsx (1)
  • Tab (12-24)
src/app/(framed)/library/[status]/page.tsx (1)
src/types/readingStatus.ts (1)
  • libraryReadingStatusSchema (20-20)
src/constants/library-message.ts (1)
src/actions/updateReadingStatus.ts (1)
  • updateReadingStatus (24-94)
src/types/readingStatus.ts (3)
src/actions/updateReadingStatus.ts (1)
  • updateReadingStatus (24-94)
src/hooks/useUpdateReadingStatus.ts (2)
  • useUpdateReadingStatus (10-41)
  • bookIdentifiers (14-36)
src/components/BookReadingStatusForm/index.tsx (1)
  • BookReadingStatusForm (31-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: storybook-test
🔇 Additional comments (7)
src/constants/library-message.ts (1)

10-10: LGTM!

「すべて」タブの空メッセージが「よんだ」タブと同じ「ナニモナイ」になっていますが、意図的な設計と判断します。

src/app/(framed)/library/[status]/page.tsx (1)

35-35: バリデーションロジックは正常に動作します。

libraryReadingStatusSchema を使用してステータスのバリデーションを行っています。"all" を含むライブラリ専用のスキーマが正しく適用されており、実装に問題はありません。

Also applies to: 61-61

src/db/queries/status.ts (1)

71-75: "none" ステータスの除外を確認してください。

"all" ステータスの条件では ["want_read", "reading", "read"] のみを含め、"none" を除外しています。これは意図的な設計でしょうか?ユーザーの期待として、「すべて」タブでは "none"(よんでない)も含めた全ての書籍が表示されると解釈される可能性があります。

現在の実装では、「よんでない」ステータスの書籍はライブラリに登録されていないため除外されるのが正しい動作かもしれませんが、仕様として明確にしておくことをお勧めします。

src/constants/status.tsx (3)

56-63: LGTM!

"all" ステータスのメタデータが正しく定義されています。ラベル「すべて」と対応するアイコンが設定されており、実装に問題はありません。


6-7: アイコンファイルの存在を確認しました
src/assets/icons/bookmarks.svg と src/assets/icons/bookmarks-filled.svg が存在します。


66-66: readingStatusOrderBookReadingStatusForm で参照されていません
リポジトリ内に該当コンポーネントが存在せず、"all" が誤って表示される心配はありません。

Likely an incorrect or invalid review comment.

src/types/readingStatus.ts (1)

6-6: updateReadingStatus に “all” ステータスが渡らないことを保証してください。
コード検索では関数呼び出し箇所が検出できず、API 経由で“all”が誤って処理される可能性を排除できませんでした。リクエスト入力で“all”を拒否またはエラー化するバリデーションを実装済みか手動でご確認ください。

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.

ライブラリのステータスを横断して検索したい

2 participants