add current user styling

This commit is contained in:
Elijah R 2024-02-02 09:16:17 -05:00 committed by Elijah R
parent a81eb5917b
commit 7ef0f20189
2 changed files with 8 additions and 0 deletions

View File

@ -117,4 +117,8 @@ tr.user-waiting > td {
.tr.user-waiting:hover, tr.user-waiting > td:hover { .tr.user-waiting:hover, tr.user-waiting > td:hover {
background-color: #ece1be !important; background-color: #ece1be !important;
--bs-table-bg-state: #ece1be !important; --bs-table-bg-state: #ece1be !important;
}
.user-current {
font-style: italic;
} }

View File

@ -159,6 +159,8 @@ function sortVMList() {
function sortUserList() { function sortUserList() {
users.sort((a, b) => { users.sort((a, b) => {
if (a.user.username === w.username && (a.user.turn >= b.user.turn)) return -1;
if (b.user.username === w.username && (b.user.turn >= a.user.turn)) return 1;
if (a.user.turn === b.user.turn) return 0; if (a.user.turn === b.user.turn) return 0;
if (a.user.turn === -1) return 1; if (a.user.turn === -1) return 1;
if (b.user.turn === -1) return -1; if (b.user.turn === -1) return -1;
@ -229,6 +231,8 @@ function addUser(user : User) {
tr.classList.add("user-unregistered"); tr.classList.add("user-unregistered");
break; break;
} }
if (user.username === w.username)
tr.classList.add("user-current");
tr.appendChild(td); tr.appendChild(td);
elements.userlist.appendChild(tr); elements.userlist.appendChild(tr);
if (olduser !== undefined) olduser.element = tr; if (olduser !== undefined) olduser.element = tr;