Repository navigation
経路検索の種別一覧を種別ごとの起点路線デザインで表示しヘッダーを行先路線名に変更 - #6251
Conversation
Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesTrainTypeList ユーティリティ抽出とモーダル更新
Sequence DiagramsequenceDiagram
participant Modal as TrainTypeListModal
participant getOriginLine
participant getViaLines
participant formatLineNames
participant Card as CommonCard (per item)
Modal->>Modal: trainTypes 計算(destination フィルタ分岐削除)
Modal->>Modal: renderItem 呼び出し
renderItem->>getOriginLine: lines, selectedLine, destination
getOriginLine-->>renderItem: originLine
renderItem->>getViaLines: lines, selectedLine, destination
getViaLines-->>renderItem: viaLines[]
renderItem->>formatLineNames: viaLines, ja
formatLineNames-->>renderItem: via 路線名文字列
renderItem->>Card: line=originLine, via 路線名
Note over Card: targetStation 廃止、line で路線シンボル固定
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai ちょっとレビュー遅くないですか? |
|
Tip For best results, initiate chat on the files or code changes.
(´;ω;`)🐰 |
|
@CodeRabbit resume |
✅ Action performedReviews resumed. |
|
@CodeRabbit review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/components/TrainTypeListModal.tsx (1)
112-169: 🏗️ Heavy liftモーダル結線の統合テストを1件追加しておくと安全です
ここは表示仕様の結線(
originLine計算→CommonCard反映、via subtitle 生成)が変更された箇所なので、TrainTypeListModal側で 1 ケースでも統合寄りに担保しておくと退行を防ぎやすいです(例: destination あり時にCommonCardへ起点路線デザインが渡ること)。As per coding guidelines,
**/*.{test,spec}.{ts,tsx,js,jsx,py,java,go,cs}の「Test agents in isolation and with integration tests to ensure correctness and compatibility」と、src/**/*.test.{ts,tsx}の「When modifying behavior, update or add tests in the same change set.」に基づく提案です。🤖 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 `@src/components/TrainTypeListModal.tsx` around lines 112 - 169, Add an integration test for the TrainTypeListModal component to ensure the modified display logic for train type lines is working correctly. The test should verify that when a destination is provided, the originLine is calculated properly and the correct line design is passed to the CommonCard component. This test will help prevent regressions in the renderItem callback's originLine calculation and subtitle generation logic, particularly when handling multiple grouped via lines.Source: Coding guidelines
🤖 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 `@src/utils/trainTypeList.test.ts`:
- Around line 1-3: The test file is missing the required `afterEach` hook that
clears all mocks after each test. Following the coding convention for test files
in src/**/*.test.{ts,tsx}, add an `afterEach(() => jest.clearAllMocks())`
statement to ensure all mocks are properly cleared between test cases. This
should be added after the import statements at the top level of the test file.
In `@src/utils/trainTypeList.ts`:
- Around line 100-105: The code in the condition where `group.length > 1`
assigns `companyName` from either `nameShort` or `nameEnglishShort` but does not
validate that these values are defined, potentially resulting in strings like
"undefined線" or "undefined Line". After assigning `companyName`, add a check to
determine if `companyName` is falsy. If it is falsy, return a fallback value by
concatenating the line names from items within the group instead of using the
undefined company name. Only use the current template literal approach when
`companyName` has a valid truthy value.
---
Nitpick comments:
In `@src/components/TrainTypeListModal.tsx`:
- Around line 112-169: Add an integration test for the TrainTypeListModal
component to ensure the modified display logic for train type lines is working
correctly. The test should verify that when a destination is provided, the
originLine is calculated properly and the correct line design is passed to the
CommonCard component. This test will help prevent regressions in the renderItem
callback's originLine calculation and subtitle generation logic, particularly
when handling multiple grouped via lines.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 624ea123-76ca-4d8f-8459-18b4a6bc6710
📒 Files selected for processing (4)
src/components/TrainTypeListModal.test.tsxsrc/components/TrainTypeListModal.tsxsrc/utils/trainTypeList.test.tssrc/utils/trainTypeList.ts
💤 Files with no reviewable changes (1)
- src/components/TrainTypeListModal.test.tsx
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 2 file(s) based on 2 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 2 file(s) based on 2 unresolved review comments. Co-authored-by: CodeRabbit <[email protected]>
概要
経路検索の列車種別一覧モーダルで、各種別が通る路線に関係なく単一路線のデザイン(背景色・路線記号)で
CommonCardが表示されていた不具合を修正しました。あわせて表示ロジックを切り出して整理し、ユニットテストを追加しています。変更の種類
変更内容
item.linesから特定し、CommonCardをその路線の配色・路線記号で描画するように修正(例: 池袋→元町・中華街でみなとみらい線を選んだ際、東武東上線経由の種別に西武池袋線のデザインが当たる問題を解消)。destination.line)の反対側の端」を始発側として判定。経由路線(サブタイトル)の算出も起点路線基準に統一。getOriginLine/getViaLines/formatLineNames)をsrc/utils/trainTypeList.tsに抽出。実体を import して検証するユニットテスト(16 ケース)をsrc/utils/trainTypeList.test.tsに追加し、コンポーネント内ロジックのコピーを検証していた陳腐化済みのTrainTypeListModal.test.tsxを削除。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit