Skip to content

ETA単位ラベルの見切れ修正と分/min.二択化、LineBoardJOのドット拡大・バー終端延長#6432

Merged
TinyKitten merged 2 commits into
devfrom
fix/eta-unit-label-visibility
Jul 16, 2026
Merged

ETA単位ラベルの見切れ修正と分/min.二択化、LineBoardJOのドット拡大・バー終端延長#6432
TinyKitten merged 2 commits into
devfrom
fix/eta-unit-label-visibility

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 16, 2026

Copy link
Copy Markdown
Member

概要

ETA残り分数の単位ラベルがテーマ・端末によって右側で見切れる問題(JOタブレットで「min.」が欠ける、都営スマホで「m.」になる)を修正し、単位表記をLineBoardの駅名言語に追従する「分/min.」の二択へ簡素化しました。あわせてLineBoardJOのドット拡大とバー終端の延長を行っています。

変更の種類

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

変更内容

  • EstimatedMinutesUnitLabel に最長表記「min.」が縁取り込みで収まる固有幅(タブレット56 / スマホ40)を明示。Yogaはwidth未指定の絶対配置子を親要素の幅を上限に測定するため、幅の狭いドットに載せたラベルが「m.」のように切り詰められていた(全テーマ共通の修正)

  • 単位表記を駅名表示と同じ言語切替(isEnAtom)に追従する「分/min.」の二択へ簡素化。韓国語「분」と中国語の専用扱いを廃止し、LineBoardの言語が切り替わるのと同一タイミングで表記が切り替わるようにした

  • LineBoardJOの未通過駅ドットをバー高さ−8px(上下4pxインセット)の円へ拡大(タブレット32→56px、スマホは従来同等の32px)。中心位置は従来から変わらない

  • LineBoardJOのバー最終セグメントを右へ延長(タブレット+24px / スマホ+14px)し、終端矢印を画面右端寄りに移動

  • LineBoardJOの最終ドット右隣に単位ラベルを再配置(間隔: タブレット8px / スマホ0px)

  • LineBoardJOのレイアウト変更(ドットサイズ・縦位置、最終セグメント延長、終端矢印位置、単位ラベル配置)を検証するテストを追加し、ZHステートのテストで有効言語を明示(CodeRabbit指摘対応)

テスト

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

関連Issue

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

Summary by CodeRabbit

  • 表示改善
    • 所要時間の単位表記を、英語は「min.」、それ以外の言語は「分」に統一しました。
    • タブレット/モバイルで所要時間ラベルの表示位置・幅を最適化し、途切れを起こしにくくしました。
  • バグ修正
    • JOの駅ドット、バーの高さ・収まり、終端のバー/矢印位置を調整し、レイアウト崩れを改善しました。
  • テスト
    • スマホ向けレイアウトや表記内容の検証を強化しました。

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

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

ETA単位の表示を英語判定に基づく二択へ変更し、JO路線ボードのドット、バー、終端要素のサイズ・位置計算を定数ベースに更新しています。

Changes

LineBoard表示調整

Layer / File(s) Summary
ETA単位表示の言語条件更新
src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.tsx, src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.test.tsx
ETA単位を英語では min.、それ以外では として表示し、言語有効状態を含むテストケースを更新しています。
JOボードの寸法・配置計算更新
src/components/LineBoardJO.tsx, src/components/LineBoard/shared/styles/commonStyles.ts, src/components/LineBoardJO.test.tsx
JOバー高さを定数化し、ドットの寸法・中心位置、末端バーの延長、終端要素と単位ラベルの位置を更新し、スマホ向けレイアウトのスタイル検証を追加しています。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

ぴょんと跳ねれば min.
言葉に合わせて表示が変わる
JOのドットはまんなかへ
バーのしっぽもすいすい伸びる
うさぎも満足、ぴょんぴょん丸!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Title check ✅ Passed 主変更であるETA単位ラベルの見切れ修正と分/min.切替、LineBoardJOのレイアウト変更を簡潔に表しています。
Description check ✅ Passed 概要・変更の種類・変更内容・テストが揃っており、テンプレート要件を十分に満たしています。
✨ 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 fix/eta-unit-label-visibility

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

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

🤖 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.

