From 7cec8794b6616d294b6a0e8aab3b9d8b1dcdb6db Mon Sep 17 00:00:00 2001
From: Karan Jayachandra
Date: Sat, 15 Nov 2025 19:12:25 +0100
Subject: Added the change to Pico CSS
---
src/main.js | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
(limited to 'src/main.js')
diff --git a/src/main.js b/src/main.js
index ec33b18..6d8f35b 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,19 +1,11 @@
+import "@picocss/pico";
import "notyf/notyf.min.css";
-import "bulma/css/bulma.css";
import "@fortawesome/fontawesome-free/css/all.css";
import "./style.css";
-import { Notyf } from "notyf";
import { Timer } from "./timer";
-import { Team, Game } from "./data";
+import { Team, Game, Regular } from "./data";
import { Manager, CourtManager, RegularManager, GuestManager } from "./manage";
-export function getNotifier(seconds) {
- return new Notyf({
- duration: seconds * milliSecond,
- position: { x: "center", y: "top" },
- dismissible: true,
- });
-}
export class GameManager extends Manager {
timer = new Timer();
@@ -31,7 +23,9 @@ export class GameManager extends Manager {
if (typeof description === "undefined") {
description = "---";
}
- let team = new Team(description, description);
+ let player = new Regular(null, null, null, null, description, "");
+ console.log(player);
+ let team = new Team(player, player);
return new Game(i, true, team, team);
}
loadItem(data) {
@@ -69,8 +63,8 @@ export class GameManager extends Manager {
const startIndex = 4 * index;
const endIndex = startIndex + 4;
const courtPlayers = selectedPlayers.slice(startIndex, endIndex);
- const teamOne = new Team(courtPlayers[0].name, courtPlayers[3].name);
- const teamTwo = new Team(courtPlayers[1].name, courtPlayers[2].name);
+ const teamOne = new Team(courtPlayers[0], courtPlayers[3]);
+ const teamTwo = new Team(courtPlayers[1], courtPlayers[2]);
const game = new Game(usedCourts[index].id, false, teamOne, teamTwo);
this.data.push(game);
}
@@ -125,7 +119,6 @@ export class GameManager extends Manager {
confirm() {
let confirmedStatus = this.data[0].status;
if (confirmedStatus) {
- getNotifier().error("Create a proposal first!");
return;
}
console.log("Confirm the proposal for round " + this.round + ".");
@@ -144,7 +137,7 @@ export class GameManager extends Manager {
localStorage.removeItem(this.description);
localStorage.removeItem(this.courts.description);
localStorage.removeItem(this.guests.description);
- // Clear the number of games played
+ this.regulars.reset();
document.getElementById("timer-stop").click();
window.location.reload();
}
@@ -164,11 +157,9 @@ function addGameBehaviour(g) {
});
document.getElementById("confirm").addEventListener("click", () => {
g.confirm();
- getNotifier().success("Round confirmed!");
});
document.getElementById("reset").addEventListener("click", () => {
g.reset();
- getNotifier().error("Session has been reset!");
});
}
--
cgit v1.3.1
From 4ff9794fa2b545134efe341ad012667c67f70d15 Mon Sep 17 00:00:00 2001
From: Karan Jayachandra
Date: Sat, 15 Nov 2025 20:09:51 +0100
Subject: Added the changes to include the game counting
---
index.html | 12 ++++++------
src/data.js | 32 +++++++++++++++++++-------------
src/main.js | 28 ++++++++++++++++++++++------
src/manage.js | 8 +++++---
src/style.css | 4 +++-
5 files changed, 55 insertions(+), 29 deletions(-)
(limited to 'src/main.js')
diff --git a/index.html b/index.html
index 0b0e641..7a47a8d 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,7 @@

-
-
` : playerState;
return `
Court ${this.id + 1}
diff --git a/src/main.js b/src/main.js
index 6d8f35b..3732e51 100644
--- a/src/main.js
+++ b/src/main.js
@@ -19,14 +19,17 @@ export class GameManager extends Manager {
this.render();
addGameBehaviour(this);
}
- createItem(i, description) {
+ createItem(i, description, status) {
if (typeof description === "undefined") {
description = "---";
}
+ if (typeof status === "undefined") {
+ status = true;
+ }
let player = new Regular(null, null, null, null, description, "");
console.log(player);
let team = new Team(player, player);
- return new Game(i, true, team, team);
+ return new Game(i, status, team, team);
}
loadItem(data) {
let id = Number(data.id);
@@ -37,21 +40,22 @@ export class GameManager extends Manager {
}
addBehaviour() {
let confirmedStatus = this.data[0].status;
+
let description = confirmedStatus ? "Round " + this.round : "Proposal";
- document.getElementById("Game_description").innerHTML = description;
+ document.getElementById("Game-description").innerHTML = description;
}
addBlockedGames() {
const inactiveCourts = this.courts.inactive();
console.log("Total reserved courts are " + inactiveCourts.length + ".");
for (let court of inactiveCourts) {
- this.data.push(this.createItem(court.id, "RESERVED"));
+ this.data.push(this.createItem(court.id, "RESERVED", false));
}
}
addInactiveGames(possibleMatches) {
const activeCourts = this.courts.active();
const unusedCourts = activeCourts.slice(possibleMatches + 1);
for (let court of unusedCourts) {
- this.data.push(this.createItem(court.id));
+ this.data.push(this.createItem(court.id, "---", false));
}
}
addActiveGames(possibleMatches) {
@@ -92,7 +96,7 @@ export class GameManager extends Manager {
p.print();
});
const shuffledPlayers = shuffle(activePlayers);
- shuffledPlayers.sort((a, b) => a.totalPlayed - b.totalPlayed);
+ shuffledPlayers.sort((a, b) => a.games - b.games);
const selectedPlayers = shuffledPlayers.slice(0, count);
selectedPlayers.sort((a, b) => a.level - b.level);
console.log("Selected players are:");
@@ -128,6 +132,18 @@ export class GameManager extends Manager {
this.data[i].status = true;
}
// Increment the number of games played
+ let selectedPlayers = [];
+ for (let game of this.data) {
+ console.log(game);
+ if ( game.teamOne.playerOne.name !== "RESERVED" ){
+ selectedPlayers.push(game.teamOne.playerOne.name);
+ selectedPlayers.push(game.teamOne.playerTwo.name);
+ selectedPlayers.push(game.teamTwo.playerOne.name);
+ selectedPlayers.push(game.teamTwo.playerTwo.name);
+ }
+ }
+ this.regulars.incrementGames(selectedPlayers);
+ this.guests.incrementGames(selectedPlayers);
this.store();
this.render();
document.getElementById("timer-start").click();
diff --git a/src/manage.js b/src/manage.js
index f8fe220..6ed58bd 100644
--- a/src/manage.js
+++ b/src/manage.js
@@ -38,7 +38,7 @@ export class Manager {
return i.render();
})
.join("");
- let elementId = this.data[0].description + "_list";
+ let elementId = this.data[0].description + "-list";
document.getElementById(elementId).innerHTML = renderedHTML;
this.addBehaviour();
}
@@ -111,12 +111,14 @@ export class GuestManager extends Manager {
active() {
return normalize(super.active());
}
- update(list) {
+ incrementGames(list) {
for (let index = 0; index < this.data.length; index++ ){
- if (this.data[index].name in list) {
+ if (list.includes(this.data[index].name)) {
+ console.log("Added game count to " + this.data[index].name);
this.data[index].games += 1;
}
}
+ this.store();
}
}
diff --git a/src/style.css b/src/style.css
index 197597b..d6ea4de 100644
--- a/src/style.css
+++ b/src/style.css
@@ -7,7 +7,9 @@
text-align: center;
width: 100px;
}
-
+#timer {
+ margin: 0;
+}
@media (min-width: 900px) {
#Regular_list button {
height: 100px;
--
cgit v1.3.1
From fef09593445dcf3a56ee9074b88bde7b0a9f33f9 Mon Sep 17 00:00:00 2001
From: Karan Jayachandra
Date: Sat, 15 Nov 2025 21:59:09 +0100
Subject: Added the changes to fix the bug with class name and changed the SVG
color to match the buttons
---
index.html | 44 +++++++++++++++++++++++++-------------------
public/icon.svg | 4 ++--
src/data.js | 12 ++++++------
src/main.js | 6 ++----
src/manage.js | 16 ++++++++++++----
src/style.css | 6 +++++-
6 files changed, 52 insertions(+), 36 deletions(-)
(limited to 'src/main.js')
diff --git a/index.html b/index.html
index 7a47a8d..b99eb3f 100644
--- a/index.html
+++ b/index.html
@@ -1,22 +1,26 @@
-
+
Match Up!
+
+
+
+