Skip to content

テーマ確認モーダルのレイアウトを改善 - #6549

Merged
TinyKitten merged 2 commits into
devfrom
fix/theme-confirm-modal-layout
Aug 5, 2026
Merged

TinyKitten merged 2 commits into
devfrom
fix/theme-confirm-modal-layout

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

概要

テーマ確認モーダルのコンテンツ順とタブレット表示領域、要素間隔を調整し、アクションボタンが見切れず読みやすいレイアウトにします。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • テーマタイトルの位置を維持したまま、プレビュー画像を説明文より前に表示
  • 説明文とアクションボタンの間隔を 24 に拡張
  • タブレットで CustomModal の最大高さを 75% から 90% に拡張
  • スマートフォンの最大高さは 75% のまま維持
  • 端末別の高さ、テーマ確認モーダルの表示順、説明文の余白を検証する回帰テストを追加
  • 共通モーダルのタブレット表示に影響するため、スマートフォン用テストと Android タブレット実機確認で回帰リスクを軽減

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

実行結果:

  • npm run lint: 成功
  • npm test -- --runInBand: 205 suites / 2182 tests 成功
  • npm run typecheck: 成功
  • push 前の関連テスト: 3 suites / 9 tests 成功

関連Issue

なし

スクリーンショット(任意)

  • Android タブレット T12_ROW(ランドスケープ)で説明文とボタンの間隔、および「キャンセル」「適用」ボタンが完全に表示されることを確認

Summary by CodeRabbit

  • 改善
    • タブレットで表示するモーダルの最大高さを90%に拡大し、より多くの内容を確認しやすくしました。
    • スマートフォンでは従来どおり最大高さ75%で表示されます。
    • テーマ確認モーダルのレイアウトを調整し、テーマ説明文をプレビュー画像の直後に配置しました。
    • テーマ説明文の下部余白を拡大し、各要素の間隔をより見やすくしました。

@TinyKitten TinyKitten self-assigned this Aug 5, 2026
@github-actions github-actions Bot added the react label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

CustomModalのタブレット時の最大高さを90%に変更しました。スマートフォン時は75%を維持します。ThemeConfirmModalでは、テーマ説明をプレビュー画像の後に移動し、下余白を24に変更しました。各変更をテストで検証します。

Changes

CustomModalのレスポンシブ表示

Layer / File(s) Summary
端末別のモーダルサイズ設定
src/components/CustomModal.tsx, src/components/CustomModal.test.tsx, src/components/CustomModal.tablet.test.tsx
タブレット時の最大高さを90%に変更しました。非タブレット時は75%を維持します。最大幅と最大高さをテストで検証します。

ThemeConfirmModalの説明配置

Layer / File(s) Summary
テーマ説明の表示順序と余白
src/components/ThemeConfirmModal.tsx, src/components/ThemeConfirmModal.test.tsx
テーマ説明をプレビュー画像の直後に移動し、marginBottomを24に変更しました。タイトル、プレビュー画像、説明文の順序をテストで検証します。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

うさぎが画面をぴょんと見て
タブレットの高さは九十へ
説明文は画像のあと
余白は二十四、整列
モーダル表示が軽やかに跳ねる

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed タイトルはテーマ確認モーダルのレイアウト改善を示し、変更内容の主要部分を簡潔に表しています。
Description check ✅ Passed 概要、変更内容、テスト結果、関連Issue、実機確認を含み、テンプレートの必須項目を十分に満たしています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 fix/theme-confirm-modal-layout

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

@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor
Action performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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 (4)
src/components/CustomModal.tablet.test.tsx (1)

6-18: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

各テスト後にモックの呼び出し履歴をクリアしてください。

このファイルは jest.mock でモックを登録していますが、afterEach がありません。同一ファイルにテストを追加すると、モックの呼び出し履歴が後続テストへ残る可能性があります。

 jest.mock('~/utils/isTablet', () => ({
   __esModule: true,
   default: true,
 }));
 
+afterEach(() => {
+  jest.clearAllMocks();
+});

