Skip to content

設定画面のオーバーレイとモデル読み込み表示を改善#562

Merged
tegnike merged 5 commits into
developfrom
codex/settings-modal-overlay-close
Jul 5, 2026
Merged

設定画面のオーバーレイとモデル読み込み表示を改善#562
tegnike merged 5 commits into
developfrom
codex/settings-modal-overlay-close

Conversation

@tegnike

@tegnike tegnike commented Jul 4, 2026

Copy link
Copy Markdown
Owner

概要

  • 設定画面の背景を半透明の白いオーバーレイに変更
  • 設定画面外クリックで設定画面を閉じられるように変更
  • VRM / Live2D / PNGTuber のモデル読み込み中に共通スピナーを表示
  • スピナーは既存UIに合わせた控えめな mono ring 表示に調整

検証

  • npm exec prettier -- --check src/components/settings/index.tsx src/styles/globals.css
  • npm exec prettier -- --write src/components/modelLoadingOverlay.tsx src/components/Live2DComponent.tsx src/components/PNGTuberComponent.tsx src/components/live2DViewer.tsx src/components/pngTuberViewer.tsx src/components/vrmViewer.tsx src/features/vrmViewer/viewer.ts
  • npm exec eslint -- src/components/settings/index.tsx
  • npm exec eslint -- src/components/modelLoadingOverlay.tsx
  • npm exec eslint -- src/components/modelLoadingOverlay.tsx src/components/Live2DComponent.tsx src/components/PNGTuberComponent.tsx src/components/live2DViewer.tsx src/components/pngTuberViewer.tsx src/components/vrmViewer.tsx src/features/vrmViewer/viewer.ts
  • npm run build
  • http://localhost:3000 で設定画面外クリックの動作と実行時エラーなしを確認

備考

  • 既存の React Hooks / Next.js lint 警告は残っていますが、今回の変更起因のエラーはありません。

Summary by CodeRabbit

  • 新機能
    • モデル読み込み中に共通のローディングオーバーレイ(ModelLoadingOverlay)を表示するよう改善しました(Live2D / PNGTuber / VRM)。
  • バグ修正
    • 複数回の読み込みが競合した際のちらつきや、古い完了によるローディング解除の誤切替を抑制しました。
    • 設定画面の背面クリック挙動を調整し、意図しない閉じ方をしにくくしました。
    • 話者リスト更新エラー文言を状況に応じて明確化しました。
  • スタイル
    • 設定画面の背面背景を半透明・ぼかし付きに調整しました。
  • Tests
    • 話者更新系のテストを拡充しました。

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

共通の ModelLoadingOverlay を追加して複数のビューアの読込中表示を置き換えました。Live2D と VRM には読込状態通知と競合制御を加え、Settings のバックドロップ挙動と話者更新のエラー表示・API 検証も更新しています。

Changes

モデル読込オーバーレイと関連修正

Layer / File(s) Summary
ModelLoadingOverlay の新規実装
src/components/modelLoadingOverlay.tsx
読込中表示用の共通オーバーレイを新規追加し、role="status" とスピナーを備えた構造を定義。
Live2D と PNGTuber の読込中表示更新
src/components/Live2DComponent.tsx, src/components/live2DViewer.tsx, src/components/PNGTuberComponent.tsx, src/components/pngTuberViewer.tsx
Live2D の最新読込リクエスト管理と表示制御を追加し、PNGTuber 各所の読込中 UI を ModelLoadingOverlay に置き換え。
VRM 読込通知とオーバーレイ表示
src/features/vrmViewer/viewer.ts, src/components/vrmViewer.tsx
loadVrm に読込状態通知と競合防止を加え、ビューア側で isModelLoading を受けてオーバーレイを表示。
Settings のバックドロップと背景スタイル更新
src/components/settings/index.tsx, src/styles/globals.css
バックドロップクリックの判定を変更し、theme-settings-backdrop の背景色とブラーを更新。

