Repository navigation
長文駅名がadjustsFontSizeToFitで過剰に縮小される不具合をminimumFontScale導入で修正 - #5988
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough新規ユーティリティ ChangesStation Name Font Scaling Utility and Application
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/utils/stationNameScale.ts (1)
13-25: ⚡ Quick win
calcStationNameMinScaleの境界値テストを追加してください。今回の不具合修正の中核ロジックなので、
empty text/極端に長い文字列/短い文字列(=1にクランプ)の3系統だけでも固定化しておくと回帰を防ぎやすいです。🤖 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/utils/stationNameScale.ts` around lines 13 - 25, Add unit tests for calcStationNameMinScale covering boundary cases: (1) empty text returns 1, (2) extremely long string returns a value >= MIN_SCALE_FLOOR (likely clamped to MIN_SCALE_FLOOR), and (3) short string (very short length) returns 1 (clamped at upper bound). In your test file import calcStationNameMinScale and stable constants STATION_NAME_FONT_SIZE, MIN_SCALE_FLOOR, CHAR_WIDTH_RATIO; create deterministic inputs (e.g., '' for empty, a very long repeated character string for long case, and a 1–2 character string for short case) and assert the returned scale equals expected values or falls within expected bounds (===1 for empty/short, >= MIN_SCALE_FLOOR and <=1 for long). Ensure tests run in CI and use a deterministic window width mock if needed to control Dimensions.get('window').width.
🤖 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/utils/stationNameScale.ts`:
- Around line 13-25: Add unit tests for calcStationNameMinScale covering
boundary cases: (1) empty text returns 1, (2) extremely long string returns a
value >= MIN_SCALE_FLOOR (likely clamped to MIN_SCALE_FLOOR), and (3) short
string (very short length) returns 1 (clamped at upper bound). In your test file
import calcStationNameMinScale and stable constants STATION_NAME_FONT_SIZE,
MIN_SCALE_FLOOR, CHAR_WIDTH_RATIO; create deterministic inputs (e.g., '' for
empty, a very long repeated character string for long case, and a 1–2 character
string for short case) and assert the returned scale equals expected values or
falls within expected bounds (===1 for empty/short, >= MIN_SCALE_FLOOR and <=1
for long). Ensure tests run in CI and use a deterministic window width mock if
needed to control Dimensions.get('window').width.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c1628a6-236e-4f32-b526-d4b81516680f
📒 Files selected for processing (8)
src/components/HeaderE231.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderEast/HeaderEast.tsxsrc/components/HeaderJL.tsxsrc/components/HeaderJRKyushu.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderSaikyo.tsxsrc/utils/stationNameScale.ts
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
概要
ヘッダー駅名の
adjustsFontSizeToFitにminimumFontScaleが指定されておらず、「はねだくうこうだいさんたーみなる」「ちょうじゃがはまましおさいはまなすこうえんまえ」などの長文(特に KANA 表記)駅名で文字が判読不能なほど縮小される不具合を修正する。変更の種類
変更内容
calcStationNameMinScaleをsrc/utils/stationNameScale.tsに追加。HeaderEast/HeaderE235/HeaderE231/HeaderSaikyo/HeaderJL/HeaderJRKyushu/HeaderJRWest)の駅名TextにminimumFontScaleを渡し、adjustsFontSizeToFitのデフォルト(0.01 倍まで縮小)による潰れを防止。prevStationText)の双方に対して個別にスケールを算出。CHAR_WIDTH_RATIOを 0.7 に設定し、KANA など文字数が多くなる表記でも実体に近いスケールが得られるよう調整。テスト
npm run lintが通ることnpm testが通ることnpm run typecheckが通ること関連Issue
スクリーンショット(任意)
Summary by CodeRabbit