Skip to content

Headerの長い駅名はフォント縮小ではなく文字幅を圧縮して表示するように変更 - #6053

Merged
TinyKitten merged 1 commit into
devfrom
claude/header-station-name-compress-xFc3o
May 27, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/header-station-name-compress-xFc3o

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 27, 2026 •

Copy link
Copy Markdown
Member

概要

Header コンポーネントで長い駅名を表示する際、これまでは adjustsFontSizeToFit でフォント自体を縮小していましたが、実車内 LCD(JR 東日本 E235 系など)の見た目に合わせて「フォントサイズは保ったまま 1 文字あたりの幅を圧縮する」方式に切り替えました。リアリティ向上のための表示方法の差し替えです。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • src/utils/stationNameScale.ts: 関数を calcStationNameMinScale → calcStationNameScaleX にリネームし、用途を minimumFontScale から transform: scaleX 向けに変更。下限を 0.1 → 0.5(実機 LCD 相当、半分以下には潰さない)に引き上げ。
  • アニメーションを伴う Header(HeaderEast / HeaderSaikyo / HeaderJRKyushu): 駅名 Text の scaleY アニメーションを壊さないよう、ラッパー View 側に transform: [{ scaleX }] を適用。adjustsFontSizeToFit / minimumFontScale は除去。
  • HeaderE235 / HeaderJL: Text の flex: 1 を新設の stationNameSlot View に逃がし、Text 自身は自然幅で描画 → scaleX で圧縮。
  • HeaderE231 / HeaderJRWest: 駅名 Text の style に直接 transform: [{ scaleX }] を追加。
  • src/utils/stationNameScale.test.ts: 新しい関数名・下限値(0.5)に合わせてテストを更新。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

関連Issue

スクリーンショット(任意)


Generated by Claude Code

Summary by CodeRabbit

リリースノート

  • 改善
    • 複数のヘッダーコンポーネントにおいて、駅名の表示スケーリング方式を改善しました。長い駅名の圧縮時の表現方法を見直し、より適切な表示品質と統一性を実現しています。

Review Change Stack

@TinyKitten TinyKitten self-assigned this May 27, 2026
@github-actions github-actions Bot added the react label May 27, 2026
@coderabbitai

coderabbitai Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

This PR refactors station name horizontal scaling across the TrainLCD mobile app by renaming calcStationNameMinScale to calcStationNameScaleX, increasing the minimum scale floor from 0.1 to 0.5, and updating seven header components to apply scaling via CSS transform: scaleX instead of React Native's adjustsFontSizeToFit/minimumFontScale properties.

Changes

Station name scaling refactor

Layer / File(s) Summary
Utility function refactoring
src/utils/stationNameScale.ts, src/utils/stationNameScale.test.ts
calcStationNameMinScale is renamed to calcStationNameScaleX and MIN_SCALE_FLOOR is raised from 0.1 to 0.5. The function returns a scaleX value clamped to [0.5, 1.0]. Test cases are updated to match the new behavior and minimum bounds.
Header component updates
src/components/HeaderE231.tsx, src/components/HeaderE235.tsx, src/components/HeaderEast/HeaderEast.tsx, src/components/HeaderJL.tsx, src/components/HeaderJRKyushu.tsx, src/components/HeaderJRWest.tsx, src/components/HeaderSaikyo.tsx
All seven header components update their station name rendering: import calcStationNameScaleX, remove adjustsFontSizeToFit/minimumFontScale from Typography, and apply horizontal scaling via transform: [{ scaleX }] on wrapper Views. HeaderE235 and HeaderJL additionally restructure styles to introduce a new stationNameSlot for clearer layout separation. HeaderEast, HeaderJRKyushu, and HeaderSaikyo handle both current and previous station text animations with the new scaling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • TrainLCD/MobileApp#5988: 同じ駅名の横方向スケーリングユーティリティと複数のHeader コンポーネント駅名描画ロジックを変更する関連PR。こちらは以前のPRで導入されたminimumFontScaleから、この PR ではtransform: scaleX方式へさらに進化させています。

Poem

🐰 駅名の文字、横に圧まれ
0.5 の下限で、ぐっと効きて
Transform の力で、スケール勢揃い
七つのヘッダーが、一律になりぬ
スムーズな縮み、ウサギも嬉し 🚄

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PRタイトルは、フォント縮小から文字幅圧縮への変更という最も重要な変更を正確に要約しており、Header コンポーネントの駅名表示方式の変更を明確に伝えています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed PR説明は概要、変更種類、詳細な変更内容、テスト実施状況、テンプレート構造をすべて満たしており、十分に完成している。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/header-station-name-compress-xFc3o

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

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.

2 participants