Conversation
📝 WalkthroughWalkthroughThis PR introduces a customizable Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Review Summary by QodoAdd sectionLabel to books and redefine daxue/zhongyong sections
WalkthroughsDescription• Add sectionLabel field to book schema for flexible section naming • Redefine daxue sections from 1 to 6 chapters structure • Redefine zhongyong sections from 1 to 19 chapters structure • Add section labels to all classical texts (篇, 章, 経) • Update UI to dynamically display section labels instead of hardcoded text Diagramflowchart LR
A["Book Schema"] -->|"Add sectionLabel field"| B["Updated Book Interface"]
C["YAML Data"] -->|"Add sectionLabel values"| D["Enhanced Book Definitions"]
D -->|"Redefine sections"| E["Daxue: 1→6 sections<br/>Zhongyong: 1→19 sections"]
B -->|"Use dynamic labels"| F["UI Components"]
F -->|"Display flexible labels"| G["Section Pages & Metadata"]
File Changes1. src/types/book.ts
|
|
Visit the preview URL for this PR (updated for commit fb26a1a): https://izuminokami-kanesada--pr133-issue-90-6s25qnf3.web.app (expires Fri, 20 Feb 2026 03:30:34 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 4c4412227845b968bcb4c8b6996048cdd07fd6de |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@contents/books.yaml`:
- Around line 117-141: The books.yaml defines daxue with six sections and
zhongyong with nineteen, but the input content only exists under
contents/input/daxue/1/1.yaml and contents/input/zhongyong/1/1.yaml; fix by
reorganizing the input directory structure to match those section definitions:
create directories contents/input/daxue/2 through contents/input/daxue/6 and
contents/input/zhongyong/2 through contents/input/zhongyong/19, then move or
split the appropriate chapter YAML files into each section directory so that
each section directory contains its chapter files (e.g.,
contents/input/daxue/3/1.yaml for daxue section id '3'); ensure file names and
IDs match the section ids listed in books.yaml so the content generator can find
files for functions/process that read those paths.
In `@src/app/books/`[bookId]/[sectionId]/page.tsx:
- Line 39: In generateMetadata, the local variable sectionLabel (declared as
const sectionLabel = book.sectionLabel ?? '編') is unused; either remove that
declaration from generateMetadata or use sectionLabel when building the
title/description (e.g., incorporate sectionLabel into the title/description
construction where book.title and sectionTitle are combined). Update the
generateMetadata function to reference sectionLabel (or delete the const) so
there are no unused variables.
🧹 Nitpick comments (2)
src/app/books/[bookId]/page.tsx (1)
120-120: ExtractsectionLabelto a local variable for consistency.The
generateMetadatafunction (Line 30) already extracts this to aconst sectionLabel, but the render function repeats the inline fallbackbook.sectionLabel ?? '編'. For consistency with the other page files (page.tsx,[sectionId]/page.tsx) that use a local variable, consider doing the same here.♻️ Suggested change
Add a local variable in
BookPage(e.g., after Line 57) and use it at Line 120:const { prev, next } = getAdjacentBookIds(bookId); + const sectionLabel = book.sectionLabel ?? '編'; const prevBook = prev ? getBookById(prev) : null;- {book.sectionLabel ?? '編'}一覧 + {sectionLabel}一覧src/app/books/[bookId]/[sectionId]/page.tsx (1)
105-105: Hardcoded'編'in fallback labels is inconsistent with dynamicsectionLabel.The fallback strings
'前の編'(Line 105) and'次の編'(Line 118) still use the hardcoded'編'. While these are effectively unreachable (the parent conditional ensuresprevUrl/nextUrlare non-null only when the labels are defined), they'd be incorrect if the code were ever restructured. Consider using the dynamic label for defensive consistency.♻️ Suggested change
- <span>{prevLabel ?? '前の編'}</span> + <span>{prevLabel ?? `前の${sectionLabel}`}</span>- <span>{nextLabel ?? '次の編'}</span> + <span>{nextLabel ?? `次の${sectionLabel}`}</span>Also applies to: 118-118
| - id: daxue | ||
| name: 大学 | ||
| compositionYear: -450 # 曾子の作とされる | ||
| totalSections: 1 | ||
| sectionLabel: 章 | ||
| totalSections: 6 | ||
| sections: | ||
| - id: '1' | ||
| name: 大学 | ||
| totalChapters: 11 | ||
| name: 第一章 | ||
| totalChapters: 3 | ||
| - id: '2' | ||
| name: 第二章 | ||
| totalChapters: 4 | ||
| - id: '3' | ||
| name: 第三章 | ||
| totalChapters: 1 | ||
| - id: '4' | ||
| name: 第四章 | ||
| totalChapters: 1 | ||
| - id: '5' | ||
| name: 第五章 | ||
| totalChapters: 2 | ||
| - id: '6' | ||
| name: 第六章 | ||
| totalChapters: 4 | ||
|
|
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check the directory structure under contents/input/daxue/
echo "=== daxue directory structure ==="
fd . contents/input/daxue/ --type f 2>/dev/null || echo "No daxue input directory found"
echo ""
echo "=== zhongyong directory structure ==="
fd . contents/input/zhongyong/ --type f 2>/dev/null || echo "No zhongyong input directory found"Repository: Rindrics/izuminokami-kanesada
Length of output: 209
Input directory structure does not match the new daxue and zhongyong section definitions.
The YAML defines daxue with 6 sections and zhongyong with 19 sections, but the input directories contain only contents/input/daxue/1/1.yaml and contents/input/zhongyong/1/1.yaml. The content generation script will not find files for sections 2-6 (daxue) and 2-19 (zhongyong), leaving these sections empty. Reorganize the input files to match the new section structure: contents/input/daxue/1/, contents/input/daxue/2/, ..., contents/input/daxue/6/ and similarly for zhongyong.
🤖 Prompt for AI Agents
In `@contents/books.yaml` around lines 117 - 141, The books.yaml defines daxue
with six sections and zhongyong with nineteen, but the input content only exists
under contents/input/daxue/1/1.yaml and contents/input/zhongyong/1/1.yaml; fix
by reorganizing the input directory structure to match those section
definitions: create directories contents/input/daxue/2 through
contents/input/daxue/6 and contents/input/zhongyong/2 through
contents/input/zhongyong/19, then move or split the appropriate chapter YAML
files into each section directory so that each section directory contains its
chapter files (e.g., contents/input/daxue/3/1.yaml for daxue section id '3');
ensure file names and IDs match the section ids listed in books.yaml so the
content generator can find files for functions/process that read those paths.
| return { title: 'セクションが見つかりません' }; | ||
| } | ||
|
|
||
| const sectionLabel = book.sectionLabel ?? '編'; |
There was a problem hiding this comment.
Unused variable sectionLabel in generateMetadata.
sectionLabel is declared on Line 39 but never referenced in the description or title construction (Lines 40–41). Either remove it or incorporate it into the description if that was the intent.
🔧 Remove unused variable
- const sectionLabel = book.sectionLabel ?? '編';
const title = `${section.name} - ${book.name}`;📝 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.
| const sectionLabel = book.sectionLabel ?? '編'; | |
| const title = `${section.name} - ${book.name}`; |
🤖 Prompt for AI Agents
In `@src/app/books/`[bookId]/[sectionId]/page.tsx at line 39, In generateMetadata,
the local variable sectionLabel (declared as const sectionLabel =
book.sectionLabel ?? '編') is unused; either remove that declaration from
generateMetadata or use sectionLabel when building the title/description (e.g.,
incorporate sectionLabel into the title/description construction where
book.title and sectionTitle are combined). Update the generateMetadata function
to reference sectionLabel (or delete the const) so there are no unused
variables.
Code Review by Qodo
1. liji section name redundant
|
|
|
||
| - id: liji | ||
| name: 礼記 | ||
| sectionLabel: 篇 |
There was a problem hiding this comment.
1. liji section name redundant 📎 Requirement gap ✓ Correctness
liji is still defined with a single section whose name equals book.name, which can keep the redundant UI hierarchy (e.g., 礼記 → 礼記 → ...). This does not satisfy the requirement to eliminate consecutive book.name/section.name duplication for 礼記.
Agent Prompt
## Issue description
`liji`(礼記)が単一セクションかつ `section.name === book.name` のため、UIで `礼記 → 礼記 → ...` の冗長な階層表示が発生し得ます。
## Issue Context
PR Compliance ID 7 では、大学・中庸・礼記において `book.name` と同文言の `section` が連続表示されないことが要件です。
## Fix Focus Areas
- contents/books.yaml[256-263]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| sectionLabel: 章 | ||
| totalSections: 6 | ||
| sections: | ||
| - id: '1' | ||
| name: 大学 | ||
| totalChapters: 11 | ||
| name: 第一章 | ||
| totalChapters: 3 | ||
| - id: '2' | ||
| name: 第二章 | ||
| totalChapters: 4 | ||
| - id: '3' | ||
| name: 第三章 | ||
| totalChapters: 1 | ||
| - id: '4' | ||
| name: 第四章 | ||
| totalChapters: 1 | ||
| - id: '5' | ||
| name: 第五章 | ||
| totalChapters: 2 | ||
| - id: '6' | ||
| name: 第六章 | ||
| totalChapters: 4 | ||
|
|
||
| - id: zhongyong | ||
| name: 中庸 | ||
| compositionYear: -430 # 子思の作とされる | ||
| totalSections: 1 | ||
| sectionLabel: 章 | ||
| totalSections: 19 |
There was a problem hiding this comment.
2. Daxue/zhongyong still sectioned 📎 Requirement gap ✓ Correctness
大学・中庸について、section無し(または空セクション)で章を扱える形(A案/B案)になっておらず、複数の命名セクションを導入しています. This does not meet the checklist requirement that UI should be able to treat them as having no sections (or an empty section) without inconsistency.
Agent Prompt
## Issue description
大学・中庸の構造が、要件で提示された A案(section無し)/B案(空セクションをUI上section無し扱い)のどちらにもなっておらず、複数の命名セクションを作っています。
## Issue Context
PR Compliance ID 8 は、大学・中庸を「sectionなしでも章を扱える」か「空セクションでUI上はsection無し表示」にすることを求めています。
## Fix Focus Areas
- contents/books.yaml[117-146]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| return { title: 'セクションが見つかりません' }; | ||
| } | ||
|
|
||
| const sectionLabel = book.sectionLabel ?? '編'; |
There was a problem hiding this comment.
3. Unused sectionlabel in metadata 🐞 Bug ⛯ Reliability
generateMetadata in the section page declares sectionLabel but never uses it. With Biome linter enabled (recommended rules) and CI running biome check src, this will fail lint and block merges/builds.
Agent Prompt
### Issue description
`src/app/books/[bookId]/[sectionId]/page.tsx` defines `sectionLabel` inside `generateMetadata`, but the variable is unused. With Biome recommended lint rules enabled and CI running `biome check src`, this will fail lint.
### Issue Context
`sectionLabel` is used later in the page component for prev/next labels, but not in the `generateMetadata` function scope.
### Fix Focus Areas
- src/app/books/[bookId]/[sectionId]/page.tsx[30-47]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Summary by CodeRabbit
New Features
Improvements