Inline comments:
In
`@src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.test.tsx`:
- Around line 55-57: Update the test case for renderWithState('CURRENT_ZH') to
explicitly pass the active languages ['JA', 'EN', 'ZH'], then keep the existing
'min.' assertion to directly verify the English fallback without relying on
default initialization.

In `@src/components/LineBoardJO.tsx`:
- Around line 310-317: Update LineBoardJO tests in LineBoardJO.test.tsx to cover
the JO layout changes for both tablet and smartphone configurations. Verify
unpassed-dot size and centered position, final bar extension, terminal arrow
position, and ETA unit-label placement, using the existing getBottom and
relevant rendering symbols without changing production behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f9a74ad-5f80-4236-b83f-f897803a264c

📥 Commits

Reviewing files that changed from the base of the PR and between c432a7e and 0e64f92.

📒 Files selected for processing (4)
  • src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.test.tsx
  • src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.tsx
  • src/components/LineBoard/shared/styles/commonStyles.ts
  • src/components/LineBoardJO.tsx

Comment thread src/components/LineBoardJO.tsx
@TinyKitten

Copy link
Copy Markdown
Member Author

Fixes Applied Successfully

Fixed 2 file(s) based on 2 CodeRabbit feedback item(s).

Files modified:

  • src/components/LineBoardJO.test.tsx — JOレイアウト変更(未通過ドットのサイズ・縦中央配置、最終バーセグメント延長、終端矢印位置、単位ラベル配置)を検証するテストを追加
  • src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.test.tsx — ZHステートのテストで有効言語 ['JA', 'EN', 'ZH'] を明示し初期状態への暗黙依存を解消

Commit: 6db129889

The latest autofix changes are on the fix/eta-unit-label-visibility branch.

補足: CodeRabbit はタブレット・スマホ両方のテストを提案していましたが、本リポジトリのコンポーネントテストは isTablet をモジュールレベルで false 固定にする慣習(定数が import 時に確定するため)に合わせ、スマホ側のスタイル検証を追加しています。

@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai 問題残ってますか?

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '=== Changed files and diff stat ==='
git diff --stat HEAD^ HEAD
git diff --name-only HEAD^ HEAD

echo '=== Outlines ==='
ast-grep outline src/components/LineBoardJO.tsx --items all
ast-grep outline src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.tsx --items all
ast-grep outline src/components/LineBoardJO.test.tsx --items all
ast-grep outline src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.test.tsx --items all

echo '=== Relevant implementation and tests ==='
for f in \
  src/components/LineBoardJO.tsx \
  src/components/LineBoardJO.test.tsx \
  src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.tsx \
  src/components/LineBoard/shared/components/EstimatedMinutesUnitLabel.test.tsx \
  src/components/LineBoard/shared/styles/commonStyles.ts
do
  echo "--- $f ---"
  cat -n "$f"
done

echo '=== State-language definitions/usages ==='
rg -n -C 3 --glob '*.{ts,tsx}' \
  '(isEnAtom|enabledLanguagesAtom|estimatedMinutesUnitAtom|headerStateAtom)' src

Length of output: 111971


@TinyKitten 確認しました。今回の2件については、残っている問題は見当たりません。

  • LineBoardJO のスマホ向けレイアウト計算(未通過ドット、最終セグメント、終端矢印、単位ラベル配置)が具体的な値で検証されています。
  • ZH ステートのテストは有効言語を明示し、初期状態への暗黙依存が解消されています。
  • 単位ラベルは駅名表示と同じ isEnAtom に追従しており、表示仕様とも整合しています。

このため、先の指摘は解消済みです。


✏️ Learnings added
Learnt from: TinyKitten
URL: https://github.com/TrainLCD/MobileApp/pull/6432

Timestamp: 2026-07-16T17:24:51.194Z
Learning: In `src/components/LineBoardJO.test.tsx` and related React Native component tests, `~/utils/isTablet` is mocked as `false` at module import time. Because layout constants are determined during import, regression tests conventionally validate smartphone styles rather than dynamically switching tablet and smartphone layouts in one test module.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@TinyKitten TinyKitten merged commit fcf5f62 into dev Jul 16, 2026
6 checks passed
@TinyKitten TinyKitten deleted the fix/eta-unit-label-visibility branch July 16, 2026 17:25
@TinyKitten TinyKitten mentioned this pull request Jul 16, 2026
9 tasks
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