Skip to content

TOEIテーマのLineBoardで無効化された言語の併記表示を非表示にする - #5770

Merged
TinyKitten merged 4 commits into
devfrom
claude/hide-disabled-languages-D10S9
Apr 6, 2026
Merged

TinyKitten merged 4 commits into
devfrom
claude/hide-disabled-languages-D10S9

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Apr 6, 2026 •

Copy link
Copy Markdown
Member

https://claude.ai/code/session_01NMDiHx11nf3BxZZ1tjAWMc

Summary by CodeRabbit

  • 新機能
    • 設定に基づき韓国語・中国語の駅名表示を個別に有効/無効化できるようになりました。表示のカスタマイズが可能です。
  • テスト
    • 韓国語・中国語の表示切替を検証する複数のテストを追加しました(有効時/無効時の表示確認)。

@github-actions github-actions Bot added the react label Apr 6, 2026
@coderabbitai

coderabbitai Bot commented Apr 6, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ccb70f26-a24a-4783-89ce-c17c6cbdc4be

📥 Commits

Reviewing files that changed from the base of the PR and between e9cee18 and 81771b3.

📒 Files selected for processing (1)
  • src/components/LineBoardToei.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/LineBoardToei.test.tsx

📝 Walkthrough

Walkthrough

StationNameToei に言語フラグを追加し、navigationState の enabledLanguages を参照して中国語・韓国語の表示を条件付きで制御するように変更。テストを更新し、useAtomValue の Jest モックをアトムのブランドで分岐する実装に置き換えた。

Changes

Cohort / File(s) Summary
テストモック更新
src/components/LineBoardToei.test.tsx
isEn をブランド付きオブジェクトに変更し、~/store/atoms/navigation のモックを追加。useAtomValue.mockImplementation() を導入するヘルパーでアトムの __brand に基づき返却値を分岐するように変更。言語表示に関する4つの追加テストを含む。
言語フラグ追加と表示制御
src/components/LineBoardToei.tsx
StationNameToeiProps に isKoEnabled? と isZhEnabled? を追加。StationNameCell が navigationState.enabledLanguages を読み、isKoEnabled/isZhEnabled を算出して中国語・韓国語のレンダリングを条件付きで行うように変更。韓国語の文字分割表示はフラグ有効時のみレンダリング。

Sequence Diagram(s)

(該当する変更ではシーケンス図を省略します)

推定コードレビュー負荷

🎯 3 (Moderate) | ⏱️ ~25 minutes

詩

🐰 新しい旗がひらり、
字がぴょんと並ぶよ、
韓国も中国もそっと現れ、
テストが笑って合図する、
駅名が多言語で跳ねるよ ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning プルリクエストの説明が要件テンプレートの必須セクション(概要、変更の種類、変更内容、テスト等)を満たしておらず、外部リンクのみが記載されている。 テンプレートに従い、概要、変更の種類(チェックボックス)、詳細な変更内容、実施したテストを日本語で記述してください。
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed プルリクエストのタイトルは、TOEI テーマの LineBoard で無効化された言語の併記表示を非表示にするという、変更セットの主要な目的を明確に要約している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 claude/hide-disabled-languages-D10S9

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/components/LineBoardToei.test.tsx (2)

117-131: 無効化ケース(KO/ZH OFF)の回帰テストも追加したいです。

Line 125 で常に ['JA', 'EN', 'ZH', 'KO'] を返しているため、今回の主目的である「無効時に併記を非表示」の検証が不足しています。enabledLanguages から KO / ZH を外したケースを1-2件追加すると回帰耐性が上がります。

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

In `@src/components/LineBoardToei.test.tsx` around lines 117 - 131, The
mockUseAtomValue helper always returns enabledLanguages = ['JA','EN','ZH','KO'],
so add one or two regression test cases that simulate disabled languages by
altering mockUseAtomValue's branch for the 'navigationState' atom to return
variants without 'KO' and/or 'ZH' (e.g., ['JA','EN'] and ['JA','EN','ZH']), then
assert in the corresponding tests that bilingual labels for the disabled
languages are not rendered; update tests that call mockUseAtomValue in
LineBoardToei.test.tsx (the mockUseAtomValue function and the tests around its
usage) to include these scenarios.

242-257: useAtomValue 分岐モックの重複はヘルパー化すると保守しやすいです。

Line 117-131 とほぼ同じ分岐が再定義されているので、selectedLine だけ差し替え可能なヘルパーに寄せると変更時の追従漏れを防げます。

差分例
- useAtomValue.mockImplementation((atomVal: unknown) => {
-   if (atomVal && (atomVal as { __brand?: string }).__brand === 'isEnAtom') {
-     return false;
-   }
-   if (
-     atomVal &&
-     (atomVal as { __brand?: string }).__brand === 'navigationState'
-   ) {
-     return { enabledLanguages: ['JA', 'EN', 'ZH', 'KO'] };
-   }
-   return {
-     station: mockStations[0],
-     arrived: true,
-     selectedLine: null,
-   };
- });
+ const createAtomValueMock =
+   (overrides: Record<string, unknown> = {}) =>
+   (atomVal: unknown) => {
+     if ((atomVal as { __brand?: string })?.__brand === 'isEnAtom') return false;
+     if ((atomVal as { __brand?: string })?.__brand === 'navigationState') {
+       return { enabledLanguages: ['JA', 'EN', 'ZH', 'KO'] };
+     }
+     return { station: mockStations[0], arrived: true, ...overrides };
+   };
+
+ useAtomValue.mockImplementation(createAtomValueMock({ selectedLine: null }));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/LineBoardToei.test.tsx` around lines 242 - 257, The duplicated
branching mock for useAtomValue in LineBoardToei.test.tsx should be extracted
into a reusable helper (e.g., createUseAtomValueMock or getUseAtomValueMock)
that returns the common defaults and accepts an override for selectedLine;
replace both inline mockImplementation blocks with calls to this helper (pass
selectedLine=null or your test-specific value) so the navigationState and
isEnAtom branches live in one place and selectedLine is easily swapped per test.
🤖 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/LineBoardToei.test.tsx`:
- Around line 117-131: The mockUseAtomValue helper always returns
enabledLanguages = ['JA','EN','ZH','KO'], so add one or two regression test
cases that simulate disabled languages by altering mockUseAtomValue's branch for
the 'navigationState' atom to return variants without 'KO' and/or 'ZH' (e.g.,
['JA','EN'] and ['JA','EN','ZH']), then assert in the corresponding tests that
bilingual labels for the disabled languages are not rendered; update tests that
call mockUseAtomValue in LineBoardToei.test.tsx (the mockUseAtomValue function
and the tests around its usage) to include these scenarios.
- Around line 242-257: The duplicated branching mock for useAtomValue in
LineBoardToei.test.tsx should be extracted into a reusable helper (e.g.,
createUseAtomValueMock or getUseAtomValueMock) that returns the common defaults
and accepts an override for selectedLine; replace both inline mockImplementation
blocks with calls to this helper (pass selectedLine=null or your test-specific
value) so the navigationState and isEnAtom branches live in one place and
selectedLine is easily swapped per test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f2ddecdb-ffd4-46d3-a7ca-775ce43fbc70

📥 Commits

Reviewing files that changed from the base of the PR and between ca7875f and e9cee18.

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

@TinyKitten
TinyKitten merged commit 68f89d9 into dev Apr 6, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the claude/hide-disabled-languages-D10S9 branch April 6, 2026 02:07
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.

2 participants