Repository navigation
プリセット保存時に始発・終着を保存するか選べるチェックボックスを追加 - #6654
Conversation
📝 WalkthroughWalkthroughプリセット保存時に、始発駅と終着駅を保持する設定を追加しました。 Changesプリセット端点保持
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant 利用者
participant SavePresetNameModal
participant SelectBoundModal
利用者->>SavePresetNameModal: プリセット名と端点保持設定を入力
SavePresetNameModal->>SelectBoundModal: nameとkeepEndpointsを送信
SelectBoundModal->>SelectBoundModal: 端点と通知対象駅を保存内容に設定
SelectBoundModal-->>利用者: プリセット保存を完了
Possibly related PRs
Poem
<fიქxed_issue_severity>Low</fixed_issue_severity> 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/components/SelectBoundModal.render.test.tsx (1)
399-413: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win端点を保存しない場合の保存済み表示を検証してください。
このテストは保存ペイロードだけを確認します。
保存後にsaveCurrentRouteのままであり、removeFromSavedRoutesに切り替わらないことも確認してください。
この分岐でsetSavedRoute(saved)が追加されても、現在のテストは検出できません。テスト追加例
await waitFor(() => expect(mockSaveRoute).toHaveBeenCalled()); expect(mockSaveRoute.mock.calls[0][0]).toMatchObject({ wantedDestinationId: null, originStationId: null, direction: null, }); +expect(screen.getByText('saveCurrentRoute')).toBeTruthy(); +expect(screen.queryByText('removeFromSavedRoutes')).toBeNull();🤖 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/SelectBoundModal.render.test.tsx` around lines 399 - 413, Update the test case for saving without endpoints to also verify the saved-state callback remains unchanged: assert that removeFromSavedRoutes is not called and saveCurrentRoute remains the active action after saving. Keep the existing payload assertions intact and use the existing mock/state symbols from the test setup.
🤖 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.
Nitpick comments:
In `@src/components/SelectBoundModal.render.test.tsx`:
- Around line 399-413: Update the test case for saving without endpoints to also
verify the saved-state callback remains unchanged: assert that
removeFromSavedRoutes is not called and saveCurrentRoute remains the active
action after saving. Keep the existing payload assertions intact and use the
existing mock/state symbols from the test setup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 129f35af-4b27-4fba-b272-7f76a3a239f0
📒 Files selected for processing (7)
assets/translations/en.jsonassets/translations/ja.jsonsrc/components/Checkbox.tsxsrc/components/SavePresetNameModal.test.tsxsrc/components/SavePresetNameModal.tsxsrc/components/SelectBoundModal.render.test.tsxsrc/components/SelectBoundModal.tsx
概要
プリセット保存モーダルに「始発・終着駅もそのまま保存する」チェックボックスを追加しました。デフォルトはオンで既存の挙動と同じです。オフにすると、行き先と始発駅で絞り込まずに停車パターンだけをプリセットとして保存できます。
変更の種類
変更内容
src/components/Checkbox.tsxを新規追加。LEDテーマ対応の汎用チェックボックスで、行全体がタップ領域。accessibilityRole="checkbox"を付与しているSavePresetNameModalにチェックボックスを追加。デフォルトはオンで、モーダルを開くたびにオンへリセットされる。onSubmitのシグネチャを(name, keepEndpoints)に変更し、チェックボックス自体は新規 propshowKeepEndpointsOptionが真のときだけ表示するSelectBoundModal側は行き先を指定しているときのみ選択肢を出す(showKeepEndpointsOption={!!wantedDestination})。行き先が未指定ならそもそも絞り込みが無く、チェックの有無で保存結果が変わらないためwantedDestinationId/originStationId/directionをすべてnullにする。結果としてプリセット表示時は路線の両端がそのまま始発・終着になるstations)に戻す。区間で絞らない以上、範囲外の通知駅を落とすのは不整合なためfindSavedRouteが一致せず、フラグを立てても直後の再検索で戻ってしまうためpresetKeepEndpointsLabel/presetKeepEndpointsDescriptionを ja / en の翻訳に追加退行リスクと緩和策
SavePresetNameModal.onSubmitの引数が 1 個から 2 個に増えるが、呼び出し元はSelectBoundModalの 1 箇所のみ(rgで確認済み)。型チェックも通過しているdirection: nullになるが、これはoriginStationId追加前の古いプリセットと同じ形で、getPresetRouteEndpoints/usePresetStopsは既に null を扱えるようになっているCustomModalのavoidKeyboard配下にあるため通常は問題にならない想定だが、実機確認が未実施(下記参照)テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ることローカルで実行したコマンド:
追加したテスト:
src/components/SavePresetNameModal.test.tsx(新規 4 件)— チェックボックスの表示条件、既定オン、オフ時にkeepEndpoints: falseが渡ること、再表示でオンへ戻ることsrc/components/SelectBoundModal.render.test.tsx(新規 6 件)— 行き先の有無による選択肢の出し分け、オン/オフでのwantedDestinationId/originStationId/directionの保存内容、通知駅の絞り込み範囲関連Issue
スクリーンショット(任意)
実行環境に iOS シミュレータ/Android エミュレータが無いため、UI のスクリーンショットは未添付です。マージ前に実機での見た目確認をお願いします。
Generated by Claude Code
Summary by CodeRabbit