diff --git a/website/public/profile/scripts.js b/website/public/profile/scripts.js index 7ebfc566..6b762887 100644 --- a/website/public/profile/scripts.js +++ b/website/public/profile/scripts.js @@ -52,14 +52,14 @@ window.onload = function() { function signout() { var user = firebase.auth().currentUser; - firebase.auth().signOut() - window.location.href = '../'; + firebase.auth().signOut().then( + window.location.href = '../'); } function deleteAccount() { try { - firebase.auth().currentUser.delete() - window.location.href = '../'; + firebase.auth().currentUser.delete().then( + window.location.href = '../'); } catch (error) { if (error.code == 'auth/requires-recent-login') { alert("Please sign in again to delete your account.") @@ -68,6 +68,7 @@ function deleteAccount() { } } + function updun() { var user = firebase.auth().currentUser; user.updateProfile({ diff --git a/website/public/team/index.html b/website/public/team/index.html index 7b47e18c..99a63791 100644 --- a/website/public/team/index.html +++ b/website/public/team/index.html @@ -1,30 +1,50 @@ - + + + + <meta charset="utf-8"> - <title><meta charset="utf-8"> <title>titanscout + - - -
- × - Profile - Team - Scout Matches - Torunament Stats + + + +
+ × + Profile + Team + Scout Matches + Torunament Stats +
+
+ + + +

TitanScout- Your Teams

+

Loading...

+ + +

Team Membership

+
+
+ + +
+
+ + +
-
- - - -

TitanScout- Your Teams

-

Loading...

-
- + +
+
+ + diff --git a/website/public/team/scripts.js b/website/public/team/scripts.js index 3a741a5c..26ab23af 100644 --- a/website/public/team/scripts.js +++ b/website/public/team/scripts.js @@ -3,6 +3,9 @@ function openNav() { document.getElementById("mySidenav").style.width = "250px"; document.getElementById("main").style.marginLeft = "250px"; document.body.style.backgroundColor = "rgba(0,0,0,0.4)"; + for (var i = 0; i < document.getElementsByClassName("btn").length; i++) { + document.getElementsByClassName("btn")[i].style.backgroundColor="rgba(0,0,0,.2)" + } } /* Set the width of the side navigation to 0 and the left margin of the page content to 0, and the background color of body to white */ @@ -10,6 +13,9 @@ function closeNav() { document.getElementById("mySidenav").style.width = "0"; document.getElementById("main").style.marginLeft = "0"; document.body.style.backgroundColor = "white"; + for (var i = 0; i < document.getElementsByClassName("btn").length; i++) { + document.getElementsByClassName("btn")[i].style.backgroundColor="buttonface" + } } window.onload = function() { @@ -22,12 +28,12 @@ window.onload = function() { storageBucket: "titanscoutandroid.appspot.com", messagingSenderId: "1097635313476" }; - //eventually find a less-jank way to do this tho firebase.initializeApp(config); firebase.auth().onAuthStateChanged(function(user) { if (user != null) { if (user.displayName != null) { document.getElementById('status').innerHTML = "You are signed in as: " + user.displayName; + document.getElementById('newDN').innerHTML = user.displayName; } else if (user.email != null) { document.getElementById('status').innerHTML = "You are signed in as: " + user.email; } else if (user.phoneNumber != null) { @@ -35,8 +41,58 @@ window.onload = function() { } else { document.getElementById('status').innerHTML = "You are signed in."; } + if (user.email != null) { + document.getElementById('newEM').innerHTML = user.email; + } } else { window.location.replace('../'); } + teamAssoc=firebase.firestore().collections('UserAssociations').doc(user.uid); + teamAssoc.get().then(function(doc){ + if(doc.exists)}{ + list=doc.data() + teamNums=Object.keys(list) + document.getElementById(teammem).innerHTML = "" + for i in teamNums(){ + document.getElementById(teammem).innerHTML +=""+i+""+list.i+"" + } + }else { + document.getElementById(teammem).innerHTML = "You are not part of any teams" + } + }) }); } +function cnt(tn) { + firebase.firestore().collection("UserAssociations").doc(user.id).set({tn : 'captain'} , { merge: true }).then( + teamAssoc=firebase.firestore().collections('UserAssociations').doc(user.uid); + teamAssoc.get().then(function(doc){ + if(doc.exists)}{ + list=doc.data() + teamNums=Object.keys(list) + document.getElementById(teammem).innerHTML = "" + for i in teamNums(){ + document.getElementById(teammem).innerHTML +=""+i+""+list.i+"" + } + }else { + document.getElementById(teammem).innerHTML = "You are not part of any teams" + } + }) + ) +} +function signout() { + var user = firebase.auth().currentUser; + firebase.auth().signOut().then( + window.location.href = '../'); +} + +function deleteAccount() { + try { + firebase.auth().currentUser.delete().then( + window.location.href = '../'); + } catch (error) { + if (error.code == 'auth/requires-recent-login') { + alert("Please sign in again to delete your account.") + window.location.href = '../'; + } + } +}