Skip to content

Androidタブレットでの駅名表示・レイアウト改善 - #5639

Merged
TinyKitten merged 5 commits into
devfrom
feature/fix-android-tablet-lineboard-layout
Mar 23, 2026
Merged

TinyKitten merged 5 commits into
devfrom
feature/fix-android-tablet-lineboard-layout

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Mar 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Androidタブレットで長い駅名(6文字以上)がヘッダーに食い込む問題を修正
  • LineBoardのstationNameContainerのbottomオフセットをAndroidタブレット向けに調整(共通: 64、JRKyushu: 32)
  • Androidタブレットでの縦書き駅名の行間を調整(includeFontPadding: false、marginBottom: -10)
  • Androidタブレットでは長い駅名のしきい値を5文字に変更し、斜め表示で対応
  • StationNameコンポーネントにcharStyleプロップを追加
  • 全Header(LED除く)にzIndex: 9999を追加

Test plan

  • Androidタブレットで6文字以上の縦書き駅名(九大学研都市等)がヘッダーに食い込まないこと
  • Androidタブレットで斜め英語駅名がヘッダーに食い込まないこと
  • Androidタブレットで縦書き駅名の行間がiPadと同等であること
  • Androidタブレットでchevronの位置がバーと一致していること
  • iPadで表示が変わっていないこと(デグレなし)
  • JRKyushu以外のテーマ(East, Saikyo, Toei)でデグレがないこと
  • 各HeaderがzIndex: 9999でLineBoardより前面に表示されること

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • ヘッダーの重なり順を調整し、他UIと被る表示を解消しました。
    • タブレット向けに駅名表示・チェブロン位置計算を修正し、レイアウト崩れを抑制しました。
    • 一部画面の上部余白を端末ごとに最適化しました。
  • New Features

    • 縦書き駅名の各文字に個別スタイルを適用できるようになりました。
    • 長い駅名の判定が端末依存(タブレット/Android含む)でより適切に行われるようになりました。

@github-actions github-actions Bot added the react label Mar 23, 2026
@coderabbitai

coderabbitai Bot commented Mar 23, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

複数ヘッダーに zIndex を追加し、LineBoard 周りでタブレット/プラットフォーム依存のレイアウト定数・しきい値・文字スタイル拡張を導入。各 LineBoard コンポーネントのシェブロン・駅名配置・番号位置などを調整しました。

Changes

Cohort / File(s) Summary
Header zIndex調整
src/components/HeaderE235.tsx, src/components/HeaderJL.tsx, src/components/HeaderJRWest.tsx, src/components/HeaderSaikyo.tsx, src/components/HeaderTY.tsx
各ヘッダーのルートに zIndex: 9999 を追加してスタッキング順序を明示(ルート View/スタイルに適用)。
StationName 拡張
src/components/LineBoard/shared/components/StationName.tsx
StationNameProps に charStyle?: StyleProp<TextStyle> を追加。縦レイアウト時に各文字へ charStyle をマージして適用するよう変更。
長い駅名しきい値の動的化
src/components/LineBoard/shared/hooks/useIncludesLongStationName.ts
固定の「6文字」判定を廃止し、Platform と isTablet を用いた LONG_NAME_THRESHOLD を導入(Android タブレットでは 5、それ以外は 6)。
共通スタイル定数化とタブレット向け調整
src/components/LineBoard/shared/styles/commonStyles.ts
STATION_NAME_CONTAINER_BOTTOM を追加。タブレット向けの rootWestJO.bottom を Platform.select 化、Androidタブレット専用で marginBottom を -10 に、includeFontPadding: false を追加。
LineBoard: シェブロン底部計算の更新(共通)
src/components/LineBoardEast.tsx, src/components/LineBoardSaikyo.tsx, src/components/LineBoardToei.tsx
タブレット時のシェブロン bottom 計算で STATION_NAME_CONTAINER_BOTTOM を使用するよう変更(非タブレットは従来通り)。
LineBoardJRKyushu 固有調整
src/components/LineBoardJRKyushu.tsx
JR Kyushu 用の底部オフセット定数 JR_KYUSHU_CONTAINER_BOTTOM を導入し、駅名コンテナとシェブロンの bottom 計算に適用。
LineBoardJO:番号配置とプラットフォーム調整
src/components/LineBoardJO.tsx
StationNameCellProps に index: number を追加。stationNameCellForMap を (s, i) に変更して index を渡す。Androidタブレット向けに numbering の left/top オフセット計算を導入し、スタイルに反映。
PadLineMarks プラットフォーム調整
src/components/PadLineMarks.tsx
stylesWest.topBar.marginTop を Platform.select({ android: 16, default: 6 }) に変更。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 ぴょんと上がった zIndex、
タブレットの風に合わせて、
駅名ひとつに小さな装飾、
シェブロンは定位置でにっこり、
コードの野原で楽しく跳ねる。

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは、Androidタブレットでの駅名表示・レイアウト改善という具体的な変更内容を正確に反映しており、変更セットの主要な目的と完全に一致しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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 feature/fix-android-tablet-lineboard-layout

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.