話者更新エラー処理と Aivis API 検証

Layer / File(s) Summary
話者更新エラー表示の共通化
src/components/settings/voice.tsx
VOICEVOX と AIVIS の話者更新失敗時に、レスポンスの errorCode に応じたメッセージを表示するよう変更。
AivisSpeech と VOICEVOX の API 検証強化
src/pages/api/update-aivis-speakers.ts, src/pages/api/update-voicevox-speakers.ts, src/__tests__/pages/api/update-aivis-speakers.test.ts, src/__tests__/pages/api/update-voicevox-speakers.test.ts, src/__tests__/components/voice.test.tsx
両 API のレスポンス検証を追加し、関連テストで失敗時の 500 応答、書き込み抑止、UI の案内文表示を確認。

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

Possibly related PRs

  • tegnike/aituber-kit#228: src/components/settings/voice.tsxsrc/pages/api/update-aivis-speakers.ts の同じ話者更新フローを扱っており、今回のエラー処理と API 検証の変更と直接つながるため。
  • tegnike/aituber-kit#540: src/pages/api/update-aivis-speakers.ts / src/pages/api/update-voicevox-speakers.ts と関連テストを扱っており、今回のレスポンス検証追加と同じ領域に手が入っています。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 設定画面のオーバーレイ改善とモデル読み込み表示の共通化という主要変更を正しく要約しています。
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 codex/settings-modal-overlay-close

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/components/modelLoadingOverlay.tsx (1)

9-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

aria-label の言語がアプリの他の文言と不整合。

aria-label="Loading model" が英語のままですが、アプリ内の他の読み込み表示(例: PNGTuberComponent の旧「読み込み中...」)は日本語です。日本語スクリーンリーダー利用者向けに一貫性を持たせるべきです。

♻️ 修正例
-      aria-label="Loading model"
+      aria-label="モデルを読み込み中"
🤖 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/modelLoadingOverlay.tsx` around lines 9 - 13,
`ModelLoadingOverlay` の `aria-label`
が英語のままなので、アプリ内の他の読み込み文言と合わせて日本語に統一してください。`src/components/modelLoadingOverlay.tsx`
の `Loading model` を、スクリーンリーダー向けに自然な日本語の読み込み表示へ置き換え、`role="status"`
と併せて一貫したアクセシブルな文言になるよう修正してください。
🤖 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.

Inline comments:
In `@src/features/vrmViewer/viewer.ts`:
- Around line 67-69: In the async load callback inside viewer.ts, the early
return path after checking this.model !== model should not discard an
already-loaded VRM without cleanup. Update the logic around the Promise.then
handler in the viewer model loading flow so that, before returning for a stale
model, the current model’s loaded VRM is released via model.unLoadVrm(); keep
the existing guard with this.model and model.vrm, but ensure outdated loads are
explicitly disposed first.

In `@src/styles/globals.css`:
- Around line 129-133: The .theme-settings-backdrop style is using a hardcoded
white rgba background, so update this selector to use a CSS variable instead of
a fixed color. Define a theme-aware variable such as --settings-backdrop-bg in
the root and dark theme selectors, then reference it from
.theme-settings-backdrop so the backdrop adapts correctly for light and dark
modes. Keep the existing blur settings and adjust only the background color
source.

---

Nitpick comments:
In `@src/components/modelLoadingOverlay.tsx`:
- Around line 9-13: `ModelLoadingOverlay` の `aria-label`
が英語のままなので、アプリ内の他の読み込み文言と合わせて日本語に統一してください。`src/components/modelLoadingOverlay.tsx`
の `Loading model` を、スクリーンリーダー向けに自然な日本語の読み込み表示へ置き換え、`role="status"`
と併せて一貫したアクセシブルな文言になるよう修正してください。
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d29690b3-ee6c-4904-b458-48d214d020c7

📥 Commits

Reviewing files that changed from the base of the PR and between 31984f2 and a6b834c.

📒 Files selected for processing (9)
  • src/components/Live2DComponent.tsx
  • src/components/PNGTuberComponent.tsx
  • src/components/live2DViewer.tsx
  • src/components/modelLoadingOverlay.tsx
  • src/components/pngTuberViewer.tsx
  • src/components/settings/index.tsx
  • src/components/vrmViewer.tsx
  • src/features/vrmViewer/viewer.ts
  • src/styles/globals.css

Comment thread src/features/vrmViewer/viewer.ts
Comment thread src/styles/globals.css

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/pages/api/update-aivis-speakers.ts`:
- Around line 63-73: Add the same response-shape guard in the VoiceVox speakers
update flow as in the AivisSpeech handler: after the `response.ok` check in
`update-voicevox-speakers.ts`, validate that the parsed `speakers` value is an
array with `Array.isArray(speakers)` before any `flatMap` usage. If it is not an
array, throw a clear error like the one used in the `update-aivis-speakers` path
so the API fails fast on invalid upstream responses.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2e8f73f2-11f7-48e6-9137-b765a5899ab7

