Merged
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
📝 WalkthroughWalkthrough保存済みルート情報と現在の駅状態を用いて開始駅・経由駅・方向を決定する新フックを導入し、SelectBoundModal の駅選択フローをpresetStops経由で拡張。座標近接検索ユーティリティが追加され、モーダルに逆方向プリセットカードを表示する変化を加えています。 Changes
Sequence Diagram(s)sequenceDiagram
participant UI as "SelectBoundModal(UI)"
participant Hook as "usePresetStops(hook)"
participant Utils as "findNearestByCoord(util)"
participant Saved as "savedRoute/context"
rect rgba(0,120,200,0.5)
UI->>Saved: savedRoute.direction, wantedDestination
UI->>Hook: stations, wantedDestination, confirmedStation, savedRoute.direction
end
rect rgba(0,200,120,0.5)
Hook->>Utils: if needed -> find nearest intermediate station
Utils-->>Hook: nearestPresetStation
Hook-->>UI: { presetOrigin, presetStops, nearestPresetStation, resolvePresetDirection }
end
rect rgba(200,120,0,0.5)
UI->>UI: compute stops (stopsOverride or presetStops or stations segment)
UI->>UI: determine effectiveDirection/startStation
UI->>UI: update state, render bound buttons and reverse preset card
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/SelectBoundModal.tsx`:
- Around line 219-229: Add a mock for usePresetStops to the jest.mock("~/hooks",
...) in SelectBoundModal.test.tsx so tests don't fail; specifically, inside that
mock export include usePresetStops: jest.fn(() => ({ presetOrigin: null,
presetStops: undefined, nearestPresetStation: undefined, resolvePresetDirection:
jest.fn(() => 'INBOUND') })), ensuring the returned object shape matches how
SelectBoundModal imports and calls usePresetStops (presetOrigin, presetStops,
nearestPresetStation, resolvePresetDirection).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 7009578c-25d6-45cd-8b33-6ca52a1d1281
📒 Files selected for processing (6)
src/components/SelectBoundModal.tsxsrc/hooks/index.tssrc/hooks/usePresetStops.test.tssrc/hooks/usePresetStops.tssrc/utils/findNearestByCoord.test.tssrc/utils/findNearestByCoord.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
savedRoute.directionから起点駅を特定し、正しい路線情報(ラインカラー・ナンバリング)で表示usePresetStopsカスタムフックとfindNearestByCoordユーティリティに切り出しKey changes
src/utils/findNearestByCoord.ts— 座標ベースの最寄り駅検索(純粋関数)src/hooks/usePresetStops.ts— presetOrigin, presetStops, nearestPresetStation, resolvePresetDirection を提供するカスタムフックsrc/components/SelectBoundModal.tsx— インラインロジックをフックに置き換え、両方面カードの描画ロジックを追加Test plan
npm run typecheckパスnpx biome check --unsafe --fix ./srcパスfindNearestByCoordユニットテスト(7件)パスusePresetStopsフックテスト(14件)パス🤖 Generated with Claude Code
Summary by CodeRabbit
新機能
テスト