Skip to content

DOの速度・精度値をカンマ区切りに#4580

Merged
TinyKitten merged 1 commit intodevfrom
fix/devoverlay-num
Nov 3, 2025
Merged

DOの速度・精度値をカンマ区切りに#4580
TinyKitten merged 1 commit intodevfrom
fix/devoverlay-num

Conversation

@TinyKitten
Copy link
Member

@TinyKitten TinyKitten commented Nov 3, 2025

Summary by CodeRabbit

リリースノート

  • 改善
    • スピード表示がシステムロケールに対応した形式で表示されるようになりました。
    • 距離表示がシステムロケールに対応した形式で表示されるようになりました。

@TinyKitten TinyKitten self-assigned this Nov 3, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

DevOverlayコンポーネントとuseDistanceToNextStationフックの数値表示に対してロケール対応の文字列フォーマットを追加します。speedKMHは数値を返す代わりにtoLocaleString()でフォーマットされた文字列を返し、距離計算もtoLocaleString()でフォーマットされるようになりました。

Changes

Cohort / File(s) 変更サマリー
ロケール対応フォーマット
src/components/DevOverlay.tsx, src/hooks/useDistanceToNextStation.ts
speedKMHの戻り値をtoLocaleString()でラップして数値から文字列に変更。useDistanceToNextStationは距離計算にtoLocaleString()を適用し、オプショナルチェーンで無効値チェックを改善。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • DevOverlay.tsxのspeedKMHの戻り値型の変更が他のコンポーネントに影響していないか確認
  • useDistanceToNextStationのオプショナルチェーン導入によるnull/undefined処理の整合性確認

Possibly related PRs

  • 動作精度改良 #4141: 同じファイル(DevOverlay.tsxとuseDistanceToNextStation)を対象とした変更であり、ロケール文字列フォーマッティング機能の追加に関連しています。

Suggested labels

react

Poem

🐰 数字を文字に変えゆく
ロケールの風に吹かれて
世界の言葉で優しく
スピードも距離も美しく
フォーマットの魔法かな ✨

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed プルリクエストのタイトル「DOの速度・精度値をカンマ区切りに」は、変更セットの主な目的と完全に一致しています。実際の変更では、src/components/DevOverlay.tsxの速度値(speedKMH)とsrc/hooks/useDistanceToNextStation.tsの距離値(精度値)の両方に対してtoLocaleString()を適用し、ロケール対応のカンマ区切り形式で表示するよう実装されています。タイトルは簡潔かつ明確であり、開発者にこのPRの主要な目的が数値のフォーマット変更であることを即座に伝えることができます。
✨ 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 fix/devoverlay-num

📜 Recent 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 2b5e662 and 9e4de37.

📒 Files selected for processing (2)
  • src/components/DevOverlay.tsx (1 hunks)
  • src/hooks/useDistanceToNextStation.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 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: 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.
📚 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/hooks/useDistanceToNextStation.ts
🔇 Additional comments (2)
src/components/DevOverlay.tsx (2)

45-52: ロケール対応の数値フォーマットが正しく適用されています。

speedKMHが文字列を返すようになりましたが、表示用途のみなので問題ありません。


68-70: 精度値のフォーマットについて確認。

PRタイトルでは速度と精度の両方をカンマ区切りにすると記載されていますが、精度値はtoLocaleString()でフォーマットされていません。意図的でしょうか?


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

@github-actions github-actions bot added the react label Nov 3, 2025
@TinyKitten TinyKitten merged commit 3329fb1 into dev Nov 3, 2025
6 checks passed
@TinyKitten TinyKitten deleted the fix/devoverlay-num branch November 3, 2025 00:28
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