Skip to content

Commit

Permalink
fix(user): user navigation for profile
Browse files Browse the repository at this point in the history
  • Loading branch information
kdinev committed Sep 17, 2024
1 parent 62c0146 commit 83ab5cc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion projects/common/src/lib/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<div class="profile-view">
<igx-avatar [src]="authUser.csgoDetails?.avatarFull || authUser.sc2Details?.avatarUrl" [initials]="authUser.username" shape="circle" [size]="'large'">
</igx-avatar>
<h1 class="igx-card-header__title highlight navigatable profile-username" (click)="navigateToProfile(authUser.csgoDetails.customUrl )">{{ authUser.username }}</h1>
<h1 class="igx-card-header__title highlight navigatable profile-username" (click)="navigateToProfile(authUser)">{{ authUser.username }}</h1>
<h4 class="igx-card-header__subtitle">{{ authUser.csgoDetails?.realName || authUser.sc2Details?.battleNetBattleTag }}</h4>
</div>

Expand Down
14 changes: 11 additions & 3 deletions projects/common/src/lib/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,19 @@ export class LoginComponent {
this.userProfile.close();
}

public navigateToProfile(id: string) {
public navigateToProfile(user: ApplicationUser) {
if (window.location.href.startsWith(environment.bellumgens)) {
this.router.navigate(['/players/', id]);
if (user.csgoDetails) {
this.router.navigate(['/players/', user.csgoDetails.customUrl]);
} else if (user.sc2Details) {
this.router.navigate(['/players/', user.sc2Details.battleNetId]);
}
} else {
window.location.href = `${environment.bellumgens}/players/${id}`;
if (user.csgoDetails) {
window.location.href = `${environment.bellumgens}/players/${user.csgoDetails.customUrl}`;
} else if (user.sc2Details) {
window.location.href = `${environment.bellumgens}/players/${user.sc2Details.battleNetId}`;
}
}
}
}
Expand Down

0 comments on commit 83ab5cc

Please sign in to comment.