front: username displayed as dropdown button

This commit is contained in:
AdrienLSH 2024-01-18 14:26:49 +01:00
parent ad6aa62ecd
commit 251e9b032a
2 changed files with 3 additions and 1 deletions

View File

@ -112,6 +112,7 @@ class Client
await this.me.init();
document.getElementById('navbarLoggedOut').classList.add('d-none');
document.getElementById('navbarLoggedIn').classList.remove('d-none');
document.getElementById('navbarDropdownButton').innerHTML = this.me.username;
document.getElementById('myProfileLink').href = '/profiles/' + this.me.username;
}
else
@ -119,6 +120,7 @@ class Client
this.me = undefined;
document.getElementById('navbarLoggedOut').classList.remove('d-none');
document.getElementById('navbarLoggedIn').classList.add('d-none');
document.getElementById('navbarDropdownButton').innerHTML = 'Me';
document.getElementById('myProfileLink').href = '';
}
this._logged = state;

View File

@ -21,7 +21,7 @@
<a href="/register" class="nav-link" data-link>Register</a>
</div>
<div id='navbarLoggedIn' class='d-none nav-item dropdown'>
<a class='nav-link dropdown-toggle' href='#' role='button' data-bs-toggle='dropdown' aria-expanded='false'>
<a id='navbarDropdownButton' class='nav-link dropdown-toggle' href='#' role='button' data-bs-toggle='dropdown' aria-expanded='false'>
Me
</a>
<div class='dropdown-menu dropdown-menu-end position-absolute text-end px-2' style='min-width: 100px'>