Add battle death stats and HUD updates

This commit is contained in:
2026-05-22 17:01:01 +09:00
parent be80cb17b0
commit a41e9b6f26
19 changed files with 2408 additions and 264 deletions
+30
View File
@@ -0,0 +1,30 @@
export async function fetchTodayDeathStats() {
const response = await fetch("/api/death-stats/today", {
headers: {
Accept: "application/json",
},
});
if (!response.ok) {
throw new Error(`Death stats fetch failed: ${response.status}`);
}
return response.json();
}
export async function addTodayDeathStats(deathStats) {
const response = await fetch("/api/death-stats/today", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify(deathStats),
});
if (!response.ok) {
throw new Error(`Death stats update failed: ${response.status}`);
}
return response.json();
}
+10 -1
View File
@@ -3,7 +3,9 @@ import { NICKNAME_LENGTH } from "../constants.js";
export function createMatchForm() {
const form = getElement("#fighter-form");
const namesInput = getElement("#player-names");
const appNode = document.querySelector("#app");
const statusNode = document.querySelector("#match-status");
const statusTextNodes = document.querySelectorAll("[data-status-text]");
const teamSizeInput = getElement("#team-size");
const teamSizeOutput = getElement("#team-size-value");
@@ -27,8 +29,15 @@ export function createMatchForm() {
readMatchConfig,
setStatus(message) {
if (statusNode) {
statusNode.textContent = message;
statusNode.setAttribute("aria-hidden", "false");
statusNode.title = message;
}
statusTextNodes.forEach((node) => {
node.textContent = message;
});
appNode?.classList.add("status-active");
},
};
}