Repository navigation
SelectBoundModalボタン整理 - #4636
Conversation
|
Note
|
| Cohort / File(s) | 変更内容 |
|---|---|
翻訳ファイル更新 assets/translations/en.json, assets/translations/ja.json |
通知設定関連キー(notifySettings、notifySettingsTitle、selectBoundSettings、eachTrainTypes)を削除し、新しいtrainTypesNotExistキーを追加 |
フォントサイズの応答性対応 src/components/RouteInfoModal.tsx, src/components/TrainTypeListModal.tsx |
RFValueを使用した応答型フォントサイジングの実装 |
SelectBoundModal拡張 src/components/SelectBoundModal.tsx |
useMemoの追加、列車タイプモーダル表示状態の管理、TrainTypeListModalの統合、列車タイプ選択ボタンUIの追加 |
SelectBoundSettingListModal簡略化 src/components/SelectBoundSettingListModal.tsx |
列車タイプ関連機能の削除、Propsシグネチャの削減(isLoopLine、line、onTrainTypeSelectを除去) |
スクリーン - 状態管理クリーンアップ src/screens/RouteSearchScreen.tsx, src/screens/SelectLineScreen.tsx |
モーダル閉鎖時およびフロー完了時におけるtrainType: nullのリセット処理追加 |
Sequence Diagram
sequenceDiagram
participant User as ユーザー
participant SBM as SelectBoundModal
participant TNLM as TrainTypeListModal
participant Nav as ナビゲーション状態
User->>SBM: モーダル開く
SBM->>Nav: fetchedTrainTypesを取得
User->>SBM: 列車タイプボタンをクリック
SBM->>Nav: trainType: nullにリセット
SBM->>TNLM: モーダルを表示
User->>TNLM: 列車タイプを選択
TNLM->>Nav: onTrainTypeSelectで選択を適用
TNLM->>SBM: モーダルを閉鎖
User->>SBM: 終了駅を選択
SBM->>Nav: trainType状態を保持したまま完了
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
- SelectBoundModalの複雑な状態管理: useMemoの導入、finalStopの計算ロジック、trainTypeTextのメモ化処理に対する詳細な検証が必要
- Props変更の影響範囲: SelectBoundSettingListModalのPropsシグネチャの削減が他のコンポーネントの呼び出し側に影響していないかの確認
- 複数スクリーンにおけるtrainType状態リセット: RouteSearchScreenとSelectLineScreenの両方でのリセットロジックが一貫性を持っているかの検証
Possibly related PRs
- 累積的UI改善とリファクタリング #4526: SelectBoundModalとSelectBoundSettingListModalの列車タイプ関連Propsと状態処理を直接変更
- メイン画面から行先選択画面に遷移した際に種別と駅情報が消えるバグを修正 #4116: useResetMainStateとナビゲーション状態の列車タイプハンドリングの変更
- トグルボタン実装&オートモードで使用開始 #4630: SelectBoundSettingListModalの同じコンポーネントでUIボタンの変更を実施
Suggested labels
react
Poem
🐰 列車の型を選べるように、
モーダルは踊り、状態クリア
通知設定は去りて、
新たなUI、ユーザー喜ぶ
🚄✨
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | プルリクエストのタイトルは「SelectBoundModalボタン整理」であり、変更内容の主要な部分であるボタン配置の整理と新しい列車種別モーダルの追加を反映しています。 |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
✨ Finishing touches
- 📝 Generate docstrings
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Post copyable unit tests in a comment
- Commit unit tests in branch
feature/select-bound-modal-enhance
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/screens/RouteSearchScreen.tsx (1)
446-449:onCloseでtrainTypeをリセットするならコメントも合わせた方がよさそうです
SelectBoundModalクローズ時にtrainTypeをnullに戻すことで状態リークを防げている一方、直上のコメント「選択状態はリセットしない」とはやや食い違っています。挙動自体は妥当なので、コメントを現状の仕様に合わせて更新しておくと読み手に親切だと思います。
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
assets/translations/en.json(1 hunks)assets/translations/ja.json(1 hunks)src/components/RouteInfoModal.tsx(2 hunks)src/components/SelectBoundModal.tsx(9 hunks)src/components/SelectBoundSettingListModal.tsx(1 hunks)src/components/TrainTypeListModal.tsx(2 hunks)src/screens/RouteSearchScreen.tsx(1 hunks)src/screens/SelectLineScreen.tsx(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2024-12-18T00:29:05.817Z
Learning: 翻訳ファイル(`assets/translations/en.json` と `assets/translations/ja.json`)の変更を要約する際、`backgroundPermissionDenied` のようなキーが追加されているのか削除されているのかを正確に確認する。
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。
📚 Learning: 2024-12-18T00:29:05.817Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2024-12-18T00:29:05.817Z
Learning: 翻訳ファイル(`assets/translations/en.json` と `assets/translations/ja.json`)の変更を要約する際、`backgroundPermissionDenied` のようなキーが追加されているのか削除されているのかを正確に確認する。
Applied to files:
assets/translations/ja.jsonassets/translations/en.json
📚 Learning: 2025-07-18T11:04:45.459Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。
Applied to files:
assets/translations/ja.jsonsrc/components/SelectBoundSettingListModal.tsxsrc/components/SelectBoundModal.tsxsrc/screens/SelectLineScreen.tsx
📚 Learning: 2025-05-19T10:59:37.813Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Applied to files:
src/components/SelectBoundSettingListModal.tsxsrc/components/SelectBoundModal.tsxsrc/screens/RouteSearchScreen.tsxsrc/screens/SelectLineScreen.tsxsrc/components/TrainTypeListModal.tsx
🧬 Code graph analysis (3)
src/components/RouteInfoModal.tsx (1)
src/utils/rfValue.ts (1)
RFValue(3-18)
src/components/SelectBoundModal.tsx (2)
src/translation.ts (2)
translate(7-12)isJapanese(23-24)src/components/TrainTypeListModal.tsx (1)
TrainTypeListModal(77-258)
src/components/TrainTypeListModal.tsx (1)
src/utils/rfValue.ts (1)
RFValue(3-18)
🔇 Additional comments (11)
src/components/RouteInfoModal.tsx (1)
12-36: RFValue を使った見出しのレスポンシブ化は問題なさそうです
boldTypographyにRFValue(12)を適用してタイトルをスケーリングしており、既存レイアウトとも競合していないように見えます。assets/translations/ja.json (1)
195-196: 列車種別まわりの文言とプレースホルダーは整合しています
trainTypeIsの%{trainTypeName}プレースホルダーはSelectBoundModalのtranslate('trainTypeIs', { trainTypeName })と一致しており、trainTypesNotExistも「種別なし」ボタン文言として自然です。en.json側ともキー構造が揃っていて問題なさそうです。assets/translations/en.json (1)
194-195: 英語訳もコードと噛み合っています
"Train type: %{trainTypeName}"および"No train types available"は日本語側と意味が対応しており、SelectBoundModalのtrainTypeTextロジックとも齟齬はなさそうです。src/components/SelectBoundSettingListModal.tsx (1)
2-9: 設定モーダルの i18n 対応は妥当ですラベルをすべて
translate('settings' | 'autoModeSettings' | 'close')に寄せており、翻訳キーも既存定義と一致しているので問題なさそうです。src/components/TrainTypeListModal.tsx (1)
13-58: サブタイトルの RFValue 化は適切です
subtitleにRFValue(12)を使うことで、RouteInfoModal と同様に小見出しのサイズが画面高さに追従するようになっており、副作用も特に見当たりません。src/screens/SelectLineScreen.tsx (1)
626-630:handleCloseSelectBoundModalでのtrainTypeリセットは一貫性があります
pendingWantedDestinationと同時にtrainTypeもクリアしており、ナビゲーション状態のリセットポリシーが他の画面と揃っていて良いと思います。src/components/SelectBoundModal.tsx (5)
104-116: 列車種別関連の state 追加は既存ロジックと矛盾していません
isTrainTypeModalVisibleとナビゲーション atom からのfetchedTrainTypes取り出しにより、このコンポーネントだけで列車種別モーダルを制御できるようになっており、useSavedRoutes周りの既存 useEffect とも衝突していないように見えます。
247-251:finalStopを導入したtargetStation指定は妥当です
boundStationsの先頭/末尾からfinalStopを求めてCommonCardのtargetStationに渡すことで、特にpendingWantedDestination経由のケースでも終点駅を明示できていて分かりやすいです。呼び出し側でinboundStations.length/outboundStations.lengthをチェックしているため、空配列アクセスの心配もほぼ無いと思います。
452-466:trainTypeTextのメモ化ロジックは扱いやすくなっています
- 種別が一つも無い場合は
trainTypesNotExist、未選択時はtrainTypeSettings、選択済みならtrainTypeIsという 3 状態にまとめられており、UI の意図が明確です。- 依存配列も
fetchedTrainTypes/trainTypeを見ているので、状態が変わった際にラベルが正しく更新されます。
518-524: 列車種別ボタンの有効/無効制御は直感的です
disabled={!fetchedTrainTypes.length}で種別が取得できていない場合はボタンを押せないようにしつつ、ラベルはtrainTypeTextによって状況を説明しているので、ユーザーにとって分かりやすい挙動になっていると思います。
571-584: SelectBoundModal 内の TrainTypeListModal 統合も整っています内部の
TrainTypeListModalをisTrainTypeModalVisibleで制御し、onCloseでtrainTypeをnullに戻す・onSelectで親のonTrainTypeSelectに委譲するという責務分離が明確で、ナビゲーション atom の利用とも矛盾していません。
Summary by CodeRabbit
新機能
改善
✏️ Tip: You can customize this high-level summary in your review settings.