1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-22 22:38:24 +02:00

Teams can draw a problem

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-24 13:24:44 +01:00
parent 6b5c630048
commit e90005b192
3 changed files with 102 additions and 7 deletions

View File

@ -16,6 +16,10 @@ function drawDice(tid, trigram = null) {
sockets[tid].send(JSON.stringify({'type': 'dice', 'trigram': trigram}))
}
function drawProblem(tid) {
sockets[tid].send(JSON.stringify({'type': 'draw_problem'}))
}
function showNotification(title, body, timeout = 5000) {
let notif = new Notification(title, {'body': body, 'icon': "/static/tfjm.svg"})
if (timeout)
@ -111,6 +115,22 @@ document.addEventListener('DOMContentLoaded', () => {
div.classList.add('d-none')
}
function updateBoxVisibility(visible) {
let div = document.getElementById(`draw-problem-${tournament.id}`)
if (visible)
div.classList.remove('d-none')
else
div.classList.add('d-none')
}
function updateButtonsVisibility(visible) {
let div = document.getElementById(`buttons-${tournament.id}`)
if (visible)
div.classList.remove('d-none')
else
div.classList.add('d-none')
}
function updatePoules(round, poules) {
let roundList = document.getElementById(`recap-${tournament.id}-round-list`)
let poolListId = `recap-${tournament.id}-round-${round}-pool-list`
@ -413,6 +433,12 @@ document.addEventListener('DOMContentLoaded', () => {
case 'dice_visibility':
updateDiceVisibility(data.visible)
break
case 'box_visibility':
updateBoxVisibility(data.visible)
break
case 'buttons_visibility':
updateButtonsVisibility(data.visible)
break
case 'set_poules':
updatePoules(data.round, data.poules)
break