diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/app.js b/frontend/normal_user/_main page/pojedynczy_turniej/app.js index 93e53a4..e0c178d 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/app.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/app.js @@ -10,6 +10,23 @@ async function showTournaments() { } } +function logout() { + localStorage.clear(); + location.reload(); +} + +function logoutVisibility() { + if (localStorage.getItem("token") !== null) { + document.getElementById("logout").style.display = ""; + } + else { + document.getElementById("logout").style.display = "none"; + + } + +} + + function loginVisibility() { if (localStorage.getItem("token") !== null) { document.getElementById("login").style.display = "none"; @@ -20,6 +37,7 @@ function loginVisibility() { } } + async function renderTournaments() { let tournaments = await showTournaments(); let html = ''; diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js index ca79021..6f45ad8 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/collapsible.js @@ -2,13 +2,40 @@ var coll = document.getElementsByClassName("collapsible"); var i; for (i = 0; i < coll.length; i++) { - coll[i].addEventListener("click", function() { + coll[i].addEventListener("click", function () { this.classList.toggle("active"); var content = this.nextElementSibling; - if (content.style.maxHeight){ + if (content.style.maxHeight) { content.style.maxHeight = null; } else { content.style.maxHeight = content.scrollHeight + "px"; } }); +} + +function logout() { + localStorage.clear(); + location.reload(); +} + +function logoutVisibility() { + if (localStorage.getItem("token") !== null) { + document.getElementById("logout").style.display = ""; + } + else { + document.getElementById("logout").style.display = "none"; + + } + +} + + +function loginVisibility() { + if (localStorage.getItem("token") !== null) { + document.getElementById("login").style.display = "none"; + } + else { + document.getElementById("login").style.display = ""; + + } } \ No newline at end of file diff --git a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html index 7b7a021..6051f2f 100644 --- a/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html +++ b/frontend/normal_user/_main page/pojedynczy_turniej/drabinka/index.html @@ -11,17 +11,18 @@ -
+