UI Improvements

This commit is contained in:
Elizabeth Cray 2023-10-04 01:53:05 -04:00
parent 4951c288fa
commit 22d79165b2
7 changed files with 22 additions and 4 deletions

BIN
Assets/hacker-128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
Assets/hacker-1k.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -191,6 +191,18 @@ const displayFingerprints = () => {
}); });
}; };
const setUIData = (data) => {
if (document.getElementById("resizer")) {
document.getElementById("resizer").innerHTML = data.display_name;
}
if(document.getElementById("logo")){
var logo = document.getElementById("logo");
logo.src = data.avatar;
logo.style.borderRadius = "10%";
logo.alt = "Profile icon for " + data.display_name;
}
};
const checkLogin = () => { const checkLogin = () => {
// check login status // check login status
var token = localStorage.getItem("tty_token"); var token = localStorage.getItem("tty_token");
@ -214,7 +226,7 @@ const checkLogin = () => {
}else { }else {
localStorage.setItem("tty_token", response.refreshToken); localStorage.setItem("tty_token", response.refreshToken);
localStorage.setItem("tty_userData", JSON.stringify(response.data)); localStorage.setItem("tty_userData", JSON.stringify(response.data));
document.getElementById("resizer").innerHTML = response.data.display_name; setUIData(response.data);
} }
}); });
}else { }else {
@ -269,7 +281,7 @@ $(() => {
}else{ }else{
localStorage.setItem("tty_token", response.refreshToken); localStorage.setItem("tty_token", response.refreshToken);
localStorage.setItem("tty_userData", JSON.stringify(response.data)); localStorage.setItem("tty_userData", JSON.stringify(response.data));
document.getElementById("resizer").innerHTML = response.data.display_name; setUIData(response.data);
} }
}); });
} else { } else {

View File

@ -4,6 +4,6 @@
}else{ }else{
echo "<a href=\"https://tty.hackers.town\">"; echo "<a href=\"https://tty.hackers.town\">";
}?> }?>
<img src="/Assets/HTown.png" class="logo self-align-center mx-auto d-block" alt="Hacker Town logo in ASCII art. Rendered as image to force correct visualization."/> <img src="/Assets/HTown.png" class="logo self-align-center mx-auto d-block" alt="Hacker Town logo in ASCII art. Rendered as image to force correct visualization." id="logo"/>
</a> </a>
</div> </div>

View File

@ -4,5 +4,5 @@
</span> </span>
</div> </div>
<div class="row button"> <div class="row button">
<button id="bttn" class="keyButton" onclick="beginOauth()">Log In With HTown <!-- img src="/Assets/HTown.png" class="emoji"/ --></button> <button id="bttn" class="keyButton" onclick="beginOauth()">Log In With <img src="/Assets/hacker-128.png" class="emoji" /></button>
</div> </div>

View File

@ -136,6 +136,8 @@ $(() => {
Swal.fire({ Swal.fire({
...SwalConfig, ...SwalConfig,
text: message text: message
}).then(() => {
window.location.replace("/");
}); });
} }

View File

@ -128,3 +128,7 @@ td:first-child {
.fingerprintBit { .fingerprintBit {
text-align: right; text-align: right;
} }
.emoji {
height: 2em;
}