Repository navigation
E231系テーマを追加 - #5723
E231系テーマを追加#5723
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughE231 テーマを新規追加。翻訳、テーマ定義、テーマ情報、TTS マッピング、Main 背景色を更新し、ChevronE231/HeaderE231/LineBoardE231/TrainTypeBoxE231 等の新コンポーネントを実装して既存表示ロジックへ統合した。 Changes
Sequence Diagram(s)sequenceDiagram
participant App as App
participant ThemeResolver as ThemeResolver
participant Header as HeaderE231
participant LineBoard as LineBoardE231
participant Chevron as ChevronE231
participant Assets as ThemeAssets
App->>ThemeResolver: 現在のテーマを取得
ThemeResolver-->>App: APP_THEME = E231
App->>Header: HeaderE231 をレンダリング(commonData)
App->>LineBoard: LineBoardE231 をレンダリング(stations, lineColors)
LineBoard->>Chevron: ChevronE231 を描画要求(位置・状態)
Chevron->>Assets: グラデーション id を参照して描画
Header->>Assets: translate('themeDescriptionE231') を取得
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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.
Actionable comments posted: 4
🧹 Nitpick comments (2)
src/utils/themeInfo.ts (1)
72-77: TODOコメントを確認しました。E231テーマ用のプレビュー画像がSaikyoテーマの画像でプレースホルダーとして設定されています。プレビュー画像の作成後に差し替えが必要です。
プレビュー画像の作成タスクを追跡するためのIssueを作成しましょうか?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/utils/themeInfo.ts` around lines 72 - 77, The E231 theme entry in themeInfo (APP_THEME.E231) uses Saikyo placeholder images (spImage/tabletImage pointing at saikyo-*.webp); replace these with the real E231 preview assets once created and update descriptionKey if needed; to track, create an Issue for "E231 preview images" and attach the new asset filenames so the maintainer can update the spImage/tabletImage requires in themeInfo.ts (APP_THEME.E231) when the final images are available.src/components/LineBoardE231.tsx (1)
310-338: 8 枠補完のロジックが効いていません。
stationsWithEmptyでundefinedを足していますが、stationNameCellForMap()が falsy をnullで落とすので空セルは 1 つも描画されません。8 枠固定が必要なら placeholder を描画し、不要ならこの補完ごと削った方が読みやすいです。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/LineBoardE231.tsx` around lines 310 - 338, stationsWithEmpty currently appends undefined entries so stationNameCellForMap returns null for those and no placeholders render; either (A) make stationsWithEmpty fill with explicit placeholder Station objects (e.g., with a unique id and an isPlaceholder/isEmpty flag) so StationNameCell receives a real Station and can render an empty cell, or (B) remove the padding and the stationsWithEmpty logic if fixed-length slots are not required, or (C) change stationNameCellForMap to treat a falsy s by returning a placeholder cell component instead of null; update usages of stationsWithEmpty, StationNameCell, and stationNameCellForMap accordingly so placeholders render when 8 slots are required.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/ChevronE231.tsx`:
- Around line 1-4: The file uses React.FC in the component signature but never
imports React or FC; add a proper import from 'react' (either import React from
'react' or import type { FC } from 'react' and update the signature accordingly)
so the ChevronE231 component's type annotation (ChevronE231: React.FC) resolves
under strict type checking.
In `@src/components/HeaderE231.tsx`:
- Around line 151-162: The bound/first-stop logic clears the entire destination
text resulting in missing destination for始発; instead of emptying boundText,
preserve boundText and only append the language-specific suffix when needed.
Update the code paths that set boundText to '' (and the useMemo boundSuffixText)
so that boundText remains unchanged for firstStop and you concatenate
boundSuffixText (computed from headerLangState and firstStop for only
JA/KANA/KO) to the existing boundText; reference the boundSuffixText
computation, the headerLangState/firstStop inputs, and wherever boundText is
being set to '' (the boundText assignment locations) to implement this change.
In `@src/components/TrainTypeBoxE231.tsx`:
- Around line 98-111: The strokeColor computation can throw when getLuminance
receives an invalid color; update TrainTypeBoxE231.tsx so strokeColor is derived
safely by either calling the existing utility getTrainTypeTextColor() (which
normalizes color and handles errors) or by wrapping getLuminance(trainTypeColor)
in a try/catch and falling back to a safe value (e.g., '#555' or '#fff') when
normalization fails; locate the useMemo that computes trainTypeColor and the
strokeColor useMemo and replace the direct getLuminance call with a call to
getTrainTypeTextColor (or a guarded try/catch + normalized color) to ensure
invalid trainType.color values do not crash rendering.
In `@src/components/TransfersHeading.tsx`:
- Around line 74-79: TransfersHeading コンポーネントの見出しが LinearGradient
を使って4色グラデーションになっており、E231 テーマの単色方針と合っていません。LinearGradient
の使用をやめ、styles.headingContainerE231 を使うコンテナを単色背景に変更する(LinearGradient を View
に置き換えるか、LinearGradient の colors/locations を削除して styles.headingContainerE231 の
backgroundColor に E231 の指定色を入れる)ことで、他の E231 パーツと質感を揃えてください。対象の識別子:
TransfersHeading, LinearGradient, styles.headingContainerE231。
---
Nitpick comments:
In `@src/components/LineBoardE231.tsx`:
- Around line 310-338: stationsWithEmpty currently appends undefined entries so
stationNameCellForMap returns null for those and no placeholders render; either
(A) make stationsWithEmpty fill with explicit placeholder Station objects (e.g.,
with a unique id and an isPlaceholder/isEmpty flag) so StationNameCell receives
a real Station and can render an empty cell, or (B) remove the padding and the
stationsWithEmpty logic if fixed-length slots are not required, or (C) change
stationNameCellForMap to treat a falsy s by returning a placeholder cell
component instead of null; update usages of stationsWithEmpty, StationNameCell,
and stationNameCellForMap accordingly so placeholders render when 8 slots are
required.
In `@src/utils/themeInfo.ts`:
- Around line 72-77: The E231 theme entry in themeInfo (APP_THEME.E231) uses
Saikyo placeholder images (spImage/tabletImage pointing at saikyo-*.webp);
replace these with the real E231 preview assets once created and update
descriptionKey if needed; to track, create an Issue for "E231 preview images"
and attach the new asset filenames so the maintainer can update the
spImage/tabletImage requires in themeInfo.ts (APP_THEME.E231) when the final
images are available.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 440b15ac-ea14-485b-8c15-cb0a4c2f4255
📒 Files selected for processing (16)
assets/translations/en.jsonassets/translations/ja.jsonsrc/components/ChevronE231.tsxsrc/components/Header.tsxsrc/components/HeaderE231.tsxsrc/components/LineBoard.tsxsrc/components/LineBoardE231.tsxsrc/components/TrainTypeBoxE231.tsxsrc/components/TransfersHeading.tsxsrc/constants/theme.tssrc/hooks/useBusTTSText.tssrc/hooks/useTTSText.tssrc/models/Theme.tssrc/screens/Main.tsxsrc/utils/theme.tssrc/utils/themeInfo.ts
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/TrainTypeBoxE231.tsx (1)
116-118:headerLangStateのパースはフォールバックを明示するとより安全です。Line 117 は型アサーションで不正値を隠してしまうため、値を検証して
JAにフォールバックすると将来の保守性が上がります。差分案
- const headerLangState = useMemo((): HeaderLangState => { - return headerState.split('_')[1] as HeaderLangState; - }, [headerState]); + const headerLangState = useMemo((): HeaderLangState => { + const lang = headerState.split('_')[1]; + return lang === 'JA' || lang === 'EN' || lang === 'ZH' || lang === 'KO' + ? lang + : 'JA'; + }, [headerState]);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/TrainTypeBoxE231.tsx` around lines 116 - 118, The current useMemo for headerLangState unsafely asserts headerState.split('_')[1] as HeaderLangState, which can hide invalid values; validate the parsed part instead and fall back to 'JA' when missing or not a valid HeaderLangState. Update the memo block (the useMemo that defines headerLangState) to extract the token from headerState.split('_')[1], check it against the allowed HeaderLangState values (or a helper isValidHeaderLang function), and return the token if valid otherwise return 'JA'.
🤖 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/TrainTypeBoxE231.tsx`:
- Around line 116-118: The current useMemo for headerLangState unsafely asserts
headerState.split('_')[1] as HeaderLangState, which can hide invalid values;
validate the parsed part instead and fall back to 'JA' when missing or not a
valid HeaderLangState. Update the memo block (the useMemo that defines
headerLangState) to extract the token from headerState.split('_')[1], check it
against the allowed HeaderLangState values (or a helper isValidHeaderLang
function), and return the token if valid otherwise return 'JA'.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f18a2516-6d31-4ca5-b93c-1eca50d20371
📒 Files selected for processing (2)
src/components/ChevronE231.tsxsrc/components/TrainTypeBoxE231.tsx
✅ Files skipped from review due to trivial changes (1)
- src/components/ChevronE231.tsx
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/HeaderE231.test.tsx`:
- Around line 53-69: Add automated tests covering ZH and KO fallback branches in
the HeaderE231 tests: extend the existing test block that renders <HeaderE231
{...createMockHeaderProps({ stateText: '', headerLangState: ... })} /> to also
assert getByText('translated:nowStoppingAtZh') and
getByText('translated:nowStoppingAtKo'); ideally convert the JA/EN/ZH/KO cases
into a table-driven test (array of locale→expected key) and iterate to render
HeaderE231 and assert the expected fallback text for each locale so ZH and KO
regressions are detected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 0f4ed029-9947-4d8d-bd48-122cde04c38f
📒 Files selected for processing (2)
src/components/HeaderE231.test.tsxsrc/utils/themeInfo.test.ts
✅ Files skipped from review due to trivial changes (1)
- src/utils/themeInfo.test.ts
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
|
@coderabbitai 他にないならapproveしてください |
|
Tip For best results, initiate chat on the files or code changes.
[approve] 🧠 Learnings used |
なぜかapproveされていない表示になっているため
Summary
close #4492
主な変更
APP_THEME.E231を追加(テーマカラー:#FFD400)HeaderE231— グレー背景(#A6A4A5)、白枠駅名、種別名白抜きアウトライン、「現在時刻」ラベル付き時計TrainTypeBoxE231— kindベースの種別名フォールバック(4文字超対応)、polishedgetLuminanceによるストローク色切替LineBoardE231— フラット路線色バー(通過済みもグレー化なし)、四角LineDot、ChevronE231(緑グラデ矢印)、終端三角形TransfersHeading— 紫青系カプセル型「のりかえのご案内」ヘッディングresolveThemeForLine— 自動テーマ設定に りんかい線(99337)→SAIKYO、中央・総武線(11313)/中央快速線(11312)/京浜東北線(11332)→E231 を追加Test plan
npm run typecheck通過npm run lint通過npm test全1387テスト通過🤖 Generated with Claude Code
Summary by CodeRabbit
新機能