- {categories.map(cat => {
- const cols = getCols(["#", "Name", `stat:${cat.stat}`]);
- const statCol = cols[2];
- if (cat.titleOverride === statCol.desc) {
- throw new Error("Useless titleOverride");
- }
+ {noQualifiedLeaders ? (
+
No data yet.
+ {categories.map(cat => {
+ const cols = getCols(["#", "Name", `stat:${cat.stat}`]);
+ const statCol = cols[2];
+ if (cat.titleOverride === statCol.desc) {
+ throw new Error("Useless titleOverride");
+ }
- const title = cat.titleOverride ?? statCol.desc ?? "???";
- const desc = cat.titleOverride ? statCol.desc : undefined;
+ const title = cat.titleOverride ?? statCol.desc ?? "???";
+ const desc = cat.titleOverride ? statCol.desc : undefined;
- const rows: DataTableRow[] = cat.leaders.map((p, j) => {
- const numericSeason =
- season === "career"
- ? undefined
- : season === "all"
- ? p.season
- : season;
+ const rows: DataTableRow[] = cat.leaders.map((p, j) => {
+ const numericSeason =
+ season === "career"
+ ? undefined
+ : season === "all"
+ ? p.season
+ : season;
- let teamUrlParts;
- if (season === "career") {
- teamUrlParts = ["team_history", `${p.abbrev}_${p.tid}`];
- } else {
- teamUrlParts = ["roster", `${p.abbrev}_${p.tid}`, numericSeason];
- }
+ let teamUrlParts;
+ if (season === "career") {
+ teamUrlParts = ["team_history", `${p.abbrev}_${p.tid}`];
+ } else {
+ teamUrlParts = [
+ "roster",
+ `${p.abbrev}_${p.tid}`,
+ numericSeason,
+ ];
+ }
- const seasonText = p.season !== undefined ? ` ${p.season}` : "";
+ const seasonText = p.season !== undefined ? ` ${p.season}` : "";
- return {
- key: p.key,
- metadata: {
- type: "player",
- pid: p.pid,
- season: numericSeason ?? "career",
- playoffs,
- },
- data: [
- {
- value: j + 1,
- style: {
- // Need this here rather than in cols becuase we're using hideHeader
- width: 1,
- },
+ return {
+ key: p.key,
+ metadata: {
+ type: "player",
+ pid: p.pid,
+ season: numericSeason ?? "career",
+ playoffs,
},
- <>
-
-
- {p.abbrev}
- {seasonText}
-
- {p.pos}
- >,
- {
- value: helpers.roundStat(p.stat, cat.stat, totals),
- classNames: "text-end",
+ data: [
+ {
+ value: j + 1,
+ style: {
+ // Need this here rather than in cols becuase we're using hideHeader
+ width: 1,
+ },
+ },
+ <>
+
+
+ {p.abbrev}
+ {seasonText}
+
+ {p.pos}
+ >,
+ {
+ value: helpers.roundStat(p.stat, cat.stat, totals),
+ classNames: "text-end",
+ },
+ ],
+ classNames: {
+ "table-danger": highlightActiveAndHOF && p.hof,
+ "table-success":
+ highlightActiveAndHOF && p.retiredYear === Infinity,
+ "table-info": p.userTeam,
},
- ],
- classNames: {
- "table-danger": highlightActiveAndHOF && p.hof,
- "table-success":
- highlightActiveAndHOF && p.retiredYear === Infinity,
- "table-info": p.userTeam,
- },
- };
- });
+ };
+ });
- return (
-
-
- {title} ({statCol.title})
-
- }
- name={`LeagueLeaders_${cat.stat}`}
- pagination
- rows={rows}
- />
-
- );
- })}
-