aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/data.js12
-rw-r--r--src/main.js6
-rw-r--r--src/manage.js16
-rw-r--r--src/style.css6
4 files changed, 25 insertions, 15 deletions
diff --git a/src/data.js b/src/data.js
index 3e133ee..f1cf7c9 100644
--- a/src/data.js
+++ b/src/data.js
@@ -1,8 +1,8 @@
class Switch {
- constructor(id, status) {
+ constructor(id, description, status) {
this.id = id;
this.status = typeof status !== "undefined" ? status : false;
- this.description = this.constructor.name;
+ this.description = description;
this.name = this.description + " " + (id + 1);
}
toggle() {
@@ -22,13 +22,13 @@ class Switch {
export class Court extends Switch {
constructor(id, status) {
- super(id, status);
+ super(id, "Court", status);
}
}
export class Regular extends Switch {
constructor(id, status, level, games, firstName, lastName) {
- super(id, status);
+ super(id, "Regular", status);
this.level = typeof level !== "undefined" ? level : 1;
this.games = typeof games !== "undefined" ? games : 0;
this.firstName =
@@ -49,7 +49,7 @@ export class Guest extends Switch {
categoryCount = 3;
constructor(id, status, games) {
- super(id, status);
+ super(id, "Guest", status);
const categoryId = Math.floor(id / this.maxCount) || 0;
this.level = guestCategories[categoryId].level;
this.games = typeof games !== "undefined" ? games : 0;
@@ -83,7 +83,7 @@ export class Team {
export class Game extends Switch {
constructor(id, status, teamOne, teamTwo) {
- super(id, status);
+ super(id, "Game", status);
this.teamOne = teamOne;
this.teamTwo = teamTwo;
}
diff --git a/src/main.js b/src/main.js
index 3732e51..654300a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,7 +1,4 @@
-import "@picocss/pico";
-import "notyf/notyf.min.css";
-import "@fortawesome/fontawesome-free/css/all.css";
-import "./style.css";
+import "./style.css"
import { Timer } from "./timer";
import { Team, Game, Regular } from "./data";
import { Manager, CourtManager, RegularManager, GuestManager } from "./manage";
@@ -180,3 +177,4 @@ function addGameBehaviour(g) {
}
const g = new GameManager();
+
diff --git a/src/manage.js b/src/manage.js
index 6ed58bd..83a9b4c 100644
--- a/src/manage.js
+++ b/src/manage.js
@@ -95,8 +95,12 @@ function normalize(data) {
export class GuestManager extends Manager {
constructor(description, count) {
- if ( typeof description === "undefined" ) { description = "Guest"; };
- if ( typeof count === "undefined" ) { count = 18; };
+ if (typeof description === "undefined") {
+ description = "Guest";
+ }
+ if (typeof count === "undefined") {
+ count = 18;
+ }
super(description, count);
}
createItem(i) {
@@ -112,7 +116,7 @@ export class GuestManager extends Manager {
return normalize(super.active());
}
incrementGames(list) {
- for (let index = 0; index < this.data.length; index++ ){
+ for (let index = 0; index < this.data.length; index++) {
if (list.includes(this.data[index].name)) {
console.log("Added game count to " + this.data[index].name);
this.data[index].games += 1;
@@ -145,7 +149,7 @@ export class RegularManager extends GuestManager {
return new Regular(id, status, level, games, firstName, lastName);
}
reset() {
- for (let index = 0; index < this.data.length; index++ ){
+ for (let index = 0; index < this.data.length; index++) {
this.data[index].games = 0;
this.data[index].status = false;
}
@@ -177,6 +181,10 @@ function parseCsv(data) {
return players;
}
+document.getElementById("button-player-load").addEventListener("click", () => {
+ document.getElementById("player-load").click();
+});
+
function addLoadBehaviour(p) {
const f = document.getElementById("player-load");
f.addEventListener("change", () => {
diff --git a/src/style.css b/src/style.css
index d6ea4de..357b043 100644
--- a/src/style.css
+++ b/src/style.css
@@ -1,3 +1,7 @@
+@import "@picocss/pico";
+@import "notyf/notyf.min.css";
+@import "@fortawesome/fontawesome-free/css/all.css";
+
.grid-container {
display: grid;
grid-template-columns: repeat(6, 1fr);
@@ -11,7 +15,7 @@
margin: 0;
}
@media (min-width: 900px) {
- #Regular_list button {
+ #Regular-list button {
height: 100px;
}
}