Repository navigation
Headerコンポの構造改善&データ上存在しない英中韓駅名のスキップ - #4882
Conversation
📝 WalkthroughWalkthroughヘッダーを大規模にプロップ駆動へリファクタ。共通アニメーションと共通データを新規フック(useHeaderAnimation、useHeaderCommonData)へ抽出し、共通型を追加。複数ヘッダーでの内部状態/アニメーションが統一され約1,800行削減。 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Header as Header Component
participant Common as useHeaderCommonData
participant Animation as useHeaderAnimation
participant Store as Atoms/Store
Note over Header,Common: 描画開始(親 Header または Theme 切替)
Header->>Common: 共通データ要求(currentStation, line, langState,...)
Common->>Store: atoms / サブフックを読み取り
Store-->>Common: currentStation 等を返却
Common-->>Header: CommonHeaderProps(または null)
alt commonData present
Header->>Animation: アニメーション制御要求(headerState, selectedBound, delay)
Animation->>Animation: 内部アニメ値更新(fadeIn/fadeOut など)
Animation-->>Header: animatedStyles + prevTextSnapshots
Header->>Header: UI を animatedStyles と props でレンダー
else no data
Header->>Header: レンダリングガード(何も描画しない / 空)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (9)src/{components,screens}/**/*.tsx📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx,json}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx,py,java,go,cs}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,ts,tsx,jsx,json}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{tsx,ts}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{js,ts,tsx,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (8)📓 Common learnings📚 Learning: 2025-05-19T10:59:37.813ZApplied to files:
📚 Learning: 2025-11-25T03:10:26.328ZApplied to files:
📚 Learning: 2025-06-18T17:29:46.085ZApplied to files:
📚 Learning: 2025-12-31T12:21:36.200ZApplied to files:
📚 Learning: 2025-12-31T12:21:36.200ZApplied to files:
📚 Learning: 2025-11-25T03:10:26.328ZApplied to files:
📚 Learning: 2025-07-18T11:04:45.459ZApplied to files:
🔇 Additional comments (5)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/HeaderJRWest.tsx (1)
34-103: StyleSheet.createをコンポーネント外に移動することを検討してください。
StyleSheet.createがコンポーネント本体内にあるため、レンダリングごとにスタイルオブジェクトが再作成されます。React Nativeでは、StyleSheetをコンポーネント外で定義することがパフォーマンスのベストプラクティスです。
📜 Review details
Configuration used: Path: .coderabbit.yml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (25)
TECHNICAL_DEBT.mdsrc/__fixtures__/headerProps.tssrc/components/Header.test.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJL.tsxsrc/components/HeaderJRKyushu.test.tsxsrc/components/HeaderJRKyushu.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderSaikyo.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTokyoMetro.tsxsrc/hooks/index.tssrc/hooks/useHeaderAnimation.tssrc/hooks/useHeaderCommonData.tssrc/hooks/useTransitionHeaderState.ts
🧰 Additional context used
📓 Path-based instructions (12)
**/*.{ts,tsx,js,jsx,json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Biome as the formatter for all code files
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx,js,jsx}: Use Biome as the linter for all code files
Use// biome-ignoreonly for true compatibility issues and include an inline reason
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{ts,tsx,js,jsx,py,java,go,cs}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx,py,java,go,cs}: Use descriptive names for agents that clearly indicate their purpose and domain
Implement agents with well-defined input/output contracts to ensure clear communication
Document agent responsibilities and expected behaviors in comments or docstrings
Use composition and dependency injection for agent collaboration rather than tight coupling
Implement error handling and graceful degradation in agents to improve system resilience
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*
📄 CodeRabbit inference engine (AGENTS.md)
Use UTF-8 encoding, two-space indentation, single quotes, and ES5 trailing commas as enforced by
.editorconfig.
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxTECHNICAL_DEBT.mdsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{js,ts,tsx,jsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome is authoritative for linting; avoid
// biome-ignoreunless a rule is truly incompatible and document the rationale inline.
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Name components with PascalCase (e.g.,
StationBanner.tsx).
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Name hooks with
use*prefix (e.g.,useStationFeed.ts).
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Keep comments purposeful: explain intent or non-obvious constraints, not obvious mechanics.
Files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
src/hooks/**/*.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Custom hooks should use
useprefix (e.g.,useStationFeed.ts)
Files:
src/hooks/useHeaderAnimation.tssrc/hooks/useTransitionHeaderState.tssrc/hooks/useHeaderCommonData.tssrc/hooks/index.ts
src/{components,screens}/**/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Component files should use PascalCase naming (e.g.,
StationBanner.tsx)
Files:
src/components/HeaderE235.test.tsxsrc/components/HeaderTokyoMetro.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.test.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.test.{ts,tsx}: Place test files in the same hierarchy as the target module with.test.tsor.test.tsxextension
Mock network and Firebase layers usingjest.mock
Calljest.clearAllMocks()inafterEachhook
Include TODO comments with reason and assignee for skipped tests
**/*.test.{ts,tsx}: Co-locate unit tests as.test.tsor.test.tsxsiblings to the module.
Reuse helper utilities fromsrc/utils/test/to avoid duplicate setup code in tests.
Mock network and Firebase layers withjest.mock, and calljest.clearAllMocks()inafterEach.
When modifying behavior, update or add tests in the same change set; document skipped tests with TODOs and owner rationale.
Update or add tests relevant to code changes before submitting.
Files:
src/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
**/*.{test,spec}.{ts,tsx,js,jsx,py,java,go,cs}
📄 CodeRabbit inference engine (CLAUDE.md)
Test agents in isolation and with integration tests to ensure correctness and compatibility
Files:
src/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
🧠 Learnings (26)
📓 Common learnings
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Write commit messages in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`)
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Code review and feedback should be provided in Japanese
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Commit messages must be single-sentence statements in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`); prefix production hot fixes with `Hotfix:`.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4448
File: functions/src/funcs/tts.ts:214-232
Timestamp: 2025-08-11T20:23:23.071Z
Learning: PR #4448 in TrainLCD/MobileApp is specifically about AI feedback summarization and labeling functionality, not about TTS (Text-to-Speech) improvements. The TTS code changes appear to be part of a modularization refactoring but are not the focus of this PR.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4521
File: src/screens/RouteSearchScreen.tsx:173-176
Timestamp: 2025-10-27T14:15:54.478Z
Learning: In the TrainLCD/MobileApp repository, when BFF (Backend For Frontend) returns nullish IDs for stations, this is considered a critical data integrity incident that should be fixed at the source (BFF) rather than worked around with composite key fallbacks in the client code.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4595
File: src/components/LineBoardEast.tsx:497-504
Timestamp: 2025-11-03T12:13:46.409Z
Learning: In TrainLCD/MobileApp LineBoard components (LineBoardEast, LineBoardWest, LineBoardSaikyo, LineBoardToei, LineBoardJRKyushu), the correct implementation pattern is to apply the dynamic width (dim.width / 9) to the outer stationNameContainer View, as implemented in LineBoardEast, not to the inner wrapper View.
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to src/test/**/*.{ts,tsx} : For integration flows, extend `src/test/e2e.ts` and prefer fixtures from `src/__fixtures__/`.
Applied to files:
src/__fixtures__/headerProps.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.test.{ts,tsx} : Update or add tests relevant to code changes before submitting.
Applied to files:
src/__fixtures__/headerProps.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxTECHNICAL_DEBT.mdsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.test.{ts,tsx} : Reuse helper utilities from `src/utils/test/` to avoid duplicate setup code in tests.
Applied to files:
src/__fixtures__/headerProps.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.test.{ts,tsx} : When modifying behavior, update or add tests in the same change set; document skipped tests with TODOs and owner rationale.
Applied to files:
src/__fixtures__/headerProps.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxTECHNICAL_DEBT.mdsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Extend `src/test/e2e.ts` for integration flow tests
Applied to files:
src/__fixtures__/headerProps.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderTokyoMetro.test.tsx
📚 Learning: 2025-05-19T10:59:37.813Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Applied to files:
src/__fixtures__/headerProps.tssrc/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxTECHNICAL_DEBT.mdsrc/components/HeaderTY.test.tsxsrc/components/HeaderJL.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.{ts,tsx} : Name hooks with `use*` prefix (e.g., `useStationFeed.ts`).
Applied to files:
src/hooks/useHeaderAnimation.tssrc/hooks/useTransitionHeaderState.tssrc/components/HeaderTokyoMetro.tsxsrc/hooks/useHeaderCommonData.tssrc/components/HeaderLED.tsxsrc/hooks/index.tssrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/HeaderTY.tsxsrc/components/Header.test.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/hooks/**/*.ts : Custom hooks should use `use` prefix (e.g., `useStationFeed.ts`)
Applied to files:
src/hooks/useHeaderAnimation.tssrc/hooks/useTransitionHeaderState.tssrc/hooks/useHeaderCommonData.tssrc/components/HeaderLED.tsxsrc/hooks/index.tssrc/components/Header.tsxsrc/components/Header.test.tsx
📚 Learning: 2025-06-18T17:29:46.085Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4359
File: src/components/TrainTypeList.tsx:1-1
Timestamp: 2025-06-18T17:29:46.085Z
Learning: When analyzing React import changes in TypeScript/JavaScript files, carefully verify that React.Fragment, React.createElement, or other React namespace usages actually exist in the code before flagging them as issues. Don't assume React.Fragment is used just because the default React import was removed.
Applied to files:
src/hooks/useHeaderAnimation.tssrc/components/HeaderE235.test.tsxsrc/components/HeaderTokyoMetro.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxTECHNICAL_DEBT.mdsrc/components/HeaderJL.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to {jest.setup.js,src/setupTests.ts} : Jest global setup is managed in `jest.setup.js` and `src/setupTests.ts`
Applied to files:
src/components/HeaderE235.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.test.{ts,tsx} : Mock network and Firebase layers with `jest.mock`, and call `jest.clearAllMocks()` in `afterEach`.
Applied to files:
src/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-27T22:48:28.461Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-27T22:48:28.461Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js,jsx,py,java,go,cs} : Test agents in isolation and with integration tests to ensure correctness and compatibility
Applied to files:
src/components/HeaderE235.test.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to **/*.test.{ts,tsx} : Mock network and Firebase layers using `jest.mock`
Applied to files:
src/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Reuse test helpers from `src/utils/test/`
Applied to files:
src/components/HeaderE235.test.tsxsrc/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to src/store/atoms/**/*.ts : Store Jotai atoms in `store/atoms/*.ts` files.
Applied to files:
src/hooks/useTransitionHeaderState.ts
📚 Learning: 2025-07-18T11:04:45.459Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。
Applied to files:
src/hooks/useTransitionHeaderState.tssrc/components/HeaderJRWest.tsxsrc/components/HeaderSaikyo.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderJL.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/{components,screens}/**/*.tsx : Component files should use PascalCase naming (e.g., `StationBanner.tsx`)
Applied to files:
src/components/HeaderTokyoMetro.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxsrc/components/HeaderJL.tsx
📚 Learning: 2025-11-03T12:13:46.409Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4595
File: src/components/LineBoardEast.tsx:497-504
Timestamp: 2025-11-03T12:13:46.409Z
Learning: In TrainLCD/MobileApp LineBoard components (LineBoardEast, LineBoardWest, LineBoardSaikyo, LineBoardToei, LineBoardJRKyushu), the correct implementation pattern is to apply the dynamic width (dim.width / 9) to the outer stationNameContainer View, as implemented in LineBoardEast, not to the inner wrapper View.
Applied to files:
src/components/HeaderTokyoMetro.tsxsrc/components/HeaderJRWest.tsxsrc/components/HeaderJRKyushu.tsxsrc/components/HeaderSaikyo.tsxsrc/components/Header.tsxsrc/components/HeaderTY.tsxsrc/components/HeaderE235.tsxTECHNICAL_DEBT.mdsrc/components/HeaderJL.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to **/*.test.{ts,tsx} : Call `jest.clearAllMocks()` in `afterEach` hook
Applied to files:
src/components/HeaderJL.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/Header.test.tsx
📚 Learning: 2025-05-06T18:50:57.931Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4243
File: __tests__/hooks/useTelemetrySender.enabled.test.tsx:0-0
Timestamp: 2025-05-06T18:50:57.931Z
Learning: In Jest tests that mock WebSocket objects, it's important to define the global WebSocket mock object and its constants (like WebSocket.OPEN) before using them in other mock objects to prevent "WebSocket is not defined" reference errors.
Applied to files:
src/components/HeaderJL.test.tsxsrc/components/HeaderJRWest.test.tsxsrc/components/HeaderLED.test.tsxsrc/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.{tsx,ts} : Name components with PascalCase (e.g., `StationBanner.tsx`).
Applied to files:
src/components/HeaderJRWest.tsxsrc/components/HeaderLED.tsxsrc/components/HeaderLED.test.tsxsrc/components/Header.tsxsrc/components/Header.types.tssrc/components/HeaderTY.tsx
📚 Learning: 2025-12-20T09:29:40.164Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4758
File: src/components/TypeChangeNotify.tsx:663-672
Timestamp: 2025-12-20T09:29:40.164Z
Learning: In TrainLCD/MobileApp TypeChangeNotify component (src/components/TypeChangeNotify.tsx), the centerCircle size differences across themes (MetroBars, SaikyoBars, JOBars) are intentional design decisions. JOBars uses larger non-tablet dimensions (32x32, borderRadius 16) compared to the base style (24x24, borderRadius 15) to maintain theme-specific visual identity.
Applied to files:
src/components/Header.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to {jest.setup.js,src/setupTests.ts} : Jest global setup lives in `jest.setup.js` and `src/setupTests.ts`.
Applied to files:
src/components/HeaderTokyoMetro.test.tsxsrc/components/HeaderTY.test.tsxsrc/components/Header.test.tsxsrc/components/HeaderSaikyo.test.tsxsrc/components/HeaderJRKyushu.test.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Prioritize minimal, auditable diffs and add concise comments for non-obvious changes
Applied to files:
TECHNICAL_DEBT.md
📚 Learning: 2025-12-25T12:38:30.140Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4784
File: TECHNICAL_DEBT.md:539-539
Timestamp: 2025-12-25T12:38:30.140Z
Learning: TrainLCD/MobileApp does not maintain a separate changelog file (docs/changelog.md or similar) for dependency updates; changes are tracked in TECHNICAL_DEBT.md instead.
Applied to files:
TECHNICAL_DEBT.md
🔇 Additional comments (55)
src/components/Header.test.tsx (1)
3-3: LGTM! フィクスチャベースのテストデータへの移行が適切です。
useHeaderCommonDataフックとcreateMockHeaderPropsフィクスチャへの移行が一貫して実装されており、新しいprops駆動型アーキテクチャに正しく対応しています。Also applies to: 8-8, 16-17, 112-112, 117-117, 129-130, 137-138
src/components/HeaderJL.test.tsx (1)
3-3: LGTM! props駆動型レンダリングへの移行が適切です。フィクスチャを使用したpropsの提供により、テストデータの一貫性が保たれています。
Also applies to: 133-133
src/components/HeaderJRWest.test.tsx (1)
4-4: LGTM! 全テストケースでフィクスチャが一貫して使用されています。様々なヘッダー状態と列車種別をカバーする全てのテストケースで、
createMockHeaderProps()を使用したprops提供が正しく実装されています。Also applies to: 162-162, 181-181, 198-198, 215-215, 232-232, 249-249, 272-272, 295-295, 312-312, 329-329, 346-346, 363-363, 377-377, 389-389, 401-401, 413-413, 425-425, 437-437, 449-449, 461-461, 473-473, 485-485, 507-507, 532-534, 553-553
src/hooks/index.ts (1)
27-28: LGTM! 新しいフックのエクスポートが適切です。
useHeaderAnimationとuseHeaderCommonDataの追加により、ヘッダーコンポーネントの共通ロジックが公開APIとして利用可能になりました。命名規則とアルファベット順にも準拠しています。src/components/HeaderE235.test.tsx (1)
3-3: LGTM! E235専用フィクスチャの使用が適切です。
createMockHeaderE235Propsを使用することで、isJOパラメータを含むE235固有のpropsを適切にテストしています。Also applies to: 134-134, 140-140
src/components/HeaderLED.test.tsx (2)
3-3: LGTM!プロップ駆動型への移行が適切に実装されています。
createMockHeaderPropsを使用した一貫したモックプロップの提供により、テストの保守性が向上しています。すべてのレンダリングパスでプロップが正しく渡されており、リファクタリングの目的に沿った実装です。Also applies to: 91-91, 96-96, 116-117, 133-134, 150-151, 167-168, 184-185, 201-202, 218-219, 235-236, 252-253, 274-275, 293-294
98-98: 日本語駅名の検証に改善されました。'T'から'新'への変更により、実際の日本語駅名のレンダリングをより適切にテストできています。
src/components/HeaderTY.test.tsx (2)
100-115: useHeaderAnimationのモックが完全に実装されています。アニメーション関連のすべてのフィールド(prevStationText、stateTopAnimatedStyles、boundTopAnimatedStylesなど)が網羅されており、新しいアーキテクチャに対応した適切なモックです。
387-399: ナンバリングアイコンのテストが改善されています。
createMockHeaderPropsのオーバーライド機能を使用して、currentStationNumberの有無による条件分岐を適切にテストしています。プロップベースのテスト戦略として優れた実装です。Also applies to: 418-422
src/components/HeaderSaikyo.test.tsx (2)
103-118: プロップ駆動型への移行が一貫して実装されています。すべてのテストケースで
createMockHeaderPropsを使用しており、他のヘッダーコンポーネントのテストと統一された構造になっています。モックの設定も完全です。Also applies to: 163-177, 199-286, 313-314, 338-339, 363-364, 385-386
406-418: ナンバリングアイコンの条件付きレンダリングが適切にテストされています。プロップのオーバーライドを使用して、駅番号の有無による表示制御を検証しています。
Also applies to: 437-441
src/__fixtures__/headerProps.ts (2)
14-39: 優れたフィクスチャ設計です。
createMockHeaderPropsは以下の点で良い実装になっています:
- すべての
CommonHeaderPropsフィールドに適切なデフォルト値を提供Partial<>を使用したオーバーライド機構- 既存のフィクスチャ(TOEI_SHINJUKU_LINE_STATIONS)を再利用
- 型安全性を保持
テスト間の一貫性を保ちながら、柔軟なカスタマイズを可能にしています。
44-50: コンポジション設計が適切です。
createMockHeaderE235Propsが基本プロップを継承しつつ、E235固有のisJOフラグを追加する設計は、DRY原則に従った優れた実装です。オーバーライドの優先順位も正しく処理されています。src/components/HeaderTokyoMetro.test.tsx (2)
3-3: LGTM!一貫したプロップ駆動型テストへの移行です。すべてのレンダリングで
createMockHeaderPropsを使用し、useHeaderAnimationの包括的なモックを提供しています。他のヘッダーコンポーネントのテストと統一された構造で、保守性が高い実装です。Also applies to: 100-115, 153-160, 182-183, 202-203, 222-223, 245-246, 268-269, 296-297, 321-322, 346-347, 368-369
389-401: ナンバリングアイコンのテストカバレッジが適切です。M01駅番号の存在/不在による条件付きレンダリングを正しく検証しており、プロップベースのテスト戦略に沿った実装です。
Also applies to: 420-424
src/components/HeaderJRKyushu.test.tsx (3)
100-115: useHeaderAnimationのモックが適切に構造化されている新しいhookの戻り値を正しくモックしており、テストの信頼性が向上しています。
145-148: jest.clearAllMocks()の使用を確認コーディングガイドラインに従い、
afterEachでjest.clearAllMocks()を呼び出しています。
389-401: propsオーバーライドによるテストが明確
createMockHeaderPropsを使用してpropsをオーバーライドするパターンが明確で、テストの意図が分かりやすくなっています。src/hooks/useHeaderAnimation.ts (3)
27-33: hookの命名とドキュメントが適切
useプレフィックスを使用し、日本語コメントでhookの目的と使用箇所を明確にドキュメント化しています。コーディングガイドラインに準拠。
147-155:fadeコールバックの依存配列による再生成に注意
fadeはfadeInとfadeOutに依存し、それらは多くのSharedValueに依存しています。useEffectでfadeを依存配列に含めているため、SharedValueの参照が変わらない限り問題ありませんが、将来的なリファクタで注意が必要です。
56-62: prevStationTextの使用について
usePrevious(stationText)の結果を返していますが、prevStationTextはhook内のロジックでは参照されず、呼び出し元へのパススルーのみです。これは意図的な設計と思われますが、確認をお願いします。src/hooks/useTransitionHeaderState.ts (4)
20-44: 駅名の言語チェック関数が適切に実装されている
hasStationTextForLangは各言語に対応する駅名フィールドを正しくチェックしており、PR目的の「存在しない英中韓駅名のスキップ」を実現しています。
46-68: 次の利用可能な言語を取得するロジック
getNextAvailableLangは現在の言語から順に次の言語を探し、駅名が存在しない言語をスキップします。見つからない場合はnullを返してJAにフォールバックする設計です。KANAをJAとして扱う処理(Line 55)は、KANAが常にJAの直後にあるため正しい動作です。
156-165: ヘッダー状態に応じた対象駅の選択CURRENTの場合は
station、それ以外(NEXT/ARRIVING)の場合はnextStationを使用しており、言語切り替え時に正しい駅の情報を参照できます。
299-302: stationを依存配列に追加
stationの変更時にuseIntervalのコールバックが再生成されるよう、依存配列に追加されています。これにより、駅が変わった際に言語チェックが正しく更新されます。src/hooks/useHeaderCommonData.ts (3)
22-26: 共通データhookの設計が明確日本語コメントでhookの役割と使用場所を明示しており、理解しやすい設計です。戻り値の型
CommonHeaderProps | nullにより、currentStationがない場合のハンドリングが型レベルで強制されます。
81-88: connectionTextの生成が安全オプショナルチェーンと
?? ''によるフォールバックで、connectedLinesがnullの場合も安全にハンドリングしています。
95-98: 早期リターンのタイミングすべてのhooksを呼び出した後に条件分岐しているため、Reactのhooksルールに違反していません。
src/components/Header.tsx (2)
15-21: prop-driven アーキテクチャへの移行が完了
useHeaderCommonDataを使用して共通データを取得し、null チェック後に各ヘッダーコンポーネントへspreadしています。これにより、各ヘッダーコンポーネントからの重複したhook呼び出しが削除され、約1,800行の削減が実現されています。
23-44: テーマ別のヘッダーコンポーネント選択すべてのケースで
{...commonData}をspreadしており、一貫性のあるprops受け渡しパターンです。HeaderE235のみ追加でisJOpropを渡しており、HeaderE235Propsの定義と整合しています。src/components/HeaderJRKyushu.tsx (3)
115-144: propsからの値の分解とアニメーションhookの使用
CommonHeaderPropsから必要な値を分解し、useHeaderAnimationに渡しています。アニメーション関連のロジックがhookに抽出され、コンポーネントはレンダリングに集中できるようになりました。
156-192: バウンドテキストのアニメーション実装トップとボトムのアニメーションスタイルを
animationオブジェクトから適用し、prevBoundTextやprevConnectionTextもanimation経由で取得しています。クロスフェードアニメーションの実装が明確です。
287-287: React.memoによるパフォーマンス最適化コンポーネントを
React.memoでラップしており、propsが変更されない限り再レンダリングを防ぎます。src/components/Header.types.ts (3)
8-42: CommonHeaderPropsの型定義が包括的駅・路線データ、グローバル状態、テキスト、ナンバリング、その他のカテゴリで整理されており、各ヘッダーコンポーネントに必要なpropsが網羅されています。日本語コメントでカテゴリを明示しているのも良い点です。
44-49: HeaderE235Propsの拡張設計
CommonHeaderPropsを継承してisJOを追加する形で、JO/YAMANOTEテーマの違いを表現しています。isJOがオプショナルなのは、デフォルトでfalseとして扱うためと思われます。
51-72: HeaderAnimationStateの型定義
useHeaderAnimationhookの戻り値型を明示的に定義しており、前フレームの値とアニメーションスタイルが区別されています。これにより、hookの使用箇所でTypeScriptの型サポートが得られます。src/components/HeaderLED.tsx (2)
51-58: props駆動のリファクタリングが適切に実装されています。CommonHeaderPropsを使用した型安全なprops受け渡しは、ヘッダーコンポーネント間の一貫性を向上させています。
60-62: useNumberingフックの使用について確認してください。コメントで説明されているように、HeaderLEDは現在駅と次駅両方のナンバリングが必要です。このフックがprops駆動のアーキテクチャと整合しているか確認してください。他のヘッダーコンポーネントでは
currentStationNumberがpropsとして渡されていますが、このコンポーネントではフックを直接使用しています。src/components/HeaderTokyoMetro.tsx (2)
112-142: useHeaderAnimationフックによるアニメーション共通化が適切に実装されています。アニメーションロジックを
useHeaderAnimationに集約し、propsから現在の状態を、animationオブジェクトから前の状態を取得する設計は、関心の分離が明確で保守性が向上しています。
157-192: アニメーションスタイルの適用が正しく実装されています。
animation.boundTopAnimatedStylesとanimation.boundBottomAnimatedStylesを使用したテキスト遷移、およびanimation.prevBoundTextとanimation.prevConnectionTextによる前の状態の表示は、スムーズなトランジション効果を実現しています。src/components/HeaderJRWest.tsx (2)
20-32: props駆動へのリファクタリングが適切に実装されています。CommonHeaderPropsを使用し、外部から必要なデータを受け取る設計に変更されています。
367-370: currentStationのnullチェックの意図を確認してください。
currentStationはこのnullチェックのみで使用されており、実際の値は使用されていません。これは意図的な動作でしょうか?もしデフォルトロゴを返すための条件であれば、コメントで意図を明確にすると良いでしょう。src/components/HeaderSaikyo.tsx (2)
129-157: HeaderSaikyoのprops駆動リファクタリングが適切に実装されています。
useHeaderAnimationフックの使用と、CommonHeaderPropsからのデータ取得が正しく実装されています。stateTextRight: ''は、このヘッダーでは右側の状態テキストを使用しないことを明確に示しています。
231-266: 駅名アニメーションの実装が正しいです。
animation.topNameAnimatedStylesとanimation.bottomNameAnimatedStylesを使用したスムーズな駅名遷移、およびtransformOriginの適切な設定が確認できます。src/components/HeaderE235.tsx (2)
87-100: HeaderE235のprops駆動リファクタリングが適切に実装されています。
HeaderE235Propsを使用し、isJOプロパティを含む専用の型定義で、JO線固有の表示ロジックをサポートしています。
102-126: ループ線判定とローカライゼーションロジックが適切に実装されています。
useLoopLineフックの使用と、boundPrefix/boundSuffixのメモ化による多言語対応(日本語、英語、中国語、韓国語)が正しく実装されています。TECHNICAL_DEBT.md (3)
5-5: 技術負債ドキュメントが適切に更新されています。最終更新日と、Header系コンポーネントの構造改善による約1,800行削減の記録が正確に反映されています。
94-140: Header系コンポーネントの改善状況が詳細に記録されています。各コンポーネントの行数削減、新しい共通フック・型定義ファイルの作成、テストケース数の更新が適切に文書化されています。これにより、将来のメンテナンスや新規開発者のオンボーディングが容易になります。
825-825: 更新履歴が詳細に記録されています。2026-01-02の変更内容が包括的に記載されており、コード削減量、新規作成ファイル、多言語対応の改善などが明確に文書化されています。
src/components/HeaderJL.tsx (2)
100-112: HeaderJLのprops駆動リファクタリングが適切に実装されています。CommonHeaderPropsを使用した型安全なprops受け渡しと、必要なデータの分割代入が明確に実装されています。
116-151: 多言語対応のメモ化が適切に実装されています。
boundPrefix、boundSuffix、clockLabelのメモ化により、headerLangStateの変更時のみ再計算されます。日本語、英語、中国語、韓国語の各言語に対応した適切なテキストが設定されています。src/components/HeaderTY.tsx (4)
1-17: インポート構造が適切に整理されています必要な型とフックが正しくインポートされており、コンポーネントのプロップ駆動型への変換に対応しています。
116-145: コンポーネント宣言とフック呼び出しが適切です
CommonHeaderProps型の採用とプロップからのデータ取得により、状態管理がシンプル化されています。アニメーション関連のプロップがuseHeaderAnimationに正しく渡されています。
293-293:React.memoによるパフォーマンス最適化が適切ですヘッダーコンポーネントは頻繁に再レンダリングされる可能性があるため、メモ化は有効です。
135-145:useHeaderAnimationフックの戻り値型でアニメーションプロパティが定義されているか確認が必要です
animationオブジェクトから複数のプロパティ(prevBoundText、prevConnectionText、prevStateText、prevStationText、prevStateTextRightなど)を参照していますが、useHeaderAnimationの戻り値型にこれらすべてが定義されているか確認してください。特にprev*系プロパティについて、型定義との整合性を確認してください。
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/components/HeaderLED.tsx (1)
69-133: null/undefined処理の一貫性を検討してください。
|| ''と?? ''が混在しています。nameプロパティには||、nameKatakana/nameRomanには??が使用されていますが、意図的でなければ統一を検討してください。また、91, 109, 127行目のオプショナルチェーン(?.)はif文で既にnullチェック済みのため不要です。🔎 冗長なオプショナルチェーンの修正例
case 'ARRIVING_EN': if (nextStation) { setStateText(translate(isLast ? 'soonEnLast' : 'soonEn')); - setStationText(nextStation?.nameRoman ?? ''); + setStationText(nextStation.nameRoman ?? ''); } break; ... case 'CURRENT_EN': if (station) { setStateText(''); - setStationText(station?.nameRoman ?? ''); + setStationText(station.nameRoman ?? ''); } break; ... case 'NEXT_EN': if (nextStation) { setStateText(translate(isLast ? 'nextEnLast' : 'nextEn')); - setStationText(nextStation?.nameRoman ?? ''); + setStationText(nextStation.nameRoman ?? ''); } break;
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/components/HeaderLED.tsx
🧰 Additional context used
📓 Path-based instructions (9)
src/{components,screens}/**/*.tsx
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Component files should use PascalCase naming (e.g.,
StationBanner.tsx)
Files:
src/components/HeaderLED.tsx
**/*.{ts,tsx,js,jsx,json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Biome as the formatter for all code files
Files:
src/components/HeaderLED.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx,js,jsx}: Use Biome as the linter for all code files
Use// biome-ignoreonly for true compatibility issues and include an inline reason
Files:
src/components/HeaderLED.tsx
**/*.{ts,tsx,js,jsx,py,java,go,cs}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx,py,java,go,cs}: Use descriptive names for agents that clearly indicate their purpose and domain
Implement agents with well-defined input/output contracts to ensure clear communication
Document agent responsibilities and expected behaviors in comments or docstrings
Use composition and dependency injection for agent collaboration rather than tight coupling
Implement error handling and graceful degradation in agents to improve system resilience
Files:
src/components/HeaderLED.tsx
**/*
📄 CodeRabbit inference engine (AGENTS.md)
Use UTF-8 encoding, two-space indentation, single quotes, and ES5 trailing commas as enforced by
.editorconfig.
Files:
src/components/HeaderLED.tsx
**/*.{js,ts,tsx,jsx,json}
📄 CodeRabbit inference engine (AGENTS.md)
Biome is authoritative for linting; avoid
// biome-ignoreunless a rule is truly incompatible and document the rationale inline.
Files:
src/components/HeaderLED.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Name components with PascalCase (e.g.,
StationBanner.tsx).
Files:
src/components/HeaderLED.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Name hooks with
use*prefix (e.g.,useStationFeed.ts).
Files:
src/components/HeaderLED.tsx
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Keep comments purposeful: explain intent or non-obvious constraints, not obvious mechanics.
Files:
src/components/HeaderLED.tsx
🧠 Learnings (7)
📓 Common learnings
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Write commit messages in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`)
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4521
File: src/screens/RouteSearchScreen.tsx:173-176
Timestamp: 2025-10-27T14:15:54.478Z
Learning: In the TrainLCD/MobileApp repository, when BFF (Backend For Frontend) returns nullish IDs for stations, this is considered a critical data integrity incident that should be fixed at the source (BFF) rather than worked around with composite key fallbacks in the client code.
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4448
File: functions/src/funcs/tts.ts:214-232
Timestamp: 2025-08-11T20:23:23.071Z
Learning: PR #4448 in TrainLCD/MobileApp is specifically about AI feedback summarization and labeling functionality, not about TTS (Text-to-Speech) improvements. The TTS code changes appear to be part of a modularization refactoring but are not the focus of this PR.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Commit messages must be single-sentence statements in Japanese (e.g., `テレメトリー送信機をリファクタリングしてnull状態を回避`); prefix production hot fixes with `Hotfix:`.
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Code review and feedback should be provided in Japanese
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4595
File: src/components/LineBoardEast.tsx:497-504
Timestamp: 2025-11-03T12:13:46.409Z
Learning: In TrainLCD/MobileApp LineBoard components (LineBoardEast, LineBoardWest, LineBoardSaikyo, LineBoardToei, LineBoardJRKyushu), the correct implementation pattern is to apply the dynamic width (dim.width / 9) to the outer stationNameContainer View, as implemented in LineBoardEast, not to the inner wrapper View.
📚 Learning: 2025-05-19T10:59:37.813Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4286
File: src/components/HeaderLED.tsx:5-10
Timestamp: 2025-05-19T10:59:37.813Z
Learning: The hooks useCurrentStation, useNextStation, useIsNextLastStop, and useNumbering are properly exported in src/hooks/index.ts, allowing them to be imported from '../hooks' in src/components/HeaderLED.tsx as implemented in PR #4286.
Applied to files:
src/components/HeaderLED.tsx
📚 Learning: 2025-06-18T17:29:46.085Z
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4359
File: src/components/TrainTypeList.tsx:1-1
Timestamp: 2025-06-18T17:29:46.085Z
Learning: When analyzing React import changes in TypeScript/JavaScript files, carefully verify that React.Fragment, React.createElement, or other React namespace usages actually exist in the code before flagging them as issues. Don't assume React.Fragment is used just because the default React import was removed.
Applied to files:
src/components/HeaderLED.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/{components,screens}/**/*.tsx : Component files should use PascalCase naming (e.g., `StationBanner.tsx`)
Applied to files:
src/components/HeaderLED.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.{tsx,ts} : Name components with PascalCase (e.g., `StationBanner.tsx`).
Applied to files:
src/components/HeaderLED.tsx
📚 Learning: 2025-12-31T12:21:36.200Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-31T12:21:36.200Z
Learning: Applies to **/*.{ts,tsx} : Name hooks with `use*` prefix (e.g., `useStationFeed.ts`).
Applied to files:
src/components/HeaderLED.tsx
📚 Learning: 2025-11-25T03:10:26.328Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-25T03:10:26.328Z
Learning: Applies to src/hooks/**/*.ts : Custom hooks should use `use` prefix (e.g., `useStationFeed.ts`)
Applied to files:
src/components/HeaderLED.tsx
🧬 Code graph analysis (1)
src/components/HeaderLED.tsx (1)
src/components/Header.types.ts (1)
CommonHeaderProps(11-42)
🔇 Additional comments (4)
src/components/HeaderLED.tsx (4)
51-59: LGTM!プロップ駆動への移行が適切に実装されています。全てのpropsが一箇所で分割代入されており、可読性が向上しています。
61-63: LGTM!HeaderLEDが両方のナンバリングを必要とする理由がコメントで明確に説明されています。
152-160: LGTM!
numberingTextのメモ化ロジックが明確で、依存配列も正しく設定されています。
162-190: LGTM!レンダリングロジックがシンプルで、条件分岐も明確です。
React.memoによるメモ化も適切です。
Summary by CodeRabbit
リリースノート
リファクタリング
新機能
テスト
ドキュメント
✏️ Tip: You can customize this high-level summary in your review settings.