Skip to content

Commit

Permalink
Merge 9d81f7a into 1d9bf3b
Browse files Browse the repository at this point in the history
  • Loading branch information
AGoretti committed Jun 23, 2019
2 parents 1d9bf3b + 9d81f7a commit 8fdcd8d
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 13 deletions.
15 changes: 15 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,14 @@
top: 15px;
}

.name {
color: #ffffff;
}

.my-events {
border-left-width: 5px;
}

@media screen and (max-width: 600px) {
.alert-view {
max-width: 50%;
Expand Down
18 changes: 11 additions & 7 deletions front-end/pret-event/src/app/common/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@
</button>
<div class="collapse navbar-collapse justify-content-end" [ngClass]="{ 'show': navbarOpen }">
<ul class="navbar-nav">
<li class="nav-item nav-bt" *ngIf="logged">
<a class="nav-link" href="#">Meus Eventos</a>
<li *ngIf="logged" class="">
<p class="nav-link mb-0"> Olá, {{name}}</p>
</li>
<li class="nav-item nav-bt">
<a class="nav-link"
(click)="account === 'Entrar/Cadastrar' ? openModal(template) : login()">{{ account }}</a>
</li>
<li class="nav-item nav-bt my-events" *ngIf="logged">
<a class="nav-link" href="#">|&nbsp; &nbsp; Meus Eventos</a>
</li>
<li class="nav-item nav-bt" *ngIf="logged">
<a class="nav-link" href="/ranking">Ranking</a>
</li>
<li class="nav-item nav-bt">
<a class="nav-link" href="/recompensa/criar" *ngIf="logged">Criar Recompensa</a>
<a class="nav-link" href="/recompensa/criar" *ngIf="logged">Criar Recompensa </a>
</li>
<li class="nav-item nav-bt">
<a class="nav-link" href="/evento/criar" *ngIf="logged">Criar Evento</a>
</li>
<li class="nav-item nav-bt">
<a class="nav-link"
(click)="account === 'Entrar/Cadastrar' ? openModal(template) : login()">{{ account }}</a>
</li>

</ul>
</div>
<div class="alert-view">
Expand Down
29 changes: 25 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,26 @@ export class NavbarComponent implements OnInit {
animated: true,
};
alerts: any[] = [];
player: Player;
name: string;
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.getName(+getId());
}

getName(id) {
if(id !== 0)
this.playerservice.getPlayerid(id)
.then((player: Player) => {
this.player = player;
this.name = this.player.username;
});
}

onClosed(dismissedAlert: AlertComponent): void {
Expand Down Expand Up @@ -59,6 +79,7 @@ export class NavbarComponent implements OnInit {
if (!this.logged) {
this.account = 'Sair';
msg = 'Login realizado!';
this.getName(+getId());
}
this.logged = !this.logged;
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { AlertService } from '../../services/alert.service';
import { setToken } from '../../helpers/token';
import { Alert } from 'src/app/models/alert';
import { setId } from 'src/app/helpers/id';
import { Router } from '@angular/router';


@Component({
selector: 'app-sign-modal',
Expand All @@ -26,7 +28,8 @@ export class SignModalComponent implements OnInit {
file: any;
clicked = false;

constructor(private formBuilder: FormBuilder, private service: PlayerService, private data: AlertService) { }

constructor(private formBuilder: FormBuilder, private service: PlayerService, private data: AlertService, private router: Router,) { }

registerPlayer() {
this.clicked = true;
Expand Down Expand Up @@ -83,6 +86,7 @@ export class SignModalComponent implements OnInit {
this.hideModal();
this.clicked = false;
this.login();
this.router.navigate(['']);
})
.catch((x: { error: {} }) => {
console.log(x);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
}

.imageParticipante {
max-width: 30px;
max-width: 40px;
height: 40px;
}


Expand Down

0 comments on commit 8fdcd8d

Please sign in to comment.