Disable links to replay/etc if the replay itself isnt available

This commit is contained in:
nise.moe 2024-03-05 20:52:22 +01:00
parent ebe6b41a4d
commit c6c4b5bb6d
3 changed files with 13 additions and 3 deletions

View File

@ -98,6 +98,12 @@
color: white;
}
.disabled {
pointer-events: none;
cursor: default;
opacity: 0.5;
}
.score-info__item {
flex: none;
margin: 10px;

View File

@ -47,11 +47,11 @@
Open in osu!web
</a>
<a style="flex: 1" class="text-center" [href]="this.buildCircleguardUrl()">
<a style="flex: 1" class="text-center" [href]="this.buildCircleguardUrl()" [class.disabled]="!hasReplay()">
Open in CircleGuard
</a>
<a style="flex: 1" class="text-center" [href]="'https://replay.nise.moe/' + this.replayData.replay_id" target="_blank">
<a style="flex: 1" class="text-center" [href]="'https://replay.nise.moe/' + this.replayData.replay_id" target="_blank" [class.disabled]="!hasReplay()">
Open in Replay Viewer
</a>
@ -164,7 +164,7 @@
<div class="main term mb-2" *ngIf="this.replayData.mean_error">
<h1># nerd stats</h1>
<div class="alert text-center" *ngIf="this.replayData.average_ur">
<div class="alert text-center mb-2" *ngIf="this.replayData.average_ur">
<p class="bold">Heads up!</p>
<p>The average cvUR for this beatmap is <span class="bold">{{ this.replayData.average_ur | number: '1.0-2' }}</span></p>
</div>

View File

@ -69,6 +69,10 @@ export class ViewScoreComponent implements OnInit {
private title: Title
) {}
hasReplay(): boolean {
return !!this.replayData?.error_distribution && Object.keys(this.replayData.error_distribution).length > 0;
}
ngOnInit(): void {
this.activatedRoute.params.subscribe(params => {
this.replayId = params['replayId'];