[PR #1169] [MERGED] fix/avatar crop scaling #4954

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1169
Author: @ghost
Created: 5/24/2026
Status: ✅ Merged
Merged: 5/24/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/refactor-pr-55-avatar-crop-scaling


📝 Commits (1)

  • cd1240f Migrate Refactor PR #55: Fix avatar crop scaling

📊 Changes

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

View changed files

➕ src/features/catalog/characters/components/CharacterAvatarImage.tsx (+48 -0)
📝 src/features/catalog/characters/components/CharacterLibraryView.tsx (+7 -14)
📝 src/features/catalog/characters/components/CharactersPanel.tsx (+17 -13)

📄 Description

Migrated from Pasta-Devs/Marinara-Engine-Refactor#55: https://github.com/Pasta-Devs/Marinara-Engine-Refactor/pull/55
Original author: @Promansis
Target base: Pasta-Devs/Marinara-Engine refactor
Source draft state: True
Port note: source updates/tracker/evidence files were omitted because the target refactor branch removed repo-local updates guidance.


Linked issue

Fixes #1158

Original migrated source issue: Pasta-Devs/Marinara-Engine-Refactor#35.

Why this change

Character library avatars should follow one explicit crop display contract. The old library and panel paths could pass a persisted JSON-string avatarCrop directly into the crop style helper, which produced invalid crop sizing and could render squished full-image avatars instead of the stored crop.

What changed

  • Added a shared CharacterAvatarImage helper in the React character feature.
  • Swapped the character library detail/card avatars and Characters panel avatars to use the shared crop-aware image path.
  • Preserved the normal uncropped object-cover fallback for missing or invalid crop data.
  • Included group-member avatars in the Characters panel so nested member rows use the same crop contract.

Validation

  • pnpm check
  • pnpm build
  • cargo check --manifest-path src-tauri/Cargo.toml
  • pnpm check:docs when docs, skills, or repo guidance changed
  • Ran pnpm tauri dev and tested the app path manually
  • Verified the affected feature in the right mode(s): chat, roleplay, game, settings/providers, imports/exports, or assets

Codex verification notes

  • Vite + Playwright proof harness passed for the affected render path. It reproduced the old string-crop failure as 160x160 object-fit: fill, then verified the shared helper renders the same persisted string crop as 320x160 absolute crop geometry.
  • Edge case verified: invalid persisted crop string falls back to uncropped object-cover.
  • pnpm check passed locally: architecture, frontend typecheck, Rust cargo check, and docs check.
  • pnpm build passed locally. Vite reported existing chunk-size/dynamic-import warnings.
  • Marinara proof gate passed for scratch/bugfix-verification.json.
  • Bunny review pass: no code blockers after PR wording/evidence update.

Manual verification notes

No manual verification needed for the core claim. The local proof uses a Vite-served React harness importing the production CharacterAvatarImage helper because the browser-only dev app cannot list local Tauri storage rows without the Tauri runtime.

Docs impact

  • No docs changes needed
  • Updated docs/developer/* or repo guidance as needed

UI evidence

Avatar crop proof

Summary by CodeRabbit

  • Refactor
    • Consolidated character avatar rendering logic into a reusable component for improved code maintainability across character display views.

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/1169 **Author:** [@ghost](https://github.com/ghost) **Created:** 5/24/2026 **Status:** ✅ Merged **Merged:** 5/24/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/refactor-pr-55-avatar-crop-scaling` --- ### 📝 Commits (1) - [`cd1240f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/cd1240f364602c38fc9f348dcdc11ff22301ffe7) Migrate Refactor PR #55: Fix avatar crop scaling ### 📊 Changes **3 files changed** (+72 additions, -27 deletions) <details> <summary>View changed files</summary> ➕ `src/features/catalog/characters/components/CharacterAvatarImage.tsx` (+48 -0) 📝 `src/features/catalog/characters/components/CharacterLibraryView.tsx` (+7 -14) 📝 `src/features/catalog/characters/components/CharactersPanel.tsx` (+17 -13) </details> ### 📄 Description Migrated from Pasta-Devs/Marinara-Engine-Refactor#55: https://github.com/Pasta-Devs/Marinara-Engine-Refactor/pull/55 Original author: @Promansis Target base: Pasta-Devs/Marinara-Engine refactor Source draft state: True Port note: source updates/tracker/evidence files were omitted because the target refactor branch removed repo-local updates guidance. --- ## Linked issue Fixes #1158 Original migrated source issue: Pasta-Devs/Marinara-Engine-Refactor#35. ## Why this change Character library avatars should follow one explicit crop display contract. The old library and panel paths could pass a persisted JSON-string `avatarCrop` directly into the crop style helper, which produced invalid crop sizing and could render squished full-image avatars instead of the stored crop. ## What changed - Added a shared `CharacterAvatarImage` helper in the React character feature. - Swapped the character library detail/card avatars and Characters panel avatars to use the shared crop-aware image path. - Preserved the normal uncropped `object-cover` fallback for missing or invalid crop data. - Included group-member avatars in the Characters panel so nested member rows use the same crop contract. ## Validation - [ ] `pnpm check` - [ ] `pnpm build` - [ ] `cargo check --manifest-path src-tauri/Cargo.toml` - [ ] `pnpm check:docs` when docs, skills, or repo guidance changed - [ ] Ran `pnpm tauri dev` and tested the app path manually - [ ] Verified the affected feature in the right mode(s): chat, roleplay, game, settings/providers, imports/exports, or assets ### Codex verification notes - Vite + Playwright proof harness passed for the affected render path. It reproduced the old string-crop failure as 160x160 `object-fit: fill`, then verified the shared helper renders the same persisted string crop as 320x160 absolute crop geometry. - Edge case verified: invalid persisted crop string falls back to uncropped `object-cover`. - `pnpm check` passed locally: architecture, frontend typecheck, Rust cargo check, and docs check. - `pnpm build` passed locally. Vite reported existing chunk-size/dynamic-import warnings. - Marinara proof gate passed for `scratch/bugfix-verification.json`. - Bunny review pass: no code blockers after PR wording/evidence update. ### Manual verification notes No manual verification needed for the core claim. The local proof uses a Vite-served React harness importing the production `CharacterAvatarImage` helper because the browser-only dev app cannot list local Tauri storage rows without the Tauri runtime. ## Docs impact - [ ] No docs changes needed - [ ] Updated `docs/developer/*` or repo guidance as needed ## UI evidence ![Avatar crop proof](https://gist.githubusercontent.com/cha1latte/2c5a0792417e27e1d2bb88b159e051e5/raw/issue-1158-avatar-crop-proof.svg) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Consolidated character avatar rendering logic into a reusable component for improved code maintainability across character display views. <!-- 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/1169?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:59 +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#4954
No description provided.