Skip to content

CommonCard改良 - #4712

Merged
TinyKitten merged 2 commits into
devfrom
fix/common-card
Dec 6, 2025
Merged

TinyKitten merged 2 commits into
devfrom
fix/common-card

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Dec 6, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

バグ修正

  • 経路情報、駅検索、乗車種別情報画面で路線名の重複を排除し、表示の正確性を向上させました
  • 乗り換え路線マークの色表示を改善しました

✏️ Tip: You can customize this high-level summary in your review settings.

@TinyKitten TinyKitten self-assigned this Dec 6, 2025
@github-actions github-actions Bot added the react label Dec 6, 2025
@coderabbitai

coderabbitai Bot commented Dec 6, 2025 •

Copy link
Copy Markdown
Contributor

Note

.coderabbit.yml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'auto_review'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

複数のモーダルコンポーネントで路線名の重複排除ロジックを追加し、CommonCardコンポーネントではオプショナルチェーニングと路線シンボルカラーの活用によって色の処理を改善しました。

Changes

Cohort / File(s) Change Summary
路線名の重複排除
src/components/RouteInfoModal.tsx, src/components/StationSearchModal.tsx, src/components/TrainTypeListModal.tsx
各モーダルでサブタイトル構築時に路線名の配列をSetで処理して重複排除を実施。日本語はnameShort、その他はnameRomanを使用し、前後のjoin()で適切な区切り文字を適用
カラー処理の改善
src/components/CommonCard.tsx
オプショナルチェーニングでステーション確認を簡潔化し、最初のステーション番号からlineSymbolColorを読み込んでtargetStationColorを構築。TransferLineMarkにcolorプロップを渡し、優先順位に従いカラー解決を実施

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • 路線名の重複排除ロジックは3ファイルで同じパターンであり、各コンテキストでの正確性を確認する必要があります
  • CommonCardのカラー処理では、targetStationColorの解決順序とフォールバック動作を検証してください
  • 各モーダルでセットの処理がUI表示に正しく反映されているかを確認してください

Possibly related PRs

Suggested labels

react

Poem

🐰 4つのコンポーネント、色とりどりに光りて
重複なく、すっきりと名前が並びぬ
シンボルカラー優しく、Setは重複を払いのけ
UIの整理整頓、完成かな ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning タイトル「CommonCard改良」は、主にCommonCardコンポーネントの改良のみに焦点を当てていますが、実際にはRouteInfoModal、StationSearchModal、TrainTypeListModalなど複数のコンポーネントが変更されており、全体的な変更内容を正確に反映していません。 タイトルを「複数のモーダルコンポーネント内のライン名重複排除と色プロップの追加」など、すべての変更ファイルを適切に反映した内容に修正してください。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/common-card

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 500cda3 and b79e0d9.

📒 Files selected for processing (4)
  • src/components/CommonCard.tsx (3 hunks)
  • src/components/RouteInfoModal.tsx (1 hunks)
  • src/components/StationSearchModal.tsx (1 hunks)
  • src/components/TrainTypeListModal.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
src/{components,screens}/**/*.tsx

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Component files should use PascalCase naming (e.g., StationBanner.tsx)

Use PascalCase for component file names (e.g., StationBanner.tsx)

Files:

  • src/components/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/CommonCard.tsx
  • src/components/TrainTypeListModal.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/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/CommonCard.tsx
  • src/components/TrainTypeListModal.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-ignore only for true compatibility issues and include an inline reason

Use .editorconfig standards: UTF-8 encoding, two-space indentation, single quotes, and ES5 trailing commas

Files:

  • src/components/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/CommonCard.tsx
  • src/components/TrainTypeListModal.tsx
src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Biome is authoritative for linting; avoid // biome-ignore unless a rule is truly incompatible and document the rationale inline

Files:

  • src/components/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/CommonCard.tsx
  • src/components/TrainTypeListModal.tsx
🧠 Learnings (6)
📓 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.
📚 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/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/CommonCard.tsx
  • src/components/TrainTypeListModal.tsx
📚 Learning: 2025-11-25T03:10:44.293Z
Learnt from: CR
Repo: TrainLCD/MobileApp PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T03:10:44.293Z
Learning: Applies to src/{components,screens}/**/*.tsx : Use PascalCase for component file names (e.g., `StationBanner.tsx`)

Applied to files:

  • src/components/StationSearchModal.tsx
📚 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/components/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/CommonCard.tsx
  • src/components/TrainTypeListModal.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/StationSearchModal.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/StationSearchModal.tsx
🔇 Additional comments (5)
src/components/RouteInfoModal.tsx (1)

113-114: 路線名の重複排除ロジックが適切に実装されています。

Setを使用した重複排除により、サブタイトルに同じ路線名が複数回表示されることを防いでいます。日本語と英語の両方に対応しており、実装は明確です。

src/components/StationSearchModal.tsx (1)

167-168: RouteInfoModalと同様の重複排除ロジックが実装されています。

複数のモーダルコンポーネント間で一貫性のあるアプローチが採用されており、サブタイトルの表示品質が向上します。

src/components/CommonCard.tsx (2)

162-162: オプショナルチェーニングの使用により、コードが簡潔になっています。

!stations?.lengthは以前の!stations || !stations.lengthよりも読みやすく、同じ動作を維持しています。


194-195: 駅固有の路線シンボルカラーを活用する改良が実装されています。

lineSymbolColorから色を抽出し、フォールバックチェーン(targetStationColor ?? line.color ?? undefined)で適切にTransferLineMarkに渡すことで、より正確な色表示が可能になります。

Also applies to: 232-232

src/components/TrainTypeListModal.tsx (1)

144-144: 経由路線の重複排除が適切に実装されています。

目的地が指定された際の経由路線表示において、他のモーダルコンポーネントと一貫した重複排除ロジックが使用されています。「直通」表示や「Via」表示の品質が向上します。

Also applies to: 148-148


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.

1 participant