[PR #1186] [MERGED] Extract tracker card color manager logic #4964

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1186
Author: @Xelvanis
Created: 5/25/2026
Status: ✅ Merged
Merged: 5/25/2026
Merged by: @Xelvanis

Base: refactor ← Head: chore/tracker-card-color-manager


📝 Commits (2)

  • 0ffc44e Extract tracker card color logic into testable hook
  • f369de8 Add non-target tracker color cache assertions

📊 Changes

4 files changed (+762 additions, -516 deletions)

View changed files

📝 src/features/shell/settings/components/settings/TrackerCardColorSettings.tsx (+15 -516)
➕ src/features/shell/settings/hooks/tracker-card-color-manager.test.ts (+164 -0)
➕ src/features/shell/settings/hooks/tracker-card-color-manager.ts (+289 -0)
➕ src/features/shell/settings/hooks/use-tracker-card-color-manager.ts (+294 -0)

📄 Description

Summary

  • Extract tracker card color target resolution, preview cache updates, and save/revert state handling out of TrackerCardColorSettings.
  • Keep the settings component focused on rendering while the new hook owns data loading, dirty state, preview restore, and persistence.
  • Add focused Vitest coverage for persona/character cache patching and target resolution.

Linked Issue

No linked issue.

Changelog

Not needed: internal refactor/test coverage only; no release-notable behavior change.

Validation

  • pnpm vitest run src/features/shell/settings/hooks/tracker-card-color-manager.test.ts
  • pnpm typecheck
  • pnpm check:architecture
  • pnpm build
  • pnpm test

Native QA

Tauri app pass completed against the tracker card color settings flow:

  • Dirty preview enabled Save/Revert and disabled target switching.
  • Revert restored the saved custom persona config.
  • Save completed successfully.
  • Switching away from Appearance restored an unsaved preview when returning.

Remaining Risk

Character-target save was covered by focused cache tests, but not manually exercised in native Tauri during the app pass.

Summary by CodeRabbit

  • Refactor

    • Restructured tracker card color settings management for improved maintainability and state handling.
  • Tests

    • Added comprehensive test coverage for tracker card color configuration handling and target resolution.

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/1186 **Author:** [@Xelvanis](https://github.com/Xelvanis) **Created:** 5/25/2026 **Status:** ✅ Merged **Merged:** 5/25/2026 **Merged by:** [@Xelvanis](https://github.com/Xelvanis) **Base:** `refactor` ← **Head:** `chore/tracker-card-color-manager` --- ### 📝 Commits (2) - [`0ffc44e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0ffc44e2e41bb3be5a6063e90c56adc6d3df3b26) Extract tracker card color logic into testable hook - [`f369de8`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f369de851122c9f2eed513895494c1b964e9e789) Add non-target tracker color cache assertions ### 📊 Changes **4 files changed** (+762 additions, -516 deletions) <details> <summary>View changed files</summary> 📝 `src/features/shell/settings/components/settings/TrackerCardColorSettings.tsx` (+15 -516) ➕ `src/features/shell/settings/hooks/tracker-card-color-manager.test.ts` (+164 -0) ➕ `src/features/shell/settings/hooks/tracker-card-color-manager.ts` (+289 -0) ➕ `src/features/shell/settings/hooks/use-tracker-card-color-manager.ts` (+294 -0) </details> ### 📄 Description ## Summary - Extract tracker card color target resolution, preview cache updates, and save/revert state handling out of `TrackerCardColorSettings`. - Keep the settings component focused on rendering while the new hook owns data loading, dirty state, preview restore, and persistence. - Add focused Vitest coverage for persona/character cache patching and target resolution. ## Linked Issue No linked issue. ## Changelog Not needed: internal refactor/test coverage only; no release-notable behavior change. ## Validation - `pnpm vitest run src/features/shell/settings/hooks/tracker-card-color-manager.test.ts` - `pnpm typecheck` - `pnpm check:architecture` - `pnpm build` - `pnpm test` ## Native QA Tauri app pass completed against the tracker card color settings flow: - Dirty preview enabled Save/Revert and disabled target switching. - Revert restored the saved custom persona config. - Save completed successfully. - Switching away from Appearance restored an unsaved preview when returning. ## Remaining Risk Character-target save was covered by focused cache tests, but not manually exercised in native Tauri during the app pass. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Restructured tracker card color settings management for improved maintainability and state handling. * **Tests** * Added comprehensive test coverage for tracker card color configuration handling and target resolution. <!-- 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/1186?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:12:05 +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#4964
No description provided.