Skip to content

Commit

Permalink
Show platform in room listing
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Aug 28, 2024
1 parent 0b49e81 commit 0f43122
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/components/items/room.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { AsyncPipe } from "@angular/common";
import {GamePipe} from "../../pipes/game.pipe";
import {PluralPipe} from "../../pipes/plural.pipe";
import {UserLinkComponent} from "../ui/text/links/user-link.component";
import {PlatformPipe} from "../../pipes/platform.pipe";

@Component({
selector: 'app-room',
Expand All @@ -14,8 +15,9 @@ import {UserLinkComponent} from "../ui/text/links/user-link.component";
GamePipe,
PluralPipe,
UserLinkComponent,
AsyncPipe
],
AsyncPipe,
PlatformPipe
],
template: `
<b>
{{'player' | plural: room.playerIds.length}}
Expand All @@ -24,6 +26,9 @@ import {UserLinkComponent} from "../ui/text/links/user-link.component";
on {{room.game | game}}
</span>
}
<span>
via {{room.platform | platform}}
</span>
</b>
<ul class="list-disc list-inside">
@for (player of room.playerIds; track player) {
Expand Down
23 changes: 23 additions & 0 deletions src/app/pipes/platform.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import {Pipe, PipeTransform} from "@angular/core";
import {Platform} from "../api/types/platform";

@Pipe({
name: 'platform',
standalone: true
})
export class PlatformPipe implements PipeTransform {
transform(value: Platform, short: boolean = false): string {
switch (value) {
case Platform.PS3:
return "PS3";
case Platform.RPCS3:
return "RPCS3";
case Platform.Vita:
return "PS Vita";
case Platform.Website:
return "Website";
case Platform.PSP:
return "PSP";
}
}
}

0 comments on commit 0f43122

Please sign in to comment.