fix: resolve #407 — Export player as a trading card image#509
Open
SlncTrZ wants to merge 4 commits into
Open
Conversation
Fixes zengm-games#407 Signed-off-by: Dinh Truong (SlncTrZ) <46520299+SlncTrZ@users.noreply.github.com>
Fixes zengm-games#407 Signed-off-by: Dinh Truong (SlncTrZ) <46520299+SlncTrZ@users.noreply.github.com>
Fixes zengm-games#407 Signed-off-by: Dinh Truong (SlncTrZ) <46520299+SlncTrZ@users.noreply.github.com>
Fixes zengm-games#407 Signed-off-by: Dinh Truong (SlncTrZ) <46520299+SlncTrZ@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fix: resolve #407 — Export player as a trading card image
Problem
Severity:
High| File:src/components/TradingCard.tsxAdds a new React component that renders a compact "trading card" style summary of a player’s key stats, awards, and basic info. This component will be used to generate the downloadable image. It accepts a player object and optional styling flags (e.g., theme, sport type) to adapt the design for Basketball GM, Football GM, etc.
Solution
Implement as a functional component using inline styles or CSS modules for consistent printing/capture. Include: player name, team, jersey number, position, overall/potential ratings, key season/career stats (points, rebounds, assists, etc. – sport‑dependent), notable awards (MVP, championships, all‑star selections), and a subtle background graphic. Use a fixed width (e.g., 400px) and auto height. Provide a
classNameordata‑html2canvas‑ignorefor elements that should not be captured. Add a ref to allow parent component to measure and capture.Changes
src/components/TradingCard.tsx(new)src/components/TradingCard.module.css(new)src/utils/exportImage.ts(new)package.json(modified)Testing