Skip to content

SelectBoundModalボタン整理 - #4636

Merged
TinyKitten merged 2 commits into
devfrom
feature/select-bound-modal-enhance
Nov 22, 2025
Merged

TinyKitten merged 2 commits into
devfrom
feature/select-bound-modal-enhance

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Nov 22, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • 新機能

    • 列車タイプが利用できないときの表示メッセージを追加しました。
    • 列車タイプ選択機能を追加しました。
  • 改善

    • モーダルのレスポンシブフォントサイジングを実装しました。
    • モーダル終了時に列車タイプ選択をリセットする処理を追加しました。
    • 列車タイプ設定モーダルのUIを簡素化しました。

✏️ Tip: You can customize this high-level summary in your review settings.

@TinyKitten TinyKitten self-assigned this Nov 22, 2025
@github-actions github-actions Bot added the react label Nov 22, 2025
@coderabbitai

coderabbitai Bot commented Nov 22, 2025 •

Copy link
Copy Markdown
Contributor

Note

.coderabbit.yml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'auto_review'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

翻訳キーの更新(通知設定関連の削除と列車タイプ関連の追加)、SelectBoundModalへの列車タイプ選択UI統合、SelectBoundSettingListModalからの列車タイプ機能削除、複数スクリーンにおけるtrainType状態のリセットロジック追加。

Changes

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状態を保持したまま完了
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • SelectBoundModalの複雑な状態管理: useMemoの導入、finalStopの計算ロジック、trainTypeTextのメモ化処理に対する詳細な検証が必要
  • Props変更の影響範囲: SelectBoundSettingListModalのPropsシグネチャの削減が他のコンポーネントの呼び出し側に影響していないかの確認
  • 複数スクリーンにおけるtrainType状態リセット: RouteSearchScreenとSelectLineScreenの両方でのリセットロジックが一貫性を持っているかの検証

Possibly related PRs

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.

@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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between f0e6c04 and c2a17a2.

📒 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.json
  • assets/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.json
  • src/components/SelectBoundSettingListModal.tsx
  • src/components/SelectBoundModal.tsx
  • src/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.tsx
  • src/components/SelectBoundModal.tsx
  • src/screens/RouteSearchScreen.tsx
  • src/screens/SelectLineScreen.tsx
  • src/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 の利用とも矛盾していません。

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