Skip to content

feat: マップのストローク色にGraphQLのラインカラーを使用#21

Merged
TinyKitten merged 3 commits intomainfrom
feature/line-color
Feb 11, 2026
Merged

feat: マップのストローク色にGraphQLのラインカラーを使用#21
TinyKitten merged 3 commits intomainfrom
feature/line-color

Conversation

@TinyKitten
Copy link
Copy Markdown
Member

@TinyKitten TinyKitten commented Feb 11, 2026

  • GraphQLクエリにcolorフィールドを追加し、路線カラーを取得
  • Polylineを路線セグメントごとに分割して各路線の色で描画
  • 路線フィルターボタンにもラインカラーを適用
  • 軌跡の始点に小さい丸マーカーを追加

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Summary by CodeRabbit

リリースノート

  • 新機能
    • マップで線ごとの色指定に対応し、線フィルター、ポリライン、開始/最新マーカーが各路線色で表示されます。
    • 軌跡をセグメント単位で色分けして描画し、視認性が向上しました。
  • テスト
    • 線色キャッシュの挙動を検証するテストを追加しました。

- GraphQLクエリにcolorフィールドを追加し、路線カラーを取得
- Polylineを路線セグメントごとに分割して各路線の色で描画
- 路線フィルターボタンにもラインカラーを適用
- 軌跡の始点に小さい丸マーカーを追加

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@TinyKitten TinyKitten self-assigned this Feb 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

マップで路線ごとの色を取得・キャッシュし、トラジェクトリーを同一 line_id の連続点で分割したセグメント単位で描画。フィルター・ポリライン・マーカーの色付けを路線色に切替え、色キャッシュ用のフックを追加しました。

Changes

Cohort / File(s) Summary
マップレンダリング
app/(tabs)/map.tsx
useLineColors を組み込み。トラジェクトリーをセグメント毎に描画し、ポリライン・開始マーカー・最新ピン・フィルターボタンの色を路線色で設定。startMarker スタイル追加。
トラジェクトリー処理
hooks/use-device-trajectory.ts
LineSegment インターフェース追加。DeviceTrajectorysegments: LineSegment[] を追加し、同一 line_id の連続更新をグループ化してセグメントを生成。
色キャッシュ機構
hooks/use-line-names.ts
colorCache を追加。GraphQL で色を取得・正規化(先頭 # 補完)し、useLineColors(lineIds)_getColorCache() を導出。_resetCache() を色キャッシュもクリアするよう拡張。
色キャッシュテスト
lib/__tests__/use-line-names.test.ts
テストヘルパーが color フィールドを受け取るよう拡張。_getColorCache を使った色の正規化・null処理を検証するテストを追加。
定数 / 色ロジック削除
constants/map-colors.ts
デバイスIDから色を算出していた getDeviceColor 関数を削除(MAP_TRAJECTORY_COLORS 自体は維持)。

Sequence Diagram(s)

sequenceDiagram
    participant Map as MapComponent
    participant Hook as useLineColors
    participant Names as useLineNames
    participant API as GraphQL
    participant Cache as ColorCache

    Map->>Hook: lineIds を要求
    Hook->>Names: fetchLineNames(lineIds)
    Names->>API: lines クエリ(color 含む)を送信
    API-->>Names: lineId + color を返す
    Names->>Cache: 色を正規化して colorCache に保存
    Names-->>Hook: Record<lineId,color> を返却
    Hook-->>Map: lineColors を提供
    Map->>Map: セグメントごとに色付きでレンダリング
    Map->>Map: フィルター・マーカーに lineColors を適用
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 色を抱いて線は跳ねる
セグメントごとに小さな春が咲く
キャッシュは静かに色を覚え
マップはそっと虹を織る
ぴょん、祝杯をどうぞ ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed プルリクエストのタイトルは、変更内容の主要な目的を明確に表している。GraphQL から取得したラインカラーをマップのストローク色に使用することが主な変更であり、タイトルはこの内容を適切に要約している。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 feature/line-color

No actionable comments were generated in the recent review. 🎉


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

TinyKitten and others added 2 commits February 11, 2026 19:38
デバイスごとの色分けを廃止し、路線カラーに一本化。
フォールバック色はデフォルトカラーを使用。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@TinyKitten TinyKitten merged commit f68964c into main Feb 11, 2026
1 check passed
@TinyKitten TinyKitten deleted the feature/line-color branch February 11, 2026 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant