Skip to content

Commit

Permalink
style(xp-tracker): capitalize username in xp-tracker title
Browse files Browse the repository at this point in the history
  • Loading branch information
FreekMencke committed Mar 23, 2024
1 parent 0cf8aca commit 607d274
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/common/pipes/capitalize.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import { Pipe, PipeTransform } from '@angular/core';
export class CapitalizePipe implements PipeTransform {
transform(string: string | undefined | null): string | null {
if (string == null) return null;
return this.capitalise(string);
return CapitalizePipe.capitalise(string);
}

/** Split the string into an array of words and capitalize each part */
capitalise(string: string): string {
static capitalise(string: string): string {
return string
.split(/\s/g)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
import { CapitalizePipe } from 'src/app/common/pipes/capitalize.pipe';

export const playerDetailTitleResolver: ResolveFn<string> = (route: ActivatedRouteSnapshot) =>
`${route.params['username']} - XP Tracker - OSRS Tracker`;
`${CapitalizePipe.capitalise(route.params['username'])} - XP Tracker - OSRS Tracker`;

0 comments on commit 607d274

Please sign in to comment.