diff --git a/web/src/app/modules/view/server/profile/profile.component.ts b/web/src/app/modules/view/server/profile/profile.component.ts index 9735c675..a714e30f 100644 --- a/web/src/app/modules/view/server/profile/profile.component.ts +++ b/web/src/app/modules/view/server/profile/profile.component.ts @@ -89,10 +89,6 @@ export class ProfileComponent implements OnInit, OnDestroy { } ).subscribe(data => { this.levels = data.levels.map(level => { - if (level.minXp && level.minXp > this.maxXp) { - this.maxXp = level.minXp; - } - return { label: level.name ?? "", value: level }; }); }); @@ -119,8 +115,10 @@ export class ProfileComponent implements OnInit, OnDestroy { this.router.navigate([`/server/${server.id}`]); } this.user = users.users[0]; + const minXps = this.levels.reverse().map(x => x.value.minXp ?? 0); + this.maxXp = minXps.filter(x => this.user.xp && x > this.user.xp)[0] ?? this.user.xp; if (this.user.level) { - this.activeLevelIndex = this.levels.reverse().map(l => l.value.id).indexOf(this.user.level.id) + 1; + this.activeLevelIndex = this.levels.map(l => l.value.id).indexOf(this.user.level.id) + 1; } this.data.query(Queries.userProfileWarnings, {