📥 Commits

Reviewing files that changed from the base of the PR and between dab29b0 and 5bbb3b0.

📒 Files selected for processing (4)
  • src/__tests__/components/voice.test.tsx
  • src/__tests__/pages/api/update-aivis-speakers.test.ts
  • src/components/settings/voice.tsx
  • src/pages/api/update-aivis-speakers.ts

Comment thread src/pages/api/update-aivis-speakers.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/pages/api/update-voicevox-speakers.ts (1)

70-81: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

配列チェックに加えて個々の要素の形状検証も検討してください。

speakers が配列であることは検証していますが、各要素の styles が配列であるかは未検証です。styles が欠落・不正な場合は flatMap 内で TypeError が発生し、catch ブロックで捕捉されて 500 になりますが、エラーメッセージが実際の原因を反映しません。

♻️ 個々の要素検証を追加する例
     const speakers: Speaker[] = await response.json()
     if (!Array.isArray(speakers)) {
       throw new Error('VOICEVOX speakers response must be an array')
     }
+    if (speakers.some((speaker) => !Array.isArray(speaker?.styles))) {
+      throw new Error('VOICEVOX speaker styles must be an array')
+    }
🤖 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/pages/api/update-voicevox-speakers.ts` around lines 70 - 81, The VOICEVOX
speaker normalization in update-voicevox-speakers should validate each Speaker
item’s shape, not just the top-level array. Update the speakers.flatMap
transformation to check that speaker.styles is an array before iterating, and
throw a descriptive error when a speaker entry is missing or has invalid styles
so the catch path reports the real cause instead of a generic TypeError. Use the
Speaker and VoicevoxSpeaker handling in update-voicevox-speakers as the place to
add this per-item validation.
🤖 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/pages/api/update-voicevox-speakers.ts`:
- Around line 70-81: The VOICEVOX speaker normalization in
update-voicevox-speakers should validate each Speaker item’s shape, not just the
top-level array. Update the speakers.flatMap transformation to check that
speaker.styles is an array before iterating, and throw a descriptive error when
a speaker entry is missing or has invalid styles so the catch path reports the
real cause instead of a generic TypeError. Use the Speaker and VoicevoxSpeaker
handling in update-voicevox-speakers as the place to add this per-item
validation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8d7d648d-feec-49f8-b69e-ac8f4c27a122

📥 Commits

Reviewing files that changed from the base of the PR and between 5bbb3b0 and b6bc03a.

📒 Files selected for processing (2)
  • src/__tests__/pages/api/update-voicevox-speakers.test.ts
  • src/pages/api/update-voicevox-speakers.ts

@tegnike tegnike merged commit bbe1098 into develop Jul 5, 2026
8 checks passed
@tegnike tegnike deleted the codex/settings-modal-overlay-close branch July 5, 2026 12:53
@coderabbitai coderabbitai Bot mentioned this pull request Jul 5, 2026
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