-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make replay links fancier, also pretty up the replay cards
- Loading branch information
1 parent
b0566a3
commit 0e1e8c1
Showing
10 changed files
with
185 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ | |
display: none !important; | ||
} | ||
.btn { | ||
.search-container .btn { | ||
margin-right: 0.5rem; | ||
} | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@page "/replay/{id:int}" | ||
@using Microsoft.AspNetCore.Components.Authorization | ||
@using Microsoft.AspNetCore.Components.Web | ||
@using ReplayBrowser.Data.Models | ||
@using ReplayBrowser.Helpers | ||
@using ReplayBrowser.Pages.Shared | ||
@using ReplayBrowser.Services.ReplayParser | ||
|
||
@inject AuthenticationStateProvider AuthenticationStateProvider | ||
@inject ReplayHelper ReplayHelper | ||
@inject ReplayParserService ReplayParserService | ||
@inject NavigationManager NavigationManager | ||
@inject IHttpContextAccessor HttpContextAccessor | ||
|
||
<PageTitle>Replay viewer</PageTitle> | ||
@if (Replay == null) | ||
{ | ||
<ReplayBrowser.Pages.Shared.Layout.ErrorCode Code=404 /> | ||
} | ||
else | ||
{ | ||
<ReplayDetails FullReplay="Replay" /> | ||
|
||
<MetaDataSpecifer | ||
Title="@GetTitle()" | ||
Description="@GetDescription()" | ||
/> | ||
} | ||
|
||
@code { | ||
[Parameter] | ||
public int Id { get; set; } | ||
|
||
public Replay? Replay { get; set; } | ||
|
||
protected string GetTitle() | ||
{ | ||
// Not null because the function is used only when Replay IS NOT null | ||
return $"Round #{Replay!.RoundId} - {Replay.ServerName ?? Replay.ServerId} - {Replay.Date}"; | ||
} | ||
|
||
protected string GetDescription() | ||
{ | ||
return "Round " + Replay!.RoundId + " played on " + Replay.Map + " on " + Replay.Date?.ToString("yyyy-MM-dd HH:mm:ss"); | ||
} | ||
|
||
protected virtual Task<Replay?> GetReplay(AuthenticationState? state) | ||
{ | ||
return ReplayHelper.GetReplay((int) Id!, state!); | ||
} | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
Replay = await GetReplay(await AuthenticationStateProvider.GetAuthenticationStateAsync()); | ||
|
||
if (Replay is not null) | ||
return; | ||
|
||
HttpContextAccessor.HttpContext!.Response.StatusCode = 404; | ||
} | ||
} |
Oops, something went wrong.