Repository navigation
Androidタブレットでの駅名表示・レイアウト改善 - #5639
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
📝 WalkthroughWalkthrough複数ヘッダーに zIndex を追加し、LineBoard 周りでタブレット/プラットフォーム依存のレイアウト定数・しきい値・文字スタイル拡張を導入。各 LineBoard コンポーネントのシェブロン・駅名配置・番号位置などを調整しました。 Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 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
📒 Files selected for processing (12)
src/components/HeaderE235.tsxsrc/components/HeaderJL.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderSaikyo.tsxsrc/components/HeaderTY.tsxsrc/components/LineBoard/shared/components/StationName.tsxsrc/components/LineBoard/shared/hooks/useIncludesLongStationName.tssrc/components/LineBoard/shared/styles/commonStyles.tssrc/components/LineBoardEast.tsxsrc/components/LineBoardJRKyushu.tsxsrc/components/LineBoardSaikyo.tsxsrc/components/LineBoardToei.tsx
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
🧹 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
📒 Files selected for processing (2)
src/components/LineBoard/shared/styles/commonStyles.tssrc/components/LineBoardJO.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/components/LineBoard/shared/styles/commonStyles.ts
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
src/components/LineBoardJO.tsx
Summary
includeFontPadding: false、marginBottom: -10)charStyleプロップを追加zIndex: 9999を追加Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
New Features