From f8ea2ec67e24643fb60cbe7765abfd292ba6bdf2 Mon Sep 17 00:00:00 2001 From: akiyamn Date: Thu, 9 Nov 2023 00:46:00 +0000 Subject: Add live production day 1 patch --- fe/admin.html | 6 ++-- fe/green.jpg | Bin 0 -> 178327 bytes fe/index.html | 9 ++++++ fe/leaderboard.html | 85 ++++++++++++++++++++++++++++++++++++++-------------- fe/leaderboard.js | 38 +++++++++++++++-------- fe/play.html | 13 ++++++-- fe/play.js | 31 +++++++++++++++---- fe/purple.jpg | Bin 0 -> 156095 bytes 8 files changed, 134 insertions(+), 48 deletions(-) create mode 100644 fe/green.jpg create mode 100644 fe/purple.jpg (limited to 'fe') diff --git a/fe/admin.html b/fe/admin.html index d95f4fa..d38776a 100644 --- a/fe/admin.html +++ b/fe/admin.html @@ -14,9 +14,9 @@
- + - +
@@ -25,4 +25,4 @@ - \ No newline at end of file + diff --git a/fe/green.jpg b/fe/green.jpg new file mode 100644 index 0000000..4be823c Binary files /dev/null and b/fe/green.jpg differ diff --git a/fe/index.html b/fe/index.html index 9f3b3f0..ca16245 100644 --- a/fe/index.html +++ b/fe/index.html @@ -6,6 +6,15 @@ Vite App +

GANG FIGHT!

+

Enter your name and pick your team below.

+

Click the screen to gain points for your team.

+

The more determination your team has the more worth your click is.

+

Every so often a task will appear on your screen.

+

Come to me and complete the task to gain bonus points for your team.

+

May the best color win.

+
+

(GREEN SUXS ;-])



diff --git a/fe/leaderboard.html b/fe/leaderboard.html index e51eca9..6394494 100644 --- a/fe/leaderboard.html +++ b/fe/leaderboard.html @@ -1,39 +1,78 @@ - - - - - - Document - - + + + + + Document + + +
Leaderboard
x1.0
-
+

       Go to unchi.net/jac to join!

- - +
+ - - \ No newline at end of file + + diff --git a/fe/leaderboard.js b/fe/leaderboard.js index 426fb47..74c9829 100644 --- a/fe/leaderboard.js +++ b/fe/leaderboard.js @@ -1,4 +1,5 @@ -import { API_ROOT, INGORED_USERS } from "./global.js" + +import { API_ROOT, INGORED_USERS } from "./global.js" const element = (e) => document.querySelector(e) @@ -26,7 +27,7 @@ function fill_metadata(settings) { } function clear_leaderboard() { - element(`#team-container`).innerHTML = "" + element(`#team-container`).innerHTML = '' } function fill_leaderboard(points, multipliers) { @@ -34,12 +35,17 @@ function fill_leaderboard(points, multipliers) { for (let team of ["green", "purple"]) { console.log(team) const html = ` -
+
+
${sentenceCase(team)} Team
+
Determination: ${multipliers[team]}
+
+
Total: ${points[team]["__total"]}
+
-
${sentenceCase(team)} Team
-
x${multipliers[team]}
-
Total: ${points[team]["__total"]}
+ + ${team_member_entry(points[team])} +
` element(`#team-container`).innerHTML += html @@ -48,13 +54,20 @@ function fill_leaderboard(points, multipliers) { function team_member_entry(teamPoints) { let html = "" + const sorted = [] for (let member in teamPoints) { - if (!INGORED_USERS.includes(member)) { + sorted.push([member, teamPoints[member]]) + } + sorted.sort((a, b) => b[1] - a[1]) + for (let i = 0; i -
${sentenceCase(member)}
-
${teamPoints[member]}
-
+ + ${sentenceCase(sorted[i][0])} + ${sorted[i][1]} + ` } } @@ -64,7 +77,6 @@ function team_member_entry(teamPoints) { document.addEventListener("DOMContentLoaded", async () => { update() const urlParams = new URLSearchParams(window.location.search); - const poll = urlParams.get("poll") || 3000 + const poll = urlParams.get("poll") || 5000 const polling = setInterval(update, poll) }); - diff --git a/fe/play.html b/fe/play.html index d535b40..f96dfac 100644 --- a/fe/play.html +++ b/fe/play.html @@ -5,10 +5,17 @@ Document + -
+ - - \ No newline at end of file + diff --git a/fe/play.js b/fe/play.js index cc790a7..a29fc5d 100644 --- a/fe/play.js +++ b/fe/play.js @@ -1,6 +1,9 @@ import { API_ROOT } from "./global.js" const {team: TEAM, username: USERNAME} = getUserInfo() +const PROMPT_POLL = 30000 + +const element = (e) => document.querySelector(e) async function increment() { const response = await fetch(`${API_ROOT}/increment/${TEAM}/${USERNAME}`, {"method": "POST"}) @@ -14,11 +17,27 @@ function getUserInfo() { } -async function getUserPoints() { - const response = await fetch(`${API_ROOT}/points/${TEAM}/${USERNAME}`) - const {points} = await response.json() - return points +// async function getUserPoints() { +// const response = await fetch(`${API_ROOT}/points/${TEAM}/${USERNAME}`) +// const {points} = await response.json() +// return points +// } + +async function getPrompt() { + const response = await fetch(`${API_ROOT}/prompt/`, { "method": "GET" }) + const { prompt } = await response.json() + return prompt } -document.querySelector("#increment").addEventListener("click", increment) -document.querySelector(".username") \ No newline at end of file +async function fillPrompt() { + element("button").innerHTML = await getPrompt() +} + +element("#increment").addEventListener("click", increment) + +document.addEventListener("DOMContentLoaded", async () => { + // element(".username").innerHTML = USERNAME + console.log("sdfsdf") + fillPrompt() + const polling = setInterval(fillPrompt, PROMPT_POLL) +}); diff --git a/fe/purple.jpg b/fe/purple.jpg new file mode 100644 index 0000000..caa0aa0 Binary files /dev/null and b/fe/purple.jpg differ -- cgit v1.2.3