make it a dedicated stats modal, not under account (#4627)

## Description:

seperates the stats modal into a dedicated path, with gameID support
e.g. :

#modal=stats&gameID=VvyXpL9x

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory

## Please put your Discord username so you can be contacted if a bug or
regression is found:

w.o.n
This commit is contained in:
Ryan
2026-07-17 09:18:32 -07:00
committed by GitHub
parent 0fc80e931e
commit f070d4843d
8 changed files with 294 additions and 90 deletions
+35
View File
@@ -154,6 +154,41 @@ describe("GameInfoView", () => {
});
});
it("renders a fetch error and recovers when Retry succeeds", async () => {
const retry = deferred<AnalyticsRecord | false>();
const errorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
try {
fetchMock
.mockRejectedValueOnce(new Error("network failure"))
.mockReturnValueOnce(retry.promise);
view = mountView("retry-game");
await waitForRender(view, () => {
expect(view!.textContent).toContain("game_info_modal.load_failed");
expect(view!.querySelector("button")?.textContent).toContain(
"game_info_modal.retry",
);
});
const retryButton = view.querySelector("button") as HTMLButtonElement;
retryButton.click();
await vi.waitFor(() => expect(fetchMock).toHaveBeenCalledTimes(2));
expect(fetchMock).toHaveBeenNthCalledWith(2, "retry-game");
retry.resolve(makeSession("retry-game", GameMapType.Montreal));
await retry.promise;
await waitForRender(view, () => {
expect(view!.textContent).toContain(GameMapType.Montreal);
expect(view!.textContent).not.toContain("game_info_modal.load_failed");
expect(view!.querySelectorAll("player-row")).toHaveLength(1);
});
} finally {
errorSpy.mockRestore();
}
});
it("clears rendered game state when gameId becomes null", async () => {
fetchMock.mockResolvedValue(makeSession("game-1", GameMapType.Montreal));
view = mountView("game-1");