Disable Open in osu!web option on user page when replay_id is 0

Usually, when the `replay_id` is 0 it means the replay was set offline
or not uploaded to osu-web for some reason. Disable the link when this
is the case, as it will just take them to a Not Found page.
This commit is contained in:
Stedoss 2024-07-05 18:21:35 +01:00
parent 735f3427c5
commit eb0c62756b
2 changed files with 5 additions and 1 deletions

View File

@ -45,7 +45,7 @@
<div style="display: flex; justify-content: space-between; margin-bottom: 10px" class="link-list"> <div style="display: flex; justify-content: space-between; margin-bottom: 10px" class="link-list">
<a style="flex: 1" class="text-center" href="https://osu.ppy.sh/scores/osu/{{ this.replayData.replay_id }}" target="_blank"> <a style="flex: 1" class="text-center" href="https://osu.ppy.sh/scores/osu/{{ this.replayData.replay_id }}" target="_blank" [class.disabled]="!isWebScore()">
Open in osu!web Open in osu!web
</a> </a>

View File

@ -63,6 +63,10 @@ export class ViewScoreComponent implements OnInit {
return this.hasErrorDistribution(); return this.hasErrorDistribution();
} }
isWebScore(): boolean {
return !!this.replayData && this.replayData.replay_id !== 0;
}
ngOnInit(): void { ngOnInit(): void {
this.activatedRoute.params.subscribe(params => { this.activatedRoute.params.subscribe(params => {
this.replayId = params['replayId']; this.replayId = params['replayId'];