As per coding guidelines, テストファイルでは afterEach 内で jest.clearAllMocks() を呼び出してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/CustomModal.tablet.test.tsx` around lines 6 - 18, Add an
afterEach hook to the CustomModal tablet test file that calls
jest.clearAllMocks(), ensuring mock call history from the jotai, Portal, and
isTablet mocks is reset after every test.

Source: Coding guidelines

src/components/CustomModal.test.tsx (1)

54-68: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

スマートフォン分岐をテスト内で固定してください。

CustomModal.tsx は isTablet によって maxHeight を選択します。このテストは ~/utils/isTablet を false に固定していません。Jest の setup または実行環境が true を返す場合、スマートフォン分岐を保証できません。既存の setup で false が保証されていることを確認し、保証がなければ default: false のモックを追加してください。

As per coding guidelines, テストを単体で再現可能に実行できるよう、端末種別をテスト内で固定してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/CustomModal.test.tsx` around lines 54 - 68, In the CustomModal
test covering the 75% maxHeight behavior, explicitly fix the ~/utils/isTablet
mock to return false so the smartphone branch is deterministic. Reuse the
existing Jest setup or add a default false mock if no such guarantee exists,
while preserving the current assertions.

Source: Coding guidelines

src/components/ThemeConfirmModal.test.tsx (2)

26-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

THEME_PREFERENCE.AUTO の回帰ケースを追加してください。

このテストは THEME_PREFERENCE.TOKYO_METRO の通常テーマだけを検証しています。ThemeConfirmModal.tsx には translate('themeDescriptionAuto') を使う isAuto 分岐があります。AUTO の説明文がプレビュー後に表示され、marginBottom が24になることも確認してください。

As per coding guidelines, 挙動を変更した場合は同じ変更セットで対象経路のテストを更新または追加してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ThemeConfirmModal.test.tsx` around lines 26 - 49, Extend the
ThemeConfirmModal test coverage with a THEME_PREFERENCE.AUTO case using the
isAuto rendering path; verify the themeDescriptionAuto text appears after the
preview Image and has a marginBottom of 24, while preserving the existing Tokyo
Metro assertions.

Source: Coding guidelines


8-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

テスト間のモック状態をリセットしてください。

useAtomValue と各コールバックを Jest モックで定義しています。テストを追加すると、モックの呼び出し履歴が次のテストへ残ります。describe の直後に cleanup を追加してください。

修正例
 describe('ThemeConfirmModal', () => {
+  afterEach(() => {
+    jest.clearAllMocks();
+  });
+
   it('タイトルの位置を保ち、プレビュー画像を説明文より先に表示する', () => {

As per coding guidelines, テストファイルでは各テスト後に afterEach で jest.clearAllMocks() を呼び出してください。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ThemeConfirmModal.test.tsx` around lines 8 - 25, テスト間に Jest
モックの呼び出し履歴が残らないよう、ThemeConfirmModal の describe ブロック直後に afterEach を追加し、各テスト後に
jest.clearAllMocks() を実行してください。既存のモック実装やテスト内容は変更しないでください。

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/CustomModal.tablet.test.tsx`:
- Around line 6-18: Add an afterEach hook to the CustomModal tablet test file
that calls jest.clearAllMocks(), ensuring mock call history from the jotai,
Portal, and isTablet mocks is reset after every test.

In `@src/components/CustomModal.test.tsx`:
- Around line 54-68: In the CustomModal test covering the 75% maxHeight
behavior, explicitly fix the ~/utils/isTablet mock to return false so the
smartphone branch is deterministic. Reuse the existing Jest setup or add a
default false mock if no such guarantee exists, while preserving the current
assertions.

In `@src/components/ThemeConfirmModal.test.tsx`:
- Around line 26-49: Extend the ThemeConfirmModal test coverage with a
THEME_PREFERENCE.AUTO case using the isAuto rendering path; verify the
themeDescriptionAuto text appears after the preview Image and has a marginBottom
of 24, while preserving the existing Tokyo Metro assertions.
- Around line 8-25: テスト間に Jest モックの呼び出し履歴が残らないよう、ThemeConfirmModal の describe
ブロック直後に afterEach を追加し、各テスト後に jest.clearAllMocks()
を実行してください。既存のモック実装やテスト内容は変更しないでください。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 47cecc75-92da-4803-976a-cf15c8bd70be

📥 Commits

Reviewing files that changed from the base of the PR and between d4156b4 and 061cd68.

📒 Files selected for processing (5)
  • src/components/CustomModal.tablet.test.tsx
  • src/components/CustomModal.test.tsx
  • src/components/CustomModal.tsx
  • src/components/ThemeConfirmModal.test.tsx
  • src/components/ThemeConfirmModal.tsx

@TinyKitten
TinyKitten merged commit 8e303a4 into dev Aug 5, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the fix/theme-confirm-modal-layout branch August 5, 2026 13:32
@TinyKitten TinyKitten mentioned this pull request Aug 8, 2026
5 of 9 tasks
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