🧹 Nitpick comments (1)
src/components/HeaderJRWest.tsx (1)

21-23: 9999 のマジックナンバーは共通定数化を推奨します。

同じ値が複数ヘッダーで重複しているため、例: HEADER_Z_INDEX に寄せると将来の調整が1箇所で済みます。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/HeaderJRWest.tsx` around lines 21 - 23, The zIndex: 9999 in
the root style of HeaderJRWest.tsx is a magic number—replace it with a named
constant (e.g., HEADER_Z_INDEX) and import/use that constant instead so multiple
headers share a single source of truth; add the constant either exported from a
shared constants module or declared at the top of HeaderJRWest.tsx (and update
any other header files that duplicate 9999 to reference HEADER_Z_INDEX).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/HeaderJRWest.tsx`:
- Around line 21-23: The zIndex: 9999 in the root style of HeaderJRWest.tsx is a
magic number—replace it with a named constant (e.g., HEADER_Z_INDEX) and
import/use that constant instead so multiple headers share a single source of
truth; add the constant either exported from a shared constants module or
declared at the top of HeaderJRWest.tsx (and update any other header files that
duplicate 9999 to reference HEADER_Z_INDEX).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a91109a0-89ea-4344-b82b-0a8c1ad678b4

📥 Commits

Reviewing files that changed from the base of the PR and between bc37221 and 95144ec.

📒 Files selected for processing (12)
  • src/components/HeaderE235.tsx
  • src/components/HeaderJL.tsx
  • src/components/HeaderJRWest.tsx
  • src/components/HeaderSaikyo.tsx
  • src/components/HeaderTY.tsx
  • src/components/LineBoard/shared/components/StationName.tsx
  • src/components/LineBoard/shared/hooks/useIncludesLongStationName.ts
  • src/components/LineBoard/shared/styles/commonStyles.ts
  • src/components/LineBoardEast.tsx
  • src/components/LineBoardJRKyushu.tsx
  • src/components/LineBoardSaikyo.tsx
  • src/components/LineBoardToei.tsx

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

🧹 Nitpick comments (1)
src/components/LineBoardJO.tsx (1)

134-144: Androidタブレット向けのレイアウト調整は適切に実装されています。

オフセット計算のロジックは正しく、依存配列も適切です(Platform.OSとisTabletは静的な値のため不要)。

マジックナンバー(60, 12など)を名前付き定数として抽出すると、将来のメンテナンス時に意図が明確になります。

♻️ 定数抽出の提案
+const ANDROID_TABLET_VERTICAL_OFFSET = 60;
+const NUMBERING_HORIZONTAL_FINE_TUNE = 12;
+
 const additionalPadLineMarksContainerStyle = useMemo(() => {
-    const androidOffset = Platform.OS === 'android' && isTablet ? 60 : 0;
+    const androidOffset = Platform.OS === 'android' && isTablet ? ANDROID_TABLET_VERTICAL_OFFSET : 0;
     // ...
 }, [stationInLoop.stationNumbers, dim.height]);

 const numberingLeftOffset = useMemo(() => {
     // ...
-    return dotCenter - containerCenter + 12;
+    return dotCenter - containerCenter + NUMBERING_HORIZONTAL_FINE_TUNE;
 }, [barWidth, dim.width, index]);

Also applies to: 156-169

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LineBoardJO.tsx` around lines 134 - 144, Extract the magic
numbers used in additionalPadLineMarksContainerStyle into well-named constants
(e.g., ANDROID_TABLET_OFFSET = 60, NO_STATION_TOP_OFFSET = 130,
STATION_TOP_OFFSET = 90) and replace the raw literals in the
Platform.OS/isTablet offset calculation and top assignments; also apply the same
extraction to the similar block referenced at lines 156-169 (replace any other
literals like 12 with descriptive constants) so the intent is clear and easy to
maintain, keeping the same logic that uses isTablet and Platform.OS and the same
dependency array referencing stationInLoop.stationNumbers and dim.height.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/LineBoardJO.tsx`:
- Around line 134-144: Extract the magic numbers used in
additionalPadLineMarksContainerStyle into well-named constants (e.g.,
ANDROID_TABLET_OFFSET = 60, NO_STATION_TOP_OFFSET = 130, STATION_TOP_OFFSET =
90) and replace the raw literals in the Platform.OS/isTablet offset calculation
and top assignments; also apply the same extraction to the similar block
referenced at lines 156-169 (replace any other literals like 12 with descriptive
constants) so the intent is clear and easy to maintain, keeping the same logic
that uses isTablet and Platform.OS and the same dependency array referencing
stationInLoop.stationNumbers and dim.height.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9497d125-73a7-4e1f-9330-df976e102b35

