Repository navigation
ETA表示をE231・JO・山手線iPad版のLineBoardへ横展開 - #6353
Conversation
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HAtDgq51QAEey7ZxTK4cNb
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughEstimatedMinutesBadge を新規追加し、LineDot・LineBoardE231・LineBoardJO・LineBoardYamanotePad・PadArch で到着予想分数を取得して表示する流れを組み込みました。各表示箇所のテストも追加されています。 ChangesEstimatedMinutesBadge導入と統合
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant LineBoardYamanotePad
participant useEstimateArrivalTimes
participant useEstimatedMinutesByStationId
participant PadArch
participant EstimatedMinutesBadge
LineBoardYamanotePad->>useEstimateArrivalTimes: routeを取得
LineBoardYamanotePad->>useEstimatedMinutesByStationId: routeを渡してMapを取得
LineBoardYamanotePad->>PadArch: estimatedMinutesByStationIdを渡す
PadArch->>EstimatedMinutesBadge: estimatedMinutesが非nullなら描画
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🤖 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/components/LineBoardE231.test.tsx`:
- Around line 6-68: The test file’s repeated `jest.mock` setup for jotai,
~/hooks, ~/utils/isTablet, ~/utils/isPass, and shared components should be
reused instead of duplicated. Extract this common mock configuration into a
helper under src/utils/test/ and import it from LineBoardE231.test.tsx (and
other similar tests like LineBoardJO.test.tsx and PadArch.test.tsx), keeping the
existing mock behavior centralized and consistent.
- Around line 125-140: The current test only verifies the badge receives
estimatedMinutes and does not confirm the route wiring between hooks. Update the
LineBoardE231 test to assert that useEstimatedMinutesByStationId is called with
the route returned from useEstimateArrivalTimes, using the relevant hook symbols
from LineBoardE231 and the mocked hooks import, so the dependency connection is
validated as well.
- Around line 136-139: The test for EstimatedMinutesBadge is over-specifying the
component call by asserting the second argument as undefined, which depends on
React internals rather than the behavior under test. Update the assertion in
LineBoardE231.test.tsx to verify only the props relevant to the test, using the
EstimatedMinutesBadge mock and its toHaveBeenCalledWith expectation without
checking the Legacy Context-style second parameter.
In `@src/components/LineBoardE231.tsx`:
- Around line 108-114: The estimatedMinutes overlay in LineBoardE231 is masking
the passed-station gray state because the child view is using the
white-background dotInner styling. Update the overlay styling used by the
estimatedMinutes badge so it does not paint an opaque background and instead
lets the parent passed && !arrived gray styling remain visible, while keeping
the centering behavior in the estimatedMinutesOverlay container.
In `@src/components/LineBoardJO.test.tsx`:
- Around line 239-253: Add a negative-case test in LineBoardJO.test.tsx around
LineBoardJO and EstimatedMinutesBadge to verify that when
useEstimatedMinutesByStationId returns a Map without the target stationId entry,
the badge is not rendered/called or is called without estimatedMinutes. Reuse
the existing mocked hooks and the EstimatedMinutesBadge spy so the test clearly
covers the missing-entry path alongside the current positive case.
In `@src/components/LineBoardJO.tsx`:
- Around line 385-392: The conditional rendering in LineBoardJO currently calls
estimatedMinutesByStationId.get(stations[i].id) twice, which forces the cast on
the EstimatedMinutesBadge prop. Refactor this section to compute the lookup once
in a local variable before the JSX, then use that variable for both the null
check and the estimatedMinutes prop so the duplicate Map.get() call and the as
number assertion can be removed.
In `@src/components/PadArch.test.tsx`:
- Around line 84-104: Add test coverage for the missing ETA suppression case in
PadArch.tsx: currently only the isPass path is verified, but the arrived && i
=== stations.length - 2 branch of isSmallCircle is not. Update PadArch.test.tsx
to render with an arrived state that makes the penultimate station use the small
circle, and assert that EstimatedMinutesBadge is not called there. Use
renderPadArch and EstimatedMinutesBadge as the key symbols when locating the
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 50b78690-1055-41ef-8357-3f62dc517b00
📒 Files selected for processing (11)
src/components/LineBoard/shared/components/EstimatedMinutesBadge.tsxsrc/components/LineBoard/shared/components/LineDot.tsxsrc/components/LineBoard/shared/components/index.tssrc/components/LineBoardE231.test.tsxsrc/components/LineBoardE231.tsxsrc/components/LineBoardJO.test.tsxsrc/components/LineBoardJO.tsxsrc/components/LineBoardYamanotePad.test.tsxsrc/components/LineBoardYamanotePad.tsxsrc/components/PadArch.test.tsxsrc/components/PadArch.tsx
Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HAtDgq51QAEey7ZxTK4cNb
概要
到着予想時刻(ETA)表示を East/Toei/Saikyo/JRKyushu テーマの LineBoard に加え、E231・JO(山手線非iPad含む)・山手線iPad版(PadArch)の LineBoard にも横展開しました。
変更の種類
変更内容
LineBoard/shared/components/EstimatedMinutesBadgeを新設し、既存LineDotの ETA テキスト描画をこのコンポーネントに委譲LineBoardE231の駅ドット、LineBoardJOの barDot、PadArch(山手線iPad版アーチ表示) の駅サークルに、それぞれ ETA の数値オーバーレイを追加LineDotの挙動と統一)LineBoardWest)は実車に ETA 表示が無いため、今回の対象から明示的に除外LineBoardE231.test.tsx,PadArch.test.tsxは新規作成)テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Generated by Claude Code
Summary by CodeRabbit