Skip to content

Commit

Permalink
recuperando o nome na navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
AGoretti committed Jun 21, 2019
1 parent af4f92d commit 90d9298
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
11 changes: 11 additions & 0 deletions front-end/pret-event/src/app/common/navbar/navbar.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
font-weight: 700;
}

.nav-name {
color: #ffffff;
font-weight: 0;


}

.nav-bt:hover {
color: #20a4f3;
}
Expand All @@ -39,6 +46,10 @@
top: 15px;
}

.name {
color: #ffffff;
}

@media screen and (max-width: 600px) {
.alert-view {
max-width: 50%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
<li class="nav-item nav-bt">
<a class="nav-link" href="/evento/criar" *ngIf="logged">Criar Evento</a>
</li>
<li *ngIf="logged" class="">
<p class="nav-link">Olá, {{name}} | </p>
</li>
<li class="nav-item nav-bt">
<a class="nav-link"
(click)="account === 'Entrar/Cadastrar' ? openModal(template) : login()">{{ account }}</a>
Expand Down
24 changes: 20 additions & 4 deletions front-end/pret-event/src/app/common/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ import { AlertComponent } from 'ngx-bootstrap/alert/alert.component';

import { AlertService } from '../../services/alert.service';
import { getToken, removeToken } from '../../helpers/token';
import { removeId } from 'src/app/helpers/id';
import { removeId, getId } from 'src/app/helpers/id';
import { Player } from 'src/app/models/player';
import { PlayerService } from 'src/app/services/player.service';
import { Router } from '@angular/router';


@Component({
selector: 'app-navbar',
selector: 'app-navbar ',
templateUrl: './navbar.component.html',
styleUrls: ['./navbar.component.css']


})
export class NavbarComponent implements OnInit {

logged = getToken() !== null;
account = this.logged ? 'Sair' : 'Entrar/Cadastrar';
navbarOpen = false;

modalRef: BsModalRef;
Expand All @@ -25,11 +30,22 @@ export class NavbarComponent implements OnInit {
animated: true,
};
alerts: any[] = [];
player: Player;
name: string;
currentId = +getId();
account = this.logged ? 'Sair' : 'Entrar/Cadastrar';
router: Router;


constructor(private modalService: BsModalService, private data: AlertService) {}
constructor(private modalService: BsModalService, private data: AlertService, private playerservice: PlayerService) {}

ngOnInit() {
this.data.currentAlert.subscribe(alert => this.alerts.push(alert));
this.playerservice.getPlayerid(this.currentId)
.then((player: Player) => {
this.player = player;
this.name = this.player.username;
})
}

onClosed(dismissedAlert: AlertComponent): void {
Expand Down

0 comments on commit 90d9298

Please sign in to comment.