Skip to content

Commit

Permalink
Remove StreamRendering from Player profile view
Browse files Browse the repository at this point in the history
  • Loading branch information
Simyon264 committed Apr 29, 2024
1 parent 28071fe commit eccf286
Showing 1 changed file with 37 additions and 45 deletions.
82 changes: 37 additions & 45 deletions Client/Components/Pages/Player.razor
Original file line number Diff line number Diff line change
@@ -1,59 +1,51 @@
@page "/player/{guid}"
@using System.ComponentModel
@using Humanizer
@using Shared
@inject HttpClient Http
@inject NavigationManager NavigationManager
@attribute [StreamRendering]

<PageTitle>Player info</PageTitle>

@if (playerData is null)
{
<p>Loading...</p>
}
else
{
<h1>@playerData.PlayerData.Username</h1>

<p><b>Total estimated playtime:</b> @playerData.TotalEstimatedPlaytime.Humanize()</p>
<p><small>Calculated by adding up the total time for each round played by the player.</small></p>
<p><b>Total rounds played:</b> @playerData.TotalRoundsPlayed</p>
<p><b>Total antag rounds played:</b> @playerData.TotalAntagRoundsPlayed</p>
<p><b>Last seen:</b> @playerData.LastSeen.Humanize()</p>

<h2>Characters</h2>
<table class="table">
<thead>
<tr>
<th>Character Name</th>
<th>Times played</th>
<th>Last played</th>
</tr>
</thead>
<tbody>
@foreach (var character in playerData.Characters)
<h1>@playerData.PlayerData.Username</h1>

<p><b>Total estimated playtime:</b> @playerData.TotalEstimatedPlaytime.Humanize()</p>
<p><small>Calculated by adding up the total time for each round played by the player.</small></p>
<p><b>Total rounds played:</b> @playerData.TotalRoundsPlayed</p>
<p><b>Total antag rounds played:</b> @playerData.TotalAntagRoundsPlayed</p>
<p><b>Last seen:</b> @playerData.LastSeen.Humanize()</p>

<h2>Characters</h2>
<table class="table">
<thead>
<tr>
<th>Character Name</th>
<th>Times played</th>
<th>Last played</th>
</tr>
</thead>
<tbody>
@foreach (var character in playerData.Characters)
{
if (character.CharacterName == "Unknown")
{
if (character.CharacterName == "Unknown")
{
continue;
}

// If this character contains a paranthesis, it's likely a ghost role like mouse (253), so we'll skip it.
if (character.CharacterName.Contains("("))
{
continue;
}

<tr>
<td>@character.CharacterName</td>
<td>@character.RoundsPlayed</td>
<td>@character.LastPlayed.Humanize()</td>
</tr>
continue;
}
</tbody>
</table>
}

// If this character contains a paranthesis, it's likely a ghost role like mouse (253), so we'll skip it.
if (character.CharacterName.Contains("("))
{
continue;
}

<tr>
<td>@character.CharacterName</td>
<td>@character.RoundsPlayed</td>
<td>@character.LastPlayed.Humanize()</td>
</tr>
}
</tbody>
</table>

@code{
[Parameter] public string Guid { get; set; } = string.Empty;
Expand Down

0 comments on commit eccf286

Please sign in to comment.