diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2025-11-12 14:37:19 +0100 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2025-11-12 14:37:19 +0100 |
| commit | 2b5a120bd3900d5cecbe355d336a4ea8d3a1b31a (patch) | |
| tree | 69b614eafcd781055603a36568f46aa538329bb1 /index.js | |
| parent | 3a4a0f6f2bf9aff14c00c6acee637319d7458bbb (diff) | |
Prettified the code and cleaned up the light/dark mode
Diffstat (limited to 'index.js')
| -rw-r--r-- | index.js | 62 |
1 files changed, 33 insertions, 29 deletions
@@ -2,7 +2,6 @@ import { CourtManager } from "./court.mjs"; import { PlayerManager, addLoadBehaviour } from "./player.mjs"; import { Round, generateDummyGames, proposeGames } from "./game.mjs"; - // Court and player handling let c = new CourtManager(); let p = new PlayerManager(); @@ -11,34 +10,39 @@ addLoadBehaviour(p); // Game handling let proposal; let session = []; // Persist this in local storage with 1 day limit -if (session.length === 0) {session.push(new Round(generateDummyGames(c.listData, "---"), 0))}; +if (session.length === 0) { + session.push(new Round(generateDummyGames(c.listData, "---"), 0)); +} document.getElementById("game_list").innerHTML = session.at(-1).render(); document.getElementById("propose").addEventListener("click", () => { - let normalize = Number(document.getElementById("skill").value); - console.log(normalize); - let players = p.listData.map(function(p) { - p.skill = Math.ceil(p.skill / normalize); - return p; - }) - proposal = proposeGames(players, c.listData); - document.getElementById("game_list").innerHTML = new Round(proposal).render(); -}) + let normalize = Number(document.getElementById("skill").value); + console.log(normalize); + let players = p.listData.map(function (p) { + p.skill = Math.ceil(p.skill / normalize); + return p; + }); + proposal = proposeGames(players, c.listData); + document.getElementById("game_list").innerHTML = new Round(proposal).render(); +}); document.getElementById("confirm").addEventListener("click", () => { - console.log("Confirm the proposal on screen for round " + session.length + "."); - session.push(new Round(proposal, session.length)); - // Need to update the number of games played here - document.getElementById("game_list").innerHTML = session.at(-1).render(); - document.getElementById("timer-start").click(); - const notification = new Notyf({ - duration: 30 * 1000, - position: {x: 'center', y: 'top'}, - types: [{ - type: 'success', - background: 'green', - duration: 1000 * 1000, - dismissible: true - }] - }); - notification.success("Round confirmed!"); - -})
\ No newline at end of file + console.log( + "Confirm the proposal on screen for round " + session.length + "." + ); + session.push(new Round(proposal, session.length)); + // Need to update the number of games played here + document.getElementById("game_list").innerHTML = session.at(-1).render(); + document.getElementById("timer-start").click(); + const notification = new Notyf({ + duration: 30 * 1000, + position: { x: "center", y: "top" }, + types: [ + { + type: "success", + background: "green", + duration: 1000 * 1000, + dismissible: true, + }, + ], + }); + notification.success("Round confirmed!"); +}); |
