1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

avatar in nav dropdown

This commit is contained in:
Kyle Spearrin 2018-07-06 10:00:09 -04:00
parent b8921713eb
commit 1228010488
2 changed files with 14 additions and 8 deletions

View File

@ -22,10 +22,13 @@
<i class="fa fa-user fa-lg"></i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="nav-profile">
<span class="dropdown-item-text">
{{'loggedInAs' | i18n}}
<small class="text-muted">{{email}}</small>
</span>
<div class="dropdown-item-text d-flex align-items-center" *ngIf="name" appStopProp>
<app-avatar [data]="name" width="25" height="25" fontSize="14" [circle]="true"></app-avatar>
<div class="ml-2">
{{'loggedInAs' | i18n}}
<small class="text-muted">{{name}}</small>
</div>
</div>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="https://help.bitwarden.com" target="_blank" rel="noopener">
<i class="fa fa-fw fa-question-circle"></i>

View File

@ -5,7 +5,7 @@ import {
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { UserService } from 'jslib/abstractions/user.service';
import { TokenService } from 'jslib/abstractions/token.service';
@Component({
selector: 'app-navbar',
@ -13,15 +13,18 @@ import { UserService } from 'jslib/abstractions/user.service';
})
export class NavbarComponent implements OnInit {
selfHosted = false;
email: string;
name: string;
constructor(private messagingService: MessagingService, private platformUtilsService: PlatformUtilsService,
private userService: UserService) {
private tokenService: TokenService) {
this.selfHosted = this.platformUtilsService.isSelfHost();
}
async ngOnInit() {
this.email = await this.userService.getEmail();
this.name = await this.tokenService.getName();
if (this.name == null || this.name.trim() === '') {
this.name = await this.tokenService.getEmail();
}
}
lock() {