Skip to content

小田急テーマのTypeChangeNotify対応と直通運転時の路線名表示バグ修正#5706

Merged
TinyKitten merged 2 commits intodevfrom
feature/odakyu-type-change-notify
Mar 28, 2026
Merged

小田急テーマのTypeChangeNotify対応と直通運転時の路線名表示バグ修正#5706
TinyKitten merged 2 commits intodevfrom
feature/odakyu-type-change-notify

Conversation

@TinyKitten
Copy link
Copy Markdown
Member

@TinyKitten TinyKitten commented Mar 28, 2026

Summary

  • 小田急テーマ(ODAKYU)のTypeChangeNotifyに独自グラデーションデザインを追加(ハイライトオフセット0.35、シャドウ・グロスグラデーション、BarTerminalOdakyu使用)
  • 直通運転時(例: 小田急多摩線→千代田線→常磐線)にTypeChangeNotifyの左側バーの路線名が選択路線(小田急多摩線)のまま表示されるバグを修正。station.lines(複数形)から中間路線を特定するロジックを追加
  • 回帰テストを追加(ODAKYUテーマレンダリング、直通運転時の中間路線名表示)

バグの原因

  • useCurrentLine() は直通運転時に全区間で選択路線を返す
  • station.line(単数)も同様に選択路線が設定される
  • dropEitherJunctionStation により接続駅の前路線側データが除去される
  • station.lines(複数形)には実際の所属路線が含まれるため、ここからnextLineでもcurrentLineでもない路線を探索することで正しい中間路線名を取得

Test plan

  • npm run typecheck パス
  • npx biome check ./src パス
  • npm test -- src/components/TypeChangeNotify.test.tsx 6/6パス
  • 小田急多摩線→千代田線→常磐線ルートで左側バーに「千代田線」が表示されること
  • 小田急テーマでTypeChangeNotify画面のバーが正しくグラデーション表示されること
  • 他テーマ(TOKYO_METRO, SAIKYO, JO等)で既存動作に影響がないこと

🤖 Generated with Claude Code

TinyKitten and others added 2 commits March 28, 2026 17:19
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added the react label Mar 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 28, 2026

📝 Walkthrough

概要

TypeChangeNotify コンポーネントに ODAKYU テーマのサポートを追加し、テーマに応じた UI レンダリングと線情報の計算ロジックを実装しました。対応するテストケースも追加されています。

変更内容

コホート / ファイル 概要
TypeChangeNotify テストスイート
src/components/TypeChangeNotify.test.tsx
BarTerminalOdakyu のモック追加、ODAKYU テーマ時の動作検証、"through service" シナリオの中間線表示テスト追加
TypeChangeNotify コンポーネント
src/components/TypeChangeNotify.tsx
ODAKYU テーマ対応の BarTerminalOdakyu コンポーネント追加、displayCurrentLine 計算ロジック実装(現在・次行以外の線を選択)、BarsComponent のゲート条件更新

シーケンスダイアグラム

sequenceDiagram
    participant Component as TypeChangeNotify
    participant Atoms as Jotai<br/>(Theme/Station)
    participant Logic as displayCurrentLine<br/>計算
    participant Bars as BarsComponent<br/>(SAIKYO/JO/East/Odakyu)

    Component->>Atoms: theme, currentLine, nextLineを取得
    Component->>Atoms: stations を取得
    Component->>Logic: 現在行・次行以外の線を抽出
    Logic-->>Component: displayCurrentLine(中間線)
    alt displayCurrentLine が存在する場合
        Component->>Bars: displayCurrentLine を props に渡す
        Bars-->>Component: テーマに応じたUIをレンダリング
    else displayCurrentLine がない場合
        Component-->>Component: null を返す
    end
Loading

推定コードレビュー工数

🎯 3 (中程度) | ⏱️ ~25 分

🐰 小田急の色も加わり虹色に、
線を見分ける知恵が咲いた。
計算が綺麗に踊り出して、
どの線を選ぶ?それは流れの中で、
テーマに彩られたUI、ぴょん!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed タイトルは、小田急テーマ対応と直通運転時の路線名表示バグ修正という、PR の主要な変更内容を明確かつ簡潔に要約しており、関連性が高い。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed PRの説明はテンプレートの主要セクションをカバーし、技術的な詳細、バグ原因の説明、テスト実行状況が記載されている。

✏️ 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/odakyu-type-change-notify

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

@TinyKitten TinyKitten self-assigned this Mar 28, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

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/TypeChangeNotify.tsx (1)

423-436: グラデーション関数が defaultBarGradient / defaultBoxGradient と同一です。

現状は動作に問題ありませんが、将来的に Odakyu 固有のグラデーションが不要であれば、既存の defaultBarGradient / defaultBoxGradient を再利用できます。

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

In `@src/components/TypeChangeNotify.tsx` around lines 423 - 436, The
odakyuBarGradient and odakyuBoxGradient currently duplicate
defaultBarGradient/defaultBoxGradient; replace their definitions to reuse
defaultBarGradient and defaultBoxGradient respectively (remove the duplicate
string-template implementations) and keep ODAKYU_HIGHLIGHT_OFFSET and
odakyuTerminalWidth/BarTerminalOdakyu logic unchanged; update any references to
odakyuBarGradient/odakyuBoxGradient to point to the reused default functions to
avoid redundant code.
🤖 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/TypeChangeNotify.tsx`:
- Around line 423-436: The odakyuBarGradient and odakyuBoxGradient currently
duplicate defaultBarGradient/defaultBoxGradient; replace their definitions to
reuse defaultBarGradient and defaultBoxGradient respectively (remove the
duplicate string-template implementations) and keep ODAKYU_HIGHLIGHT_OFFSET and
odakyuTerminalWidth/BarTerminalOdakyu logic unchanged; update any references to
odakyuBarGradient/odakyuBoxGradient to point to the reused default functions to
avoid redundant code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3929585e-5351-4665-97a2-55f453d7d9cb

📥 Commits

Reviewing files that changed from the base of the PR and between 66178f6 and 3585eaa.

📒 Files selected for processing (2)
  • src/components/TypeChangeNotify.test.tsx
  • src/components/TypeChangeNotify.tsx

@TinyKitten TinyKitten merged commit bfc77a1 into dev Mar 28, 2026
7 checks passed
@TinyKitten TinyKitten deleted the feature/odakyu-type-change-notify branch March 28, 2026 08:47
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