Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function App({ router, queryClient, persister }: AppProps) {
persistOptions={{
persister,
maxAge,
buster: "1", // API version
buster: "2", // API version
}}
>
<LocalizationProvider dateAdapter={AdapterDayjs}>
Expand Down
1 change: 1 addition & 0 deletions src/helpers/session.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const makePlayerDataPIT = (gamesPlayed: number, experience: number): PlayerDataP
doubles: makeStatsPIT(0),
threes: makeStatsPIT(0),
fours: makeStatsPIT(gamesPlayed),
"4v4": makeStatsPIT(0),
});

describe(addExtrapolatedSessions, () => {
Expand Down
5 changes: 4 additions & 1 deletion src/mocks/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export const makePlayerDataPIT = (
doubles: makeStatsPIT(multiplier),
threes: makeStatsPIT(multiplier),
fours: makeStatsPIT(multiplier),
overall: makeStatsPIT(multiplier * 4),
"4v4": makeStatsPIT(multiplier),
overall: makeStatsPIT(multiplier * 5),
});

export const makeSession = (
Expand Down Expand Up @@ -163,13 +164,15 @@ export const makeWrappedResponse = (uuid: string, year: number) => {
doubles: { highest: 8, when: startTime },
threes: { highest: 6, when: startTime },
fours: { highest: 10, when: startTime },
"4v4": { highest: 2, when: startTime },
},
finalKillStreaks: {
overall: { highest: 20, when: startTime },
solo: { highest: 8, when: startTime },
doubles: { highest: 12, when: startTime },
threes: { highest: 10, when: startTime },
fours: { highest: 15, when: startTime },
"4v4": { highest: 3, when: startTime },
},
sessionCoverage: {
gamesPlayedPercentage: 0.85,
Expand Down
3 changes: 3 additions & 0 deletions src/queries/playerdata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface APIPlayerDataPIT {
readonly doubles: APIStatsPIT;
readonly threes: APIStatsPIT;
readonly fours: APIStatsPIT;
readonly "4v4": APIStatsPIT;
readonly overall: APIStatsPIT;
}

Expand All @@ -43,6 +44,7 @@ export interface PlayerDataPIT {
readonly doubles: StatsPIT;
readonly threes: StatsPIT;
readonly fours: StatsPIT;
readonly "4v4": StatsPIT;
readonly overall: StatsPIT;
}

Expand All @@ -54,5 +56,6 @@ export const apiToPlayerDataPIT = (apiPlayerData: APIPlayerDataPIT): PlayerDataP
doubles: apiPlayerData.doubles,
threes: apiPlayerData.threes,
fours: apiPlayerData.fours,
"4v4": apiPlayerData["4v4"],
overall: apiPlayerData.overall,
Comment on lines 58 to 60
});
4 changes: 4 additions & 0 deletions src/queries/wrapped.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ interface APISessionStats {
readonly doubles: StreakInfo;
readonly threes: StreakInfo;
readonly fours: StreakInfo;
readonly "4v4": StreakInfo;
};
readonly finalKillStreaks: {
readonly overall: StreakInfo;
readonly solo: StreakInfo;
readonly doubles: StreakInfo;
readonly threes: StreakInfo;
readonly fours: StreakInfo;
readonly "4v4": StreakInfo;
};
readonly sessionCoverage: {
readonly gamesPlayedPercentage: number;
Expand Down Expand Up @@ -99,13 +101,15 @@ interface SessionStats {
readonly doubles: StreakInfo;
readonly threes: StreakInfo;
readonly fours: StreakInfo;
readonly "4v4": StreakInfo;
};
readonly finalKillStreaks: {
readonly overall: StreakInfo;
readonly solo: StreakInfo;
readonly doubles: StreakInfo;
readonly threes: StreakInfo;
readonly fours: StreakInfo;
readonly "4v4": StreakInfo;
};
readonly sessionCoverage: {
readonly gamesPlayedPercentage: number;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/wrapped/$uuid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ const Streaks: React.FC<StreaksProps> = ({ wrappedData }) => {
const { sessionStats } = wrappedData;
if (!sessionStats) return null;

const modes = ["overall", "solo", "doubles", "threes", "fours"] as const;
const modes = ["overall", "solo", "doubles", "threes", "fours", "4v4"] as const;

return (
<>
Expand Down
24 changes: 24 additions & 0 deletions src/routes/wrapped/-uuid.ui.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,18 @@ describe("Wrapped detail page", () => {
kills: 200,
deaths: 100,
},
"4v4": {
winstreak: 3,
gamesPlayed: 100,
wins: 60,
losses: 40,
bedsBroken: 80,
bedsLost: 30,
finalKills: 150,
finalDeaths: 50,
kills: 200,
deaths: 100,
},
overall: {
winstreak: 12,
gamesPlayed: 400,
Expand Down Expand Up @@ -482,6 +494,18 @@ describe("Wrapped detail page", () => {
kills: 600,
deaths: 300,
},
"4v4": {
winstreak: 9,
gamesPlayed: 300,
wins: 180,
losses: 120,
bedsBroken: 240,
bedsLost: 90,
finalKills: 450,
finalDeaths: 150,
kills: 600,
deaths: 300,
},
overall: {
winstreak: 36,
gamesPlayed: 1200,
Expand Down
1 change: 1 addition & 0 deletions src/stats/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export const ALL_GAMEMODE_KEYS = [
"doubles",
"threes",
"fours",
"4v4",
"overall",
] as const;
export type GamemodeKey = (typeof ALL_GAMEMODE_KEYS)[number];
Expand Down
3 changes: 3 additions & 0 deletions src/stats/labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ export const getGamemodeLabel = (gamemode: GamemodeKey, capitalize = false): str
case "fours": {
return capitalize ? "Fours" : "fours";
}
case "4v4": {
return "4v4";
}
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/stats/progression.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ class PlayerDataBuilder {
doubles: { ...emptyStats },
threes: { ...emptyStats },
fours: { ...emptyStats },
"4v4": { ...emptyStats },
overall: { ...emptyStats },
};
}
Expand All @@ -159,6 +160,7 @@ class PlayerDataBuilder {
doubles: { ...this.player.doubles },
threes: { ...this.player.threes },
fours: { ...this.player.fours },
"4v4": { ...this.player["4v4"] },
overall: { ...this.player.overall },
};
}
Expand Down
3 changes: 2 additions & 1 deletion src/theme/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const LIGHT_TOKENS: SchemeTokens = {
};

/**
* Per-gamemode accent colours for the four real modes. Used for chart strokes
* Per-gamemode accent colours for the real modes. Used for chart strokes
* and legend dots so a gamemode keeps a stable identity colour across the app.
* Shared across light and dark. "overall" is intentionally absent — it resolves
* to the scheme's `primary` colour (added in the theme), so the aggregate
Expand All @@ -97,6 +97,7 @@ export const GAMEMODE_COLORS: Record<Exclude<GamemodeKey, "overall">, string> =
doubles: "#06b6d4",
threes: "#22c55e",
fours: "#f59e0b",
"4v4": "#ef4444",
};

/**
Expand Down