diff --git a/package.json b/package.json index ea7e7fa..5e24d55 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,6 @@ }, "devDependencies": { "parcel": "^2.12.0", - "parcel-namer-hashless": "^1.0.6", "parcel-namer-rewrite": "^2.10.3-rc.2", "typescript-plugin-css-modules": "^5.1.0" }, diff --git a/src/components/loggedinpage.js b/src/components/loggedinpage.js deleted file mode 100644 index e69de29..0000000 diff --git a/src/components/matchlist.js b/src/components/matchlist.js deleted file mode 100644 index 436f275..0000000 --- a/src/components/matchlist.js +++ /dev/null @@ -1,54 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const matchlist_module_css_1 = require("../../assets/css/components/matchlist.module.css"); -const { div } = require("hyperscript-helpers")(m); -const component = () => { - let Matches = { - data: [], - load: async function (id, objectType) { - Matches.data = await m.request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/" + objectType + "/" + id + "/matches", - withCredentials: true, - }); - } - }; - let Object = { - data: [], - load: async function (id, objectType) { - Object.data = await m.request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/" + objectType + "/" + id, - withCredentials: true, - }); - } - }; - return { - async oninit(vnode) { - await Matches.load(vnode.attrs.id, vnode.attrs.objectType); - await Object.load(vnode.attrs.id, vnode.attrs.objectType); - }, - view(vnode) { - return div("." + matchlist_module_css_1.default.matchList, { key: Object.data['id'] + vnode.attrs.objectType }, [ - div("." + matchlist_module_css_1.default.name, Object.data['name']), - Matches.data.map(function (match) { - return div("." + matchlist_module_css_1.default.match + (match.id == vnode.attrs.matchSelect ? '.' + matchlist_module_css_1.default.select : ''), { - onclick() { - m.route.set(`/match/${match.id}`); - }, - }, match.name); - }), - ]); - } - }; -}; -exports.default = component; diff --git a/src/components/navbar.js b/src/components/navbar.js deleted file mode 100644 index 11c09e1..0000000 --- a/src/components/navbar.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const navbar_module_css_1 = require("../../assets/css/components/navbar.module.css"); -const { div, a, img } = require("hyperscript-helpers")(m); -/* - * @param newtab - * @param href - * @param color - * @param icon - * @param name - */ -const navbar = { - view() { - return div("." + navbar_module_css_1.default.navbar, [ - a({ href: "#!/" }, img("." + navbar_module_css_1.default.logo, { src: require("/assets/img/icon.png") })), - img("." + navbar_module_css_1.default.fslogo, { src: require("/assets/img/FS_logo.jpg") }), - ]); - }, -}; -exports.default = navbar; diff --git a/src/helpers/api.js b/src/helpers/api.js deleted file mode 100644 index 98b16e3..0000000 --- a/src/helpers/api.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.processLogin = void 0; -const m = require("mithril"); -async function processLogin(e) { - e.preventDefault(); - const result = await m.request({ - method: "POST", - url: (await fetch('env.json').then(response => { - return response.json(); - }).then((data) => { return data.api_url; })) + "/api/login", - withCredentials: true, - config: (xhr_1) => { - xhr_1.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - }, - body: { - username: e.target[0].value, - password: e.target[1].value, - }, - extract: function (xhr_3) { - return { status: xhr_3.status, body: xhr_3.responseText }; - }, - }); - if (result.body == "logged_in") { - m.route.set("/"); - } -} -exports.processLogin = processLogin; -async function checkLogin() { - const result = await m.request({ - method: "GET", - url: await fetch('env.json').then(response => { - return response.json(); - }).then((data) => { return data.api_url; }) + "/api/checklogin", - withCredentials: true, - extract: function (xhr_1) { - return { status: xhr_1.status, body: xhr_1.responseText }; - }, - }); - return result.body == "logged_in"; -} -exports.default = checkLogin; diff --git a/src/pages/admin.js b/src/pages/admin.js deleted file mode 100644 index 967f341..0000000 --- a/src/pages/admin.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -var m = require("mithril"); -var navbar_1 = require("../components/navbar"); -var div = require("hyperscript-helpers")(m).div; -var page = { - view: function () { - return div(".page.admin", [m(navbar_1.default)]); - }, -}; -exports.default = page; diff --git a/src/pages/home.js b/src/pages/home.js deleted file mode 100644 index c81a6f5..0000000 --- a/src/pages/home.js +++ /dev/null @@ -1,43 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const navbar_1 = require("../components/navbar"); -const api_1 = require("../helpers/api"); -const home_module_css_1 = require("../../assets/css/pages/home.module.css"); -const { div } = require("hyperscript-helpers")(m); -const page = { - logged_in: false, - async oninit() { - page.logged_in = await (0, api_1.default)(); - }, - view() { - return div('.' + home_module_css_1.default.page, [ - m(navbar_1.default), - div("." + home_module_css_1.default.views, [ - div("." + home_module_css_1.default.view, { - onclick() { - m.route.set("/runden"); - }, - }, "Rundenansicht"), - div("." + home_module_css_1.default.view, { - onclick: function () { - m.route.set("/raeume"); - }, - }, "Räumeansicht"), - !page.logged_in - ? null - : div("." + home_module_css_1.default.view, { - onclick: function () { - m.route.set("/non-sign"); - }, - }, "Anmeldung"), - div("." + home_module_css_1.default.view, { - onclick: function () { - m.route.set("/participants"); - }, - }, "Teilnehmer"), - ]), - ]); - }, -}; -exports.default = page; diff --git a/src/pages/login.js b/src/pages/login.js deleted file mode 100644 index a20a535..0000000 --- a/src/pages/login.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const navbar_1 = require("../components/navbar"); -const api_1 = require("../helpers/api"); -const login_module_css_1 = require("../../assets/css/pages/login.module.css"); -const { div, button, form, label, input, h1, br } = require("hyperscript-helpers")(m); -const page = { - view: function () { - return div({ class: login_module_css_1.default.page }, [ - m(navbar_1.default), - div({ class: login_module_css_1.default.loginForm }, [ - h1("Login"), - form({ - onsubmit: api_1.processLogin, - }, [ - div([ - label("Benutzername: "), - br(), - input({ type: "text" }), - ]), - br(), - div([ - label("Password:"), - br(), - input({ type: "password" }), - ]), - br(), - button("Submit"), - ]), - ]), - ]); - }, -}; -exports.default = page; diff --git a/src/pages/match.js b/src/pages/match.js deleted file mode 100644 index 3d9a83a..0000000 --- a/src/pages/match.js +++ /dev/null @@ -1,196 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const navbar_1 = require("../components/navbar"); -const match_module_css_1 = require("../../assets/css/pages/match.module.css"); -const matchlist_1 = require("../components/matchlist"); -const api_1 = require("../helpers/api"); -const { div, br, h1, input, form, button } = require("hyperscript-helpers")(m); -const page = () => { - let logged_in = false; - const Round = { - data: [], - load: async function (id) { - return m - .request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/round/" + id, - withCredentials: true, - }) - .then(function (result) { - Round.data = result; - }); - }, - }; - const Match = { - data: [], - loadlist: async function (id) { - return m - .request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/match/" + id, - withCredentials: true, - }) - .then(function (result) { - Match.data = result; - }); - }, - }; - const NextMatch = { - data: [], - loadlist: async function (id, index) { - return m - .request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/match/" + id, - withCredentials: true, - }) - .then(function (result) { - NextMatch.data[index] = result.name; - }); - }, - }; - const ParticipantName = { - data: [], - loadlist: async function (id) { - ParticipantName.data = []; - return m - .request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/participant/" + id, - withCredentials: true, - }) - .then(function (result) { - ParticipantName.data[id] = result["name"]; - }); - }, - }; - const ParticipantCheckedIn = { - data: [], - loadlist: async function (id) { - ParticipantCheckedIn.data = []; - return m - .request({ - method: "GET", - url: (await fetch('/env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - })) + "/api/participant/" + id, - withCredentials: true, - }) - .then(function (result) { - ParticipantCheckedIn.data[id] = result["checkedIn"]; - }); - }, - }; - return { - view() { - return div("." + match_module_css_1.default.page, [ - m(navbar_1.default), - [ - div("." + match_module_css_1.default.overview, { - key: m.route.param("id"), - async oninit() { - logged_in = await (0, api_1.default)(); - m.redraw(); - Match.data = []; - await Match.loadlist(Number.parseInt(m.route.param("id"))); - await Round.load(Match.data["round"]); - }, - }, 0 == Match.data.length - ? "" - : [ - div("." + match_module_css_1.default.matchList, m(matchlist_1.default, { - id: Match.data["room"], - objectType: "room", - matchSelect: Number.parseInt(m.route.param("id")), - }), m(matchlist_1.default, { - id: Match.data["round"], - objectType: "round", - matchSelect: Number.parseInt(m.route.param("id")), - })), - div("." + match_module_css_1.default.match, [ - h1(Match.data["name"]), - "Startzeit: " + - new Date(Match.data["time"]).toTimeString().slice(0, 5), - br(), - form({ - async onsubmit(e) { - for (let i = 0; i < Match.data["competitorAmount"]; i++) { - if (e.target[i].value == "") { - continue; - } - await m.request({ - method: "PUT", - url: window.location.origin.concat("/api/match/" + - Number.parseInt(m.route.param("id")) + - "/participant/" + - e.target[i].id, "/" + - e.target[i].value), - withCredentials: true, - config: (xhr_1) => { - xhr_1.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - }, - }); - m.redraw(); - } - }, - }, div("." + match_module_css_1.default.matchTable, [ - div("." + match_module_css_1.default.defRow, [ - div("." + match_module_css_1.default.def, "Teilnehmer"), - div("." + match_module_css_1.default.def, "Rang"), - div("." + match_module_css_1.default.def, "Nächstes Match"), - ]), - Object.keys(Match.data["participants"]).map((k) => [ - div("." + match_module_css_1.default.entryRow, { - async oninit() { - await ParticipantName.loadlist(Number.parseInt(k)); - await ParticipantCheckedIn.loadlist(Number.parseInt(k)); - let nextMatch = Match.data["nextMatches"][Match.data["participants"][k]]; - if (nextMatch != 0 && nextMatch != null) { - await NextMatch.loadlist(Number.parseInt(nextMatch), Number.parseInt(k)); - } - else if (NextMatch.data.at(Number.parseInt(k)) != null) { - NextMatch.data[Number.parseInt(k)] = null; - } - }, - }, [ - div("." + match_module_css_1.default.entry, ParticipantCheckedIn.data.at(Number.parseInt(k)) ? - m(m.route.Link, { href: "/participant/" + k }, ParticipantName.data.at(Number.parseInt(k))) : ParticipantName.data.at(Number.parseInt(k))), - div("." + match_module_css_1.default.entry, input({ placeholder: Match.data["participants"][k], id: k })), - div("." + match_module_css_1.default.entry, NextMatch.data.at(Number.parseInt(k)) == null - ? "keins" - : m(m.route.Link, { - href: "/match/" + - Match.data["nextMatches"][Match.data["participants"][k]], - }, NextMatch.data.at(Number.parseInt(k)))) - ]), - ]), - ]), br(), !logged_in - ? null - : button("Submit")), - ]), - ]), - ], - ]); - }, - }; -}; -exports.default = page; diff --git a/src/pages/non-sign.js b/src/pages/non-sign.js deleted file mode 100644 index cd1742a..0000000 --- a/src/pages/non-sign.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var m = require("mithril"); -var navbar_1 = require("../components/navbar"); -var participants_module_css_1 = require("../../assets/css/pages/participants.module.css"); -var _a = require("hyperscript-helpers")(m), div = _a.div, input = _a.input, h1 = _a.h1, button = _a.button, form = _a.form; -var page = function () { - var Participants = { - list: [], - load: function () { - return __awaiter(this, void 0, void 0, function () { - var _a, _b; - var _c; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: - _b = (_a = m) - .request; - _c = { - method: "GET" - }; - return [4 /*yield*/, fetch('env.json').then(function (response) { - return response.json(); - }).then(function (data) { - return data.api_url; - })]; - case 1: return [2 /*return*/, _b.apply(_a, [(_c.url = (_d.sent()) + "/api/participants/check", - _c.withCredentials = true, - _c)]) - .then(function (result) { - Participants.list = result; - }, function (error) { - console.log(error); - })]; - } - }); - }); - }, - }; - return { - oninit: function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, Participants.load()]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }, - view: function () { - return div("." + participants_module_css_1.default.page, [ - m(navbar_1.default), - div("." + participants_module_css_1.default.overview, [ - h1("Noch nicht angemeldet"), - div("." + participants_module_css_1.default.participantsTable, [ - div("." + participants_module_css_1.default.defRow, [ - div("." + participants_module_css_1.default.def, "Startnummer"), - div("." + participants_module_css_1.default.def, "Teilnehmer"), - div("." + participants_module_css_1.default.def, "Anmeldung"), - ]), - Participants.list.map(function (k) { - return div("." + participants_module_css_1.default.entryRow, [ - div("." + participants_module_css_1.default.entry, k["id"]), - div("." + participants_module_css_1.default.entry, k["name"]), - div("." + participants_module_css_1.default.entry, button({ - onclick: function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, m.request({ - method: "PUT", - url: window.location.origin + - "/api/participant/" + - Number.parseInt(k["id"]), - withCredentials: true, - config: function (xhr_1) { - xhr_1.setRequestHeader("X-Requested-With", "XMLHttpRequest"); - }, - })]; - case 1: - _a.sent(); - window.location.reload(); - return [2 /*return*/]; - } - }); - }); - }, - }, "Anmelden")), - ]); - }), - ]), - ]), - ]); - }, - }; -}; -exports.default = page; diff --git a/src/pages/participant.js b/src/pages/participant.js deleted file mode 100644 index 10ee67e..0000000 --- a/src/pages/participant.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const navbar_1 = require("../components/navbar"); -const participant_module_css_1 = require("../../assets/css/pages/participant.module.css"); -const { div, br, h1, h2 } = require("hyperscript-helpers")(m); -const page = () => { - const Participant = { - data: [], - loadlist: async function (id) { - return m - .request({ - method: "GET", - url: await fetch('env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - }) + "/api/participant/" + id, - withCredentials: true, - }) - .then(function (result) { - Participant.data = result; - }); - }, - }; - const Match = { - time: [], - rank: [], - name: [], - load: async function (id) { - return m - .request({ - method: "GET", - url: await fetch('env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - }) + "/api/match/" + id, - withCredentials: true, - }) - .then(function (result) { - Match.time[id] = result["time"]; - Match.name[id] = result["name"]; - Match.rank[id] = result["participants"][m.route.param("id")]; - }); - }, - }; - return { - view() { - return div("." + participant_module_css_1.default.page, [ - m(navbar_1.default), - [ - div("." + participant_module_css_1.default.overview, { - key: m.route.param("id"), - async oninit() { - m.redraw(); - Participant.data = []; - await Participant.loadlist(Number.parseInt(m.route.param("id"))); - }, - }, 0 == Participant.data.length - ? "" - : [ - div("." + participant_module_css_1.default.participant, [ - h1(Participant.data["name"]), - br(), - div("Startnummer: " + m.route.param("id")), - div("." + participant_module_css_1.default.matchTable, [ - div("." + participant_module_css_1.default.defRow, [ - div("." + participant_module_css_1.default.def, "Match"), - div("." + participant_module_css_1.default.def, "Startzeit"), - div("." + participant_module_css_1.default.def, "Rang"), - ]), - Participant.data["assignedMatches"].map((k) => [ - div("." + participant_module_css_1.default.entryRow, { - async oninit() { - await Match.load(k); - }, - }, [ - div("." + participant_module_css_1.default.entry, m(m.route.Link, { href: "/match/" + k }, Match.name.at(k))), - div("." + participant_module_css_1.default.entry, new Date(Match.time.at(k)).toTimeString().slice(0, 5)), - div("." + participant_module_css_1.default.entry, Match.rank.at(k)), - ]), - ]), - ]), - ]), - ]), - ], - ]); - }, - }; -}; -exports.default = page; diff --git a/src/pages/participants.js b/src/pages/participants.js deleted file mode 100644 index b61df72..0000000 --- a/src/pages/participants.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const m = require("mithril"); -const navbar_1 = require("../components/navbar"); -const participants_module_css_1 = require("../../assets/css/pages/participants.module.css"); -const { div, input, h1, button, form } = require("hyperscript-helpers")(m); -const page = () => { - const Participants = { - checked_in: [], - checked_out: [], - load: async function () { - return m - .request({ - method: "GET", - url: await fetch('env.json').then(response => { - return response.json(); - }).then((data) => { - return data.api_url; - }) + "/api/participants", - withCredentials: true, - }) - .then(function (result) { - Participants.checked_in = result.filter(item => item.checkedIn == true); - Participants.checked_out = result.filter(item => item.checkedIn == false); - }, function (error) { - console.log(error); - }); - }, - }; - return { - async oninit() { - await Participants.load(); - }, - view() { - return div("." + participants_module_css_1.default.page, [ - m(navbar_1.default), - div("." + participants_module_css_1.default.overview, [ - h1("Teilnehmer"), - div("." + participants_module_css_1.default.participantsTable, [ - div("." + participants_module_css_1.default.defRow, [ - div("." + participants_module_css_1.default.def, "Startnummer"), - div("." + participants_module_css_1.default.def, "Teilnehmer"), - ]), - Participants.checked_in.map((k) => { - return div("." + participants_module_css_1.default.entryRow, [ - div("." + participants_module_css_1.default.entry, k["id"]), - m(m.route.Link, { href: "/participant/" + k["id"], class: participants_module_css_1.default.entry }, k["name"]) - ]); - }), - Participants.checked_out.map((k) => { - return div("." + participants_module_css_1.default.entryRow, [ - div("." + participants_module_css_1.default.entry, k["id"]), - div("." + participants_module_css_1.default.entry, k["name"]) - ]); - }), - ]), - ]), - ]); - }, - }; -}; -exports.default = page; diff --git a/src/pages/room-view.js b/src/pages/room-view.js deleted file mode 100644 index 6bf83d1..0000000 --- a/src/pages/room-view.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var m = require("mithril"); -var navbar_1 = require("../components/navbar"); -var room_view_module_css_1 = require("../../assets/css/pages/room-view.module.css"); -var matchlist_1 = require("../components/matchlist"); -var div = require("hyperscript-helpers")(m).div; -var page = function () { - var Room = { - list: [], - load: function () { - return __awaiter(this, void 0, void 0, function () { - var _a, _b; - var _c; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: - _b = (_a = m) - .request; - _c = { - method: "GET" - }; - return [4 /*yield*/, fetch('env.json').then(function (response) { - return response.json(); - }).then(function (data) { - return data.api_url; - })]; - case 1: return [2 /*return*/, _b.apply(_a, [(_c.url = (_d.sent()) + "/api/rooms", - _c.withCredentials = true, - _c)]) - .then(function (result) { - Room.list = result; - }, function (error) { - console.log(error); - })]; - } - }); - }); - }, - }; - return { - oninit: function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, Room.load()]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }, - view: function () { - return div("." + room_view_module_css_1.default.page, [ - m(navbar_1.default), - div("." + room_view_module_css_1.default.overview, [ - Room.list.map(function (room) { - return m(matchlist_1.default, { - id: room.id, - objectType: "room" - }); - }), - ]), - ]); - }, - }; -}; -exports.default = page; diff --git a/src/pages/round-view.js b/src/pages/round-view.js deleted file mode 100644 index 78e71eb..0000000 --- a/src/pages/round-view.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (g && (g = 0, op[0] && (_ = 0)), _) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -}; -Object.defineProperty(exports, "__esModule", { value: true }); -var m = require("mithril"); -var navbar_1 = require("../components/navbar"); -var round_view_module_css_1 = require("../../assets/css/pages/round-view.module.css"); -var matchlist_1 = require("../components/matchlist"); -var div = require("hyperscript-helpers")(m).div; -var page = function () { - var Round = { - list: [], - load: function () { - return __awaiter(this, void 0, void 0, function () { - var _a, _b; - var _c; - return __generator(this, function (_d) { - switch (_d.label) { - case 0: - _b = (_a = m) - .request; - _c = { - method: "GET" - }; - return [4 /*yield*/, fetch('env.json').then(function (response) { - return response.json(); - }).then(function (data) { - return data.api_url; - })]; - case 1: return [2 /*return*/, _b.apply(_a, [(_c.url = (_d.sent()) + "/api/rounds", - _c.withCredentials = true, - _c)]) - .then(function (result) { - Round.list = result; - }, function (error) { - console.log(error); - })]; - } - }); - }); - }, - }; - return { - oninit: function () { - return __awaiter(this, void 0, void 0, function () { - return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, Round.load()]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); - }); - }, - view: function () { - return div("." + round_view_module_css_1.default.page, [ - m(navbar_1.default), - div("." + round_view_module_css_1.default.overview, [ - Round.list.map(function (round) { - return m(matchlist_1.default, { - id: round.id, - objectType: "round", - }); - }), - ]), - ]); - }, - }; -}; -exports.default = page; diff --git a/yarn.lock b/yarn.lock index d7ba711..ed53915 100644 --- a/yarn.lock +++ b/yarn.lock @@ -261,7 +261,7 @@ dependencies: chalk "^4.1.0" -"@parcel/namer-default@2.12.0", "@parcel/namer-default@^2.10.3", "@parcel/namer-default@^2.8.3": +"@parcel/namer-default@2.12.0", "@parcel/namer-default@^2.10.3": version "2.12.0" resolved "https://registry.yarnpkg.com/@parcel/namer-default/-/namer-default-2.12.0.tgz#f9903da8e4c5c3e33fc8ab70b222be520a46da5d" integrity sha512-9DNKPDHWgMnMtqqZIMiEj/R9PNWW16lpnlHjwK3ciRlMPgjPJ8+UNc255teZODhX0T17GOzPdGbU/O/xbxVPzA== @@ -416,7 +416,7 @@ dependencies: "@parcel/plugin" "2.12.0" -"@parcel/plugin@2.12.0", "@parcel/plugin@^2.10.3", "@parcel/plugin@^2.8.3": +"@parcel/plugin@2.12.0", "@parcel/plugin@^2.10.3": version "2.12.0" resolved "https://registry.yarnpkg.com/@parcel/plugin/-/plugin-2.12.0.tgz#3db4237e8977ef5b5378b65eaffb809d2026431a" integrity sha512-nc/uRA8DiMoe4neBbzV6kDndh/58a4wQuGKw5oEoIwBCHUvE2W8ZFSu7ollSXUGRzfacTt4NdY8TwS73ScWZ+g== @@ -848,7 +848,7 @@ resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9" integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ== -"@swc/helpers@^0.5.0", "@swc/helpers@^0.5.1": +"@swc/helpers@^0.5.0": version "0.5.11" resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.11.tgz#5bab8c660a6e23c13b2d23fcd1ee44a2db1b0cb7" integrity sha512-YNlnKRWF2sVojTpIyzwou9XoTNbzbzONwRhOoniEioF1AtaitTvVZblaQRrAzChWQ1bLYyYSWzM18y4WwgzJ+A== @@ -1883,15 +1883,6 @@ ospec@4.0.0: dependencies: glob "^7.1.3" -parcel-namer-hashless@^1.0.6: - version "1.0.6" - resolved "https://registry.yarnpkg.com/parcel-namer-hashless/-/parcel-namer-hashless-1.0.6.tgz#8641b4905f84cf992bf547fe8f6c6c67de8f15b8" - integrity sha512-C+WEXQDUPKavsOPvG9X4S92VBwZNL5InsnuIOASUXcdh6nldlPC8BfmXXLXt8M+9H/H4tuAqOLugYN1KTMf+yQ== - dependencies: - "@parcel/namer-default" "^2.8.3" - "@parcel/plugin" "^2.8.3" - "@swc/helpers" "^0.5.1" - parcel-namer-rewrite@^2.10.3-rc.2: version "2.10.3-rc.2" resolved "https://registry.yarnpkg.com/parcel-namer-rewrite/-/parcel-namer-rewrite-2.10.3-rc.2.tgz#f669cb2e3b043d88b61e698a24c9bdc9a14fb506"