Skip to content

Commit

Permalink
Finish
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmatter committed Feb 2, 2025
1 parent 5cb2526 commit 8641077
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 29 deletions.
8 changes: 0 additions & 8 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ apply checkbox td hack to buttons too
- should correctly handle hover state
- bootstrap utility?

season range highlighting like sports-reference on click highlight
- remove artificial delay
- test
- baseball fielding stats, or disable
- if current season is selected, should update while simming
- blog
- advantages of this: discoverable, no weird floating window, no confusing way to change a range after initial selection

show career totals per team at bottom of stats tables in player profile pages
- add some extra option to playersPlus like careerStatsPerTeam

Expand Down
37 changes: 20 additions & 17 deletions src/ui/views/Player/StatsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,27 @@ export const StatsTable = ({
cols.at(-1)!.title = "%";
}

const isBaseballFielding = isSport("baseball") && name === "Fielding";

let footer: FooterRow[];
if (isSport("baseball") && name === "Fielding") {
if (isBaseballFielding) {
playerStats = expandFieldingStats({
rows: playerStats,
stats,
});

footer = [
{
data: expandFieldingStats({
rows: [careerStats],
stats,
addDummyPosIndex: true,
}).map((object, i) => [
i === 0 ? "Career" : null,
null,
null,
...stats.map((stat) => formatStatGameHigh(object, stat)),
]),
},
];
footer = expandFieldingStats({
rows: [careerStats],
stats,
addDummyPosIndex: true,
}).map((object, i) => ({
data: [
i === 0 ? "Career" : null,
null,
null,
...stats.map((stat) => formatStatGameHigh(object, stat)),
],
}));
} else {
footer = [
{
Expand Down Expand Up @@ -307,13 +307,16 @@ export const StatsTable = ({
});
}

const showSelectSeasonRangeButton =
rangeFooter.state.type === "closed" && !isBaseballFielding;

return (
<HideableSection
title={name}
description={hasLeader ? highlightLeaderText : null}
>
<DataTable
classNameWrapper={rangeFooter.state.type === "closed" ? "mb-2" : "mb-3"}
classNameWrapper={showSelectSeasonRangeButton ? "mb-2" : "mb-3"}
cols={cols}
defaultSort={[0, "asc"]}
defaultStickyCols={2}
Expand Down Expand Up @@ -372,7 +375,7 @@ export const StatsTable = ({
</ul>
}
/>
{rangeFooter.state.type === "closed" ? (
{showSelectSeasonRangeButton ? (
<button
className="btn btn-sm btn-secondary mb-3"
onClick={rangeFooter.onOpen}
Expand Down
4 changes: 0 additions & 4 deletions src/worker/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1795,10 +1795,6 @@ const getPlayerRangeFooterStats = async ({
pid: number;
seasonRange: [number, number];
}) => {
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});

const pRaw = await idb.getCopy.players(
{
pid,
Expand Down

0 comments on commit 8641077

Please sign in to comment.