diff --git a/TODO b/TODO index 677606556c..ea479f2304 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ -have the players’ contracts on the Compare Players screen https://old.reddit.com/r/BasketballGM/comments/1ggtvkv/monthly_suggestions_thread/luz5409/ +make player graphs remember selections https://old.reddit.com/r/BasketballGM/comments/1gplx7g/could_you_make_the_player_graphs_remember_what/ +- other pages? FBGM - declines penalty when it would have given untimed down in 4th quarter with a chance to win https://discord.com/channels/290013534023057409/290015591216054273/1313017959035179008 @@ -303,8 +304,6 @@ compare players http://www.reddit.com/r/BasketballGM/comments/1saclf/suggestion_ - needs to know pid/playoffs/season for each row, could put in metadata - replace existing links, such as award races - could implement as "compare highlighted players", would also need a "clear highlight", idk -- for current players, show contract and team, if current year or career is selected? https://old.reddit.com/r/BasketballGM/comments/1bdi7eg/version_202403130000_new_compare_players_feature/kun5sce/?context=3 - - handle free agent contracts jersey numbers by position and frequency - football - classic numbers more popular diff --git a/src/ui/views/ComparePlayers/index.tsx b/src/ui/views/ComparePlayers/index.tsx index 2435f90da1..a958641161 100644 --- a/src/ui/views/ComparePlayers/index.tsx +++ b/src/ui/views/ComparePlayers/index.tsx @@ -9,6 +9,7 @@ import { groupByUnique } from "../../../common/utils"; import PlayersForm from "./PlayersForm"; import CollapseArrow from "../../components/CollapseArrow"; import { lowerIsBetter } from "../../../common/lowerIsBetter"; +import { Contract, ContractAmount } from "../../components/contract"; type PlayerInfo = View<"comparePlayers">["players"][number]; type PlayerInfoAndLegend = @@ -211,6 +212,7 @@ const useManualSticky = (element: HTMLElement | null, top: number) => { const ComparePlayers = ({ challengeNoRatings, + currentSeason, initialAvailablePlayers, players, ratings, @@ -292,6 +294,41 @@ const ComparePlayers = ({ /> ); + const contractValues = playersToValues(playersAndLegend, (p, i) => { + const season = playersAndLegend[i].season; + + if ( + p.tid === PLAYER.UNDRAFTED || + (typeof season === "number" && season <= p.draft.year) || + (season === "career" && p.salariesTotal === 0) + ) { + return null; + } + + if (season === "career") { + return ; + } + + if (season !== currentSeason) { + return ; + } + + if (p.tid === PLAYER.FREE_AGENT) { + return ( + <> + (FA) + + ); + } + + return ; + }); + + // Only show contract if there is a non-null value for some player + const showContracts = contractValues.some( + value => value !== null && value !== "legend", + ); + return ( <> {playersForm} @@ -378,6 +415,12 @@ const ComparePlayers = ({ sortType="draftPick" sortAsc /> + {showContracts ? ( + + ) : null} ) : null} {challengeNoRatings && diff --git a/src/worker/views/comparePlayers.ts b/src/worker/views/comparePlayers.ts index c7f476ff69..5b2cafef06 100644 --- a/src/worker/views/comparePlayers.ts +++ b/src/worker/views/comparePlayers.ts @@ -366,6 +366,9 @@ const updateComparePlayers = async ( "tid", "experience", "awards", + "contract", + "salaries", + "salariesTotal", ], ratings: ["season", "pos", "ovr", "pot", ...RATINGS], stats: allStats, @@ -429,6 +432,7 @@ const updateComparePlayers = async ( return { challengeNoRatings: g.get("challengeNoRatings"), + currentSeason: g.get("season"), initialAvailablePlayers, players, ratings,