Repository navigation
CommonCard改良 - #4712
CommonCard改良#4712
Conversation
|
Note
|
| Cohort / File(s) | Change Summary |
|---|---|
路線名の重複排除 src/components/RouteInfoModal.tsx, src/components/StationSearchModal.tsx, src/components/TrainTypeListModal.tsx |
各モーダルでサブタイトル構築時に路線名の配列をSetで処理して重複排除を実施。日本語はnameShort、その他はnameRomanを使用し、前後のjoin()で適切な区切り文字を適用 |
カラー処理の改善 src/components/CommonCard.tsx |
オプショナルチェーニングでステーション確認を簡潔化し、最初のステーション番号からlineSymbolColorを読み込んでtargetStationColorを構築。TransferLineMarkにcolorプロップを渡し、優先順位に従いカラー解決を実施 |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
- 路線名の重複排除ロジックは3ファイルで同じパターンであり、各コンテキストでの正確性を確認する必要があります
- CommonCardのカラー処理では、targetStationColorの解決順序とフォールバック動作を検証してください
- 各モーダルでセットの処理がUI表示に正しく反映されているかを確認してください
Possibly related PRs
- JR九州風テーマ ナンバリングの配色修正 #4404: 両PRともUIカラーロジックを変更し、ステーション/路線カラーの代わりにnumberingオブジェクトのlineSymbolColorを優先します
- 各線の種別に経由路線全て表示 #4112: 両PRともUI表示用の路線リストに重複排除ロジックを追加します
- 検索系機能のUI改善 #4568: 両PRともStationSearchModalに関連する変更があり、重複排除ロジックが関わります
Suggested labels
react
Poem
🐰 4つのコンポーネント、色とりどりに光りて
重複なく、すっきりと名前が並びぬ
シンボルカラー優しく、Setは重複を払いのけ
UIの整理整頓、完成かな ✨
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Title check | タイトル「CommonCard改良」は、主にCommonCardコンポーネントの改良のみに焦点を当てていますが、実際にはRouteInfoModal、StationSearchModal、TrainTypeListModalなど複数のコンポーネントが変更されており、全体的な変更内容を正確に反映していません。 | タイトルを「複数のモーダルコンポーネント内のライン名重複排除と色プロップの追加」など、すべての変更ファイルを適切に反映した内容に修正してください。 |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ 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
fix/common-card
📜 Recent review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/components/CommonCard.tsx(3 hunks)src/components/RouteInfoModal.tsx(1 hunks)src/components/StationSearchModal.tsx(1 hunks)src/components/TrainTypeListModal.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/{components,screens}/**/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Component files should use PascalCase naming (e.g.,
StationBanner.tsx)Use PascalCase for component file names (e.g.,
StationBanner.tsx)
Files:
src/components/StationSearchModal.tsxsrc/components/RouteInfoModal.tsxsrc/components/CommonCard.tsxsrc/components/TrainTypeListModal.tsx
**/*.{ts,tsx,js,jsx,json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Biome as the formatter for all code files
Files:
src/components/StationSearchModal.tsxsrc/components/RouteInfoModal.tsxsrc/components/CommonCard.tsxsrc/components/TrainTypeListModal.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx,js,jsx}: Use Biome as the linter for all code files
Use// biome-ignoreonly for true compatibility issues and include an inline reasonUse
.editorconfigstandards: UTF-8 encoding, two-space indentation, single quotes, and ES5 trailing commas
Files:
src/components/StationSearchModal.tsxsrc/components/RouteInfoModal.tsxsrc/components/CommonCard.tsxsrc/components/TrainTypeListModal.tsx
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Biome is authoritative for linting; avoid
// biome-ignoreunless a rule is truly incompatible and document the rationale inline
Files:
src/components/StationSearchModal.tsxsrc/components/RouteInfoModal.tsxsrc/components/CommonCard.tsxsrc/components/TrainTypeListModal.tsx
🧠 Learnings (6)
📓 Common learnings
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.
📚 Learning: 2025-05-19T10:59:37.813Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Applied to files:
src/components/StationSearchModal.tsxsrc/components/RouteInfoModal.tsxsrc/components/CommonCard.tsxsrc/components/TrainTypeListModal.tsx
📚 Learning: 2025-11-25T03:10:44.293Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T03:10:44.293Z
Learning: Applies to src/{components,screens}/**/*.tsx : Use PascalCase for component file names (e.g., `StationBanner.tsx`)
Applied to files:
src/components/StationSearchModal.tsx
📚 Learning: 2025-07-18T11:04:45.459Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。
Applied to files:
src/components/StationSearchModal.tsxsrc/components/RouteInfoModal.tsxsrc/components/CommonCard.tsxsrc/components/TrainTypeListModal.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/{components,screens}/**/*.tsx : Component files should use PascalCase naming (e.g., `StationBanner.tsx`)
Applied to files:
src/components/StationSearchModal.tsx
📚 Learning: 2025-11-03T12:13:46.409Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4595
File: src/components/LineBoardEast.tsx:497-504
Timestamp: 2025-11-03T12:13:46.409Z
Learning: In TrainLCD/MobileApp LineBoard components (LineBoardEast, LineBoardWest, LineBoardSaikyo, LineBoardToei, LineBoardJRKyushu), the correct implementation pattern is to apply the dynamic width (dim.width / 9) to the outer stationNameContainer View, as implemented in LineBoardEast, not to the inner wrapper View.
Applied to files:
src/components/StationSearchModal.tsx
🔇 Additional comments (5)
src/components/RouteInfoModal.tsx (1)
113-114: 路線名の重複排除ロジックが適切に実装されています。
Setを使用した重複排除により、サブタイトルに同じ路線名が複数回表示されることを防いでいます。日本語と英語の両方に対応しており、実装は明確です。src/components/StationSearchModal.tsx (1)
167-168: RouteInfoModalと同様の重複排除ロジックが実装されています。複数のモーダルコンポーネント間で一貫性のあるアプローチが採用されており、サブタイトルの表示品質が向上します。
src/components/CommonCard.tsx (2)
162-162: オプショナルチェーニングの使用により、コードが簡潔になっています。
!stations?.lengthは以前の!stations || !stations.lengthよりも読みやすく、同じ動作を維持しています。
194-195: 駅固有の路線シンボルカラーを活用する改良が実装されています。
lineSymbolColorから色を抽出し、フォールバックチェーン(targetStationColor ?? line.color ?? undefined)で適切にTransferLineMarkに渡すことで、より正確な色表示が可能になります。Also applies to: 232-232
src/components/TrainTypeListModal.tsx (1)
144-144: 経由路線の重複排除が適切に実装されています。目的地が指定された際の経由路線表示において、他のモーダルコンポーネントと一貫した重複排除ロジックが使用されています。「直通」表示や「Via」表示の品質が向上します。
Also applies to: 148-148
Comment @coderabbitai help to get the list of available commands and usage tips.
Summary by CodeRabbit
バグ修正
✏️ Tip: You can customize this high-level summary in your review settings.