Skip to content

ディズニーリゾートラインを反時計回り一方向の環状線として正式対応 (#6049) - #6050

Merged
TinyKitten merged 1 commit into
devfrom
feature/disney-resort-line
May 25, 2026
Merged

TinyKitten merged 1 commit into
devfrom
feature/disney-resort-line

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 25, 2026 •

Copy link
Copy Markdown
Member

概要

ディズニーリゾートライン (lineId: 11345) を環状線として正式対応する。実車運行に合わせて反時計回りの一方向のみを経路探索・行先表示の候補とし、時計回り (INBOUND) は選べないようにする。

変更の種類

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

変更内容

  • DISNEY_RESORT_LINE_ID = 11345 を src/constants/line.ts に追加
  • 4 駅すべてを主要駅扱いした DISNEY_RESORT_LINE_MAJOR_STATIONS_ID を src/constants/station.ts に追加
  • src/hooks/useLoopLine.ts に isDisneyResortLine を導入し、isLoopLine に組み込み。inboundStationsForLoopLine は常に空配列を返すようにして、SelectBoundModal が時計回りボタンを描画しないようにした
  • src/hooks/useRefreshLeftStations.ts の loopLine 判定にディズニーリゾートラインを追加。これにより OUTBOUND 時に通常路線用の逆走ロジックが呼ばれて LineBoard の駅順が反転していた問題を解消
  • 同ファイルで「駅数 ≤ 8 の短い環状線では現在駅を先頭にした 1 周分のユニーク配列を返す」分岐を追加。従来は折返し時に同じ駅を 2 度含めて返していたため、各テーマ (8 駅枠 / 山手線 iPad アーチ 6 駅枠など) で React の key (station.id) が衝突していた
  • useLoopLine の型に新フィールドが増えたことに伴い、これを mock している useBoundText.test.tsx / useCanGoForward.test.tsx / useNextStation.test.tsx / useSlicedStations.test.tsx / useWrongDirectionDetector.test.tsx に isDisneyResortLine: false を追記
  • useLoopLine.test.tsx にディズニーリゾートライン専用のテストケースを 2 件追加 (環状線として検出されつつ INBOUND が常に空であること、配列末尾の駅を起点にしても環状的に主要駅を取得できること)

テスト

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

関連Issue

Closes #6049

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

Summary by CodeRabbit

リリースノート

  • 新機能
    • ディズニーリゾートラインのサポートを追加しました。環状線として正しく認識され、運行経路や駅情報が適切に表示されるようになります。

Review Change Stack

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

coderabbitai Bot commented May 25, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f19656e0-e5cd-41f9-9735-995e8563733d

📥 Commits

Reviewing files that changed from the base of the PR and between 18f65a6 and a2809ce.

📒 Files selected for processing (10)
  • src/constants/line.ts
  • src/constants/station.ts
  • src/hooks/useBoundText.test.tsx
  • src/hooks/useCanGoForward.test.tsx
  • src/hooks/useLoopLine.test.tsx
  • src/hooks/useLoopLine.ts
  • src/hooks/useNextStation.test.tsx
  • src/hooks/useRefreshLeftStations.ts
  • src/hooks/useSlicedStations.test.tsx
  • src/hooks/useWrongDirectionDetector.test.tsx

📝 Walkthrough

Walkthrough

This PR formally adds Disney Resort Line (ID 11345) support as a special loop line with one-way counterclockwise operation. Constants define the line ID and ordered major stations. The useLoopLine hook detects Disney Resort Line and classifies it as a loop line while enforcing empty inbound routes. Display logic handles the short 4-station route by preventing station deduplication collisions. Tests verify detection, operation constraints, and display behavior.

Changes

Disney Resort Line Support

Layer / File(s) Summary
Disney Resort Line constants
src/constants/line.ts, src/constants/station.ts
Line ID 11345 and ordered station array DISNEY_RESORT_LINE_MAJOR_STATIONS_ID are defined with comments documenting outbound-only usage and StationAPI ordering.
useLoopLine detection and one-way operation
src/hooks/useLoopLine.ts, src/hooks/useLoopLine.test.tsx
useLoopLine detects Disney Resort Line via ID and station matching, includes it in loop-line classification, forces inboundStationsForLoopLine to empty array for one-way behavior, and exports isDisneyResortLine flag. Tests verify detection, inbound emptiness, major stations in outbound, and loop-scan from terminal station.
Short loop station deduplication in display
src/hooks/useRefreshLeftStations.ts
Uses new isDisneyResortLine flag and implements early-return logic for loops with ≤8 stations to build unique station arrays with current station as origin, avoiding React key collision in short rotations. Updates loopLine useMemo dependencies.
Test mock compatibility updates
src/hooks/useBoundText.test.tsx, src/hooks/useCanGoForward.test.tsx, src/hooks/useNextStation.test.tsx, src/hooks/useSlicedStations.test.tsx, src/hooks/useWrongDirectionDetector.test.tsx
Extends useLoopLine mocks with isDisneyResortLine: false across all test files to maintain shape consistency after hook interface expansion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related issues

  • TrainLCD/Website#183: Related to Disney Resort Line loop-line and one-way implementation using same DISNEY_RESORT_LINE_ID constant and isDisneyResortLine flag.
  • TrainLCD/Issues#1186: Addresses reported incorrect station ordering for Disney Resort Line by implementing DISNEY_RESORT_LINE_MAJOR_STATIONS_ID with correct StationAPI order.

Suggested labels

react

Poem

🎡 ウサギはディズニーラインを認識して、
一方向のループを追跡し、
短い四駅の環状を整理する — 🔄
キーの衝突を回避し、
反時計回りの旅路は安全に。 🚃✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルはディズニーリゾートラインの環状線対応という主要な変更を明確かつ簡潔に要約しており、チェンジセット全体と一致している。
Description check ✅ Passed PR説明は概要、変更の種類、詳細な変更内容、テスト完了チェック、関連Issueを含み、テンプレートの必須項目をほぼカバーしている。
Linked Issues check ✅ Passed すべてのコード変更が#6049の要件を満たしている。ディズニーリゾートラインIDの追加、主要駅の定義、useLoopLineへのisDisneyResortLine導入、INBOUND常時空配列実装、テスト追加がすべて実装されている。
Out of Scope Changes check ✅ Passed すべての変更がディズニーリゾートラインの環状線対応および関連するテスト修正に限定されており、スコープ外の変更は認められない。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/disney-resort-line

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

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.

ディズニーリゾートラインの正式対応

1 participant