Skip to content

ETA表示をE231・JO・山手線iPad版のLineBoardへ横展開 - #6353

Merged
TinyKitten merged 2 commits into
devfrom
claude/eta-display-lineboard-rollout-o9bfr0
Jul 4, 2026
Merged

TinyKitten merged 2 commits into
devfrom
claude/eta-display-lineboard-rollout-o9bfr0

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 4, 2026 •

Copy link
Copy Markdown
Member

概要

到着予想時刻(ETA)表示を East/Toei/Saikyo/JRKyushu テーマの LineBoard に加え、E231・JO(山手線非iPad含む)・山手線iPad版(PadArch)の LineBoard にも横展開しました。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • LineBoard/shared/components/EstimatedMinutesBadge を新設し、既存 LineDot の ETA テキスト描画をこのコンポーネントに委譲
  • LineBoardE231 の駅ドット、LineBoardJO の barDot、PadArch(山手線iPad版アーチ表示) の駅サークルに、それぞれ ETA の数値オーバーレイを追加
  • 通過駅・到着中/通過中で縮小表示される駅ドットには ETA を表示しない(既存 LineDot の挙動と統一)
  • JR西日本テーマ(LineBoardWest)は実車に ETA 表示が無いため、今回の対象から明示的に除外
  • 各コンポーネントに ETA 描画のユニットテストを追加(LineBoardE231.test.tsx, PadArch.test.tsx は新規作成)

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

関連Issue

スクリーンショット(任意)


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • 駅ごとの推定所要時間を、路線図の駅アイコン上にバッジ表示できるようになりました。
    • 一部の路線表示で、駅ID別の推定分数が反映されるようになりました(通過・到着条件では非表示)。
  • Tests
    • 推定所要時間の表示/非表示や、バッジへの値の渡り方を確認するテストを追加しました。

@github-actions github-actions Bot added the react label Jul 4, 2026
@TinyKitten TinyKitten self-assigned this Jul 4, 2026
@coderabbitai

coderabbitai Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 69851d1b-f532-450b-b4e2-43e2d40b1605

📥 Commits

Reviewing files that changed from the base of the PR and between 6089c0b and 770366b.

📒 Files selected for processing (5)
  • src/components/LineBoardE231.test.tsx
  • src/components/LineBoardE231.tsx
  • src/components/LineBoardJO.test.tsx
  • src/components/LineBoardJO.tsx
  • src/components/PadArch.test.tsx

📝 Walkthrough

Walkthrough

EstimatedMinutesBadge を新規追加し、LineDot・LineBoardE231・LineBoardJO・LineBoardYamanotePad・PadArch で到着予想分数を取得して表示する流れを組み込みました。各表示箇所のテストも追加されています。

Changes

EstimatedMinutesBadge導入と統合

Layer / File(s) Summary
EstimatedMinutesBadgeの新規実装
src/components/LineBoard/shared/components/EstimatedMinutesBadge.tsx, src/components/LineBoard/shared/components/index.ts
estimatedMinutes を四捨五入して表示する EstimatedMinutesBadge と props 型を追加し、バレルからエクスポートしました。
LineDotの表示置換
src/components/LineBoard/shared/components/LineDot.tsx
インラインの数値表示を EstimatedMinutesBadge に置き換え、関連 import と estimatedMinutesText スタイルを削除しました。
LineBoardE231への統合
src/components/LineBoardE231.tsx, src/components/LineBoardE231.test.tsx
到着予想フックから route と駅別分数を取得し、StationNameCell に estimatedMinutes を渡して条件付きでバッジを表示するようにしました。対応テストを追加しました。
LineBoardJOへの統合
src/components/LineBoardJO.tsx, src/components/LineBoardJO.test.tsx
駅ID別の推定分数マップを作成し、非通過駅のドットに EstimatedMinutesBadge を表示するようにしました。対応テストを追加しました。
PadArchとYamanotePadの配線
src/components/PadArch.tsx, src/components/PadArch.test.tsx, src/components/LineBoardYamanotePad.tsx, src/components/LineBoardYamanotePad.test.tsx
PadArch に推定分数プロップと描画ロジックを追加し、LineBoardYamanotePad から値を渡すようにしました。両方のテストを追加しました。

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なら描画
Loading

Possibly related PRs

  • TrainLCD/MobileApp#6320: useEstimateArrivalTimes の実装と型が追加され、本PRの各表示コンポーネントがその出力を利用しています。
  • TrainLCD/MobileApp#6321: LineDot.tsx で estimatedMinutes をドット上に表示する同じ領域の変更があります。
  • TrainLCD/MobileApp#6330: LineDot.tsx の推定分表示スタイルに直接関係する変更です。

Poem

ぴょんと跳ねて時刻をみる
数字はまあるくバッジになる
ドットの上でちょこんと光り
うさぎも路線図を見上げる
もうすぐ着くね、ぴこぴこり 🐰

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 主要変更であるETA表示の横展開をE231・JO・山手線iPad版に簡潔に示しており、内容とも整合しています。
Description check ✅ Passed 概要・変更種類・変更内容・テストがテンプレートに沿って埋まっており、必要項目は概ね揃っています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/eta-display-lineboard-rollout-o9bfr0

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8939eb4 and 6089c0b.

📒 Files selected for processing (11)
  • src/components/LineBoard/shared/components/EstimatedMinutesBadge.tsx
  • src/components/LineBoard/shared/components/LineDot.tsx
  • src/components/LineBoard/shared/components/index.ts
  • src/components/LineBoardE231.test.tsx
  • src/components/LineBoardE231.tsx
  • src/components/LineBoardJO.test.tsx
  • src/components/LineBoardJO.tsx
  • src/components/LineBoardYamanotePad.test.tsx
  • src/components/LineBoardYamanotePad.tsx
  • src/components/PadArch.test.tsx
  • src/components/PadArch.tsx

Comment thread src/components/LineBoardE231.test.tsx Resolved
Comment thread src/components/LineBoardE231.test.tsx Resolved
Comment thread src/components/LineBoardE231.test.tsx Resolved
Comment thread src/components/LineBoardE231.tsx Resolved
Comment thread src/components/LineBoardJO.test.tsx Resolved
Comment thread src/components/LineBoardJO.tsx Resolved
Comment thread src/components/PadArch.test.tsx Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants