[PR #928] [MERGED] fix(game): respect persona avatarCrop on all Game Mode portraits #4842

Closed
opened 2026-10-22 04:11:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/928
Author: @Romuromylus
Created: 5/16/2026
Status: ✅ Merged
Merged: 5/17/2026
Merged by: @Romuromylus

Base: staging ← Head: fix/game-persona-avatar-crop


📝 Commits (1)

  • 6ed1870 fix(game): respect persona avatarCrop on all Game Mode portraits

📊 Changes

3 files changed (+26 additions, -27 deletions)

View changed files

📝 packages/client/src/components/game/GameNarration.tsx (+1 -1)
📝 packages/client/src/components/game/GameSetupWizard.tsx (+23 -26)
📝 packages/client/src/components/game/GameSurface.tsx (+2 -0)

📄 Description

Linked issue

Closes #926

Why this change

  • The user persona portrait in Game Mode rendered with the uncropped source image everywhere it appeared (party bar, sidebar, player character sheet, inline dialogue portraits next to {{user}} lines, and the setup wizard's persona picker), ignoring the crop set in the persona's Avatar Crop widget.
  • Party-character portraits in the same surfaces respect their crop correctly, so the data plumbing works end-to-end for characters. The persona branches were just missed when avatar-crop propagation landed for chat surfaces in #665 / #669.
  • personaInfo.avatarCrop is already populated upstream at packages/client/src/components/chat/ChatArea.tsx via parseAvatarCropJson, and the PersonaInfo type already declares the field. Four Game Mode builders just don't read it.

What changed

  • packages/client/src/components/game/GameNarration.tsx — the persona's setAvatarInfo call inside speakerAvatarInfos now passes crop: personaInfo.avatarCrop, mirroring the character branch one line above.
  • packages/client/src/components/game/GameSurface.tsx — both the partyMembers persona branch and the partyCards player-persona-card branch now include avatarCrop: personaInfo.avatarCrop ?? null. Downstream consumers (GamePartyBar, GamePartySidebar, GameCharacterSheet) already read avatarCrop and call getAvatarCropStyle, so feeding the field through is sufficient.
  • packages/client/src/components/game/GameSetupWizard.tsx — extended the inline personas row type with avatarCrop?: string | null, imported parseAvatarCropJson, and routed the two persona render sites through the existing CharacterAvatar helper (which already handles getAvatarCropStyle) instead of raw <img> blocks.

No prompt, schema, server, or persisted-data changes — purely client-side render plumbing.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

What I verified on a fork build deployed to my private EasyPanel instance:

  • Picked a persona with a non-square portrait and a tight face crop in the Avatar Crop widget.
  • Started a Game Mode chat with that persona and confirmed the cropped region is shown in: the party portrait bar (top), the party sidebar, the player character sheet card, and the inline dialogue portraits next to my {{user}} lines.
  • Opened the Game Setup wizard and confirmed both the selected persona row and the persona list rows now render the crop instead of the full source.
  • Switched between Game Mode and Roleplay / Conversation in the same chat list to confirm chat-side portraits are still cropped correctly (unchanged path).
  • Confirmed character (non-persona) portraits in Game Mode still respect their crop (unchanged path).

Things I'd appreciate maintainers double-checking:

  • A persona that has the legacy zoom+offset crop shape — render-only compatibility goes through the same getAvatarCropStyle path, but worth a sanity check.
  • A persona with no avatarCrop set at all — should fall back to the uncropped circle exactly as before (the helpers all guard on null).
  • The Game Setup wizard persona list with a long list of personas, since the <img> blocks were replaced with the styled CharacterAvatar component — visual sizing should match (both used h-6 w-6 rounded-full).

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Version/release files updated (only if this PR includes a version bump)

Summary by CodeRabbit

Release Notes

  • Improvements
    • Persona avatars now display consistently with proper framing across the game setup, narration, and gameplay screens.

Review Change Stack


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/928 **Author:** [@Romuromylus](https://github.com/Romuromylus) **Created:** 5/16/2026 **Status:** ✅ Merged **Merged:** 5/17/2026 **Merged by:** [@Romuromylus](https://github.com/Romuromylus) **Base:** `staging` ← **Head:** `fix/game-persona-avatar-crop` --- ### 📝 Commits (1) - [`6ed1870`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6ed18708333d28483e2631780298e5b1649feff4) fix(game): respect persona avatarCrop on all Game Mode portraits ### 📊 Changes **3 files changed** (+26 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/game/GameNarration.tsx` (+1 -1) 📝 `packages/client/src/components/game/GameSetupWizard.tsx` (+23 -26) 📝 `packages/client/src/components/game/GameSurface.tsx` (+2 -0) </details> ### 📄 Description ## Linked issue Closes #926 ## Why this change - The user persona portrait in Game Mode rendered with the **uncropped** source image everywhere it appeared (party bar, sidebar, player character sheet, inline dialogue portraits next to `{{user}}` lines, and the setup wizard's persona picker), ignoring the crop set in the persona's Avatar Crop widget. - Party-character portraits in the same surfaces respect their crop correctly, so the data plumbing works end-to-end for characters. The persona branches were just missed when avatar-crop propagation landed for chat surfaces in #665 / #669. - `personaInfo.avatarCrop` is already populated upstream at [`packages/client/src/components/chat/ChatArea.tsx`](https://github.com/Pasta-Devs/Marinara-Engine/blob/staging/packages/client/src/components/chat/ChatArea.tsx) via `parseAvatarCropJson`, and the `PersonaInfo` type already declares the field. Four Game Mode builders just don't read it. ## What changed - `packages/client/src/components/game/GameNarration.tsx` — the persona's `setAvatarInfo` call inside `speakerAvatarInfos` now passes `crop: personaInfo.avatarCrop`, mirroring the character branch one line above. - `packages/client/src/components/game/GameSurface.tsx` — both the `partyMembers` persona branch and the `partyCards` player-persona-card branch now include `avatarCrop: personaInfo.avatarCrop ?? null`. Downstream consumers (`GamePartyBar`, `GamePartySidebar`, `GameCharacterSheet`) already read `avatarCrop` and call `getAvatarCropStyle`, so feeding the field through is sufficient. - `packages/client/src/components/game/GameSetupWizard.tsx` — extended the inline `personas` row type with `avatarCrop?: string | null`, imported `parseAvatarCropJson`, and routed the two persona render sites through the existing `CharacterAvatar` helper (which already handles `getAvatarCropStyle`) instead of raw `<img>` blocks. No prompt, schema, server, or persisted-data changes — purely client-side render plumbing. ## Validation - [x] `pnpm check` passes locally - [x] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [x] Above manual verification completed (describe below) - [x] Read and followed `CONTRIBUTING.md` ### Manual verification notes What I verified on a fork build deployed to my private EasyPanel instance: - Picked a persona with a non-square portrait and a tight face crop in the Avatar Crop widget. - Started a Game Mode chat with that persona and confirmed the cropped region is shown in: the party portrait bar (top), the party sidebar, the player character sheet card, and the inline dialogue portraits next to my `{{user}}` lines. - Opened the Game Setup wizard and confirmed both the selected persona row and the persona list rows now render the crop instead of the full source. - Switched between Game Mode and Roleplay / Conversation in the same chat list to confirm chat-side portraits are still cropped correctly (unchanged path). - Confirmed character (non-persona) portraits in Game Mode still respect their crop (unchanged path). Things I'd appreciate maintainers double-checking: - A persona that has the legacy zoom+offset crop shape — render-only compatibility goes through the same `getAvatarCropStyle` path, but worth a sanity check. - A persona with no `avatarCrop` set at all — should fall back to the uncropped circle exactly as before (the helpers all guard on `null`). - The Game Setup wizard persona list with a long list of personas, since the `<img>` blocks were replaced with the styled `CharacterAvatar` component — visual sizing should match (both used `h-6 w-6 rounded-full`). ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Version/release files updated (only if this PR includes a version bump) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **Improvements** * Persona avatars now display consistently with proper framing across the game setup, narration, and gameplay screens. <!-- review_stack_entry_start --> [![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/Pasta-Devs/Marinara-Engine/pull/928?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:11:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4842
No description provided.