aboutsummaryrefslogtreecommitdiff
path: root/index.js
blob: 98236a41f128995d492e07c5c78bf042f9bf674b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { Round } from "./game.mjs";
import { generateCourts } from "./court.mjs";
import { generatePlayers } from "./player.mjs";
import { addToggleBehaviour } from "./utils.mjs";

// Court handling
let courts = generateCourts();
addToggleBehaviour(courts, "court_");

// Regulars handling
let regulars = generatePlayers();
addToggleBehaviour(regulars, "regular_");
const fileInput = document.querySelector("#file-js input[type=file]");
    if (fileInput !== null) {
        fileInput.onchange = () => {
        if (fileInput.files.length > 0) {
            const fileName = document.querySelector("#file-js .file-name");
            fileName.textContent = fileInput.files[0].name;
            console.log(fileInput.files[0]);
        }
    }
};

// Game handling
let games = new Round(0, courts);
let renderedHTML = games.render();
document.getElementById("game_list").innerHTML = renderedHTML;
document.getElementById("propose").addEventListener("click", () => {
    console.log("Propose new games!");
})