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

Add export button

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-25 20:38:58 +01:00
parent e95d511017
commit b838f1b3f0
5 changed files with 134 additions and 2 deletions

View File

@ -28,6 +28,10 @@ function rejectProblem(tid) {
sockets[tid].send(JSON.stringify({'type': 'reject'}))
}
function exportDraw(tid) {
sockets[tid].send(JSON.stringify({'type': 'export'}))
}
function showNotification(title, body, timeout = 5000) {
let notif = new Notification(title, {'body': body, 'icon': "/static/tfjm.svg"})
if (timeout)
@ -139,6 +143,14 @@ document.addEventListener('DOMContentLoaded', () => {
div.classList.add('d-none')
}
function updateExportVisibility(visible) {
let div = document.getElementById(`export-${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`
@ -493,6 +505,9 @@ document.addEventListener('DOMContentLoaded', () => {
case 'buttons_visibility':
updateButtonsVisibility(data.visible)
break
case 'export_visibility':
updateExportVisibility(data.visible)
break
case 'set_poules':
updatePoules(data.round, data.poules)
break