📥 Commits

Reviewing files that changed from the base of the PR and between db056f0 and e6131d4.

📒 Files selected for processing (2)
  • src/components/LineBoard/shared/styles/commonStyles.ts
  • src/components/LineBoardJO.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/LineBoard/shared/styles/commonStyles.ts

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/LineBoardJO.tsx (1)

100-105: ⚠️ Potential issue | 🟡 Minor

固定 +16 だと既通過側のナンバリングがずれます。

Line 168 は補正値を常に +16 にしていますが、実際の dot は Line 351-352 / 367-368 で 16px と 32px に切り替わります。Android タブレットでは既通過側だけ 8px ずれるので、currentStationIndex か実際の dot 幅を渡して半径を 8 / 16 で切り替えた方が安全です。

💡 修正案
 interface StationNameCellProps {
   arrived: boolean;
   stations: Station[];
   station: Station;
   hasNumberedStation: boolean;
   index: number;
+  currentStationIndex: number;
 }

 const StationNameCell: React.FC<StationNameCellProps> = ({
   stations,
   arrived,
   station: stationInLoop,
   hasNumberedStation,
   index,
+  currentStationIndex,
 }: StationNameCellProps) => {
   const numberingLeftOffset = useMemo(() => {
     if (!isTablet || Platform.OS !== 'android') {
       return undefined;
     }
+    const dotHalf = index <= currentStationIndex ? 8 : 16;
     const containerWidth = dim.width / 9;
-    const dotCenter = barWidth * (index + 1) - barWidth / 2;
+    const dotLeft = barWidth * (index + 1) - barWidth / 2;
     const wrapperMarginLeft = barWidth / 2.5;
     const containerCenter =
       wrapperMarginLeft + index * containerWidth + containerWidth / 2;
-    return dotCenter - containerCenter + 16;
-  }, [barWidth, dim.width, index]);
+    return dotLeft - containerCenter + dotHalf;
+  }, [barWidth, currentStationIndex, dim.width, index]);
   const stationNameCellForMap = useCallback(
     (s: Station, i: number) => {
       return (
         <StationNameCell
           key={s.id}
           index={i}
+          currentStationIndex={currentStationIndex}
           station={s}
           stations={stations}
           arrived={!isPassing}
           hasNumberedStation={(s.stationNumbers?.length ?? 0) > 0}
         />
       );
     },
-    [isPassing, stations]
+    [currentStationIndex, isPassing, stations]
   );

Also applies to: 108-114, 157-169, 242-255

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LineBoardJO.tsx` around lines 100 - 105, The code currently
applies a fixed +16 radius adjustment causing the passed-side numbering to shift
on some devices; update the radius calculation to choose between 8px and 16px
based on the actual dot size or station position. Specifically, modify wherever
the hardcoded "+16" is used (e.g., in the StationNameCell/Station rendering
logic that uses StationNameCellProps and the arrived/hasNumberedStation props)
to accept either a dotWidth prop or access currentStationIndex and compute
radius = (index <= currentStationIndex ? 8 : 16) or radius = dotWidth === 16 ? 8
: 16 as appropriate, and propagate dotWidth/currentStationIndex into the
components that render dots and numbering so the offset matches the dot sizes
(16px vs 32px) used elsewhere.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/components/LineBoardJO.tsx`:
- Around line 100-105: The code currently applies a fixed +16 radius adjustment
causing the passed-side numbering to shift on some devices; update the radius
calculation to choose between 8px and 16px based on the actual dot size or
station position. Specifically, modify wherever the hardcoded "+16" is used
(e.g., in the StationNameCell/Station rendering logic that uses
StationNameCellProps and the arrived/hasNumberedStation props) to accept either
a dotWidth prop or access currentStationIndex and compute radius = (index <=
currentStationIndex ? 8 : 16) or radius = dotWidth === 16 ? 8 : 16 as
appropriate, and propagate dotWidth/currentStationIndex into the components that
render dots and numbering so the offset matches the dot sizes (16px vs 32px)
used elsewhere.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7bc28ea4-c89c-40e0-b27b-b2511041b3ae

📥 Commits

Reviewing files that changed from the base of the PR and between e6131d4 and 6e99b0e.

📒 Files selected for processing (1)
  • src/components/LineBoardJO.tsx

@TinyKitten
TinyKitten merged commit ec52ce8 into dev Mar 23, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the feature/fix-android-tablet-lineboard-layout branch March 23, 2026 04:41
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