1
0
mirror of synced 2024-11-24 06:50:15 +01:00

Fixed some text display stuff

Don't break Access codes into groups of 4 if they aren't a multiple of 4 or if they aren't hexadecimal only (This is useful if a user only uses a nickname as an access code and not a card id)

Changed color of is-current-user on the leaderboard so text is legible in dark mode.

Made Leaderboard useable on mobile as well by removing responsive breakpoints.
This commit is contained in:
Farewell_ 2024-08-09 15:46:55 +02:00
parent 00791f3cae
commit ce3795bb50
5 changed files with 25 additions and 6 deletions

View File

@ -45,7 +45,7 @@
} }
else else
{ {
<MudTable RowClassFunc="@GetActiveRowClass" Loading="isLoading" Items="@LeaderboardScores" Class="leaderboard-table" Elevation="0" Outlined="false" Dense="true" Striped="true"> <MudTable RowClassFunc="@GetActiveRowClass" Loading="isLoading" Items="@LeaderboardScores" Class="leaderboard-table" Elevation="0" Outlined="false" Dense="true" Striped="true" Breakpoint=Breakpoint.None>
<HeaderContent> <HeaderContent>
<MudTh>@Localizer["Rank"]</MudTh> <MudTh>@Localizer["Rank"]</MudTh>
<MudTh>@Localizer["Player"]</MudTh> <MudTh>@Localizer["Player"]</MudTh>

View File

@ -90,10 +90,17 @@
<MudText Style="font-family:monospace;overflow:hidden;overflow-x:scroll"> <MudText Style="font-family:monospace;overflow:hidden;overflow-x:scroll">
@if (User.AccessCodes.Count > 0) @if (User.AccessCodes.Count > 0)
{ {
@foreach (var digitGroup in StringUtil.SplitIntoGroups(User.AccessCodes[0], 4)) @if (User.AccessCodes[0].Length % 4 == 0 && StringUtil.OnlyHexInString(User.AccessCodes[0]))
{
foreach (var digitGroup in StringUtil.SplitIntoGroups(User.AccessCodes[0], 4))
{ {
<span class="mr-2">@digitGroup</span> <span class="mr-2">@digitGroup</span>
} }
}
else
{
<span class="mr-2">@User.AccessCodes[0]</span>
}
} else } else
{ {
<span class="mr-2">@Localizer["N/A"]</span> <span class="mr-2">@Localizer["N/A"]</span>

View File

@ -54,10 +54,17 @@
<MudGrid Spacing="2" Class="d-flex align-center"> <MudGrid Spacing="2" Class="d-flex align-center">
<MudItem xs="12" md="8" Class="d-flex align-center"> <MudItem xs="12" md="8" Class="d-flex align-center">
<pre class="mb-0" style="font-size:16px"> <pre class="mb-0" style="font-size:16px">
@foreach (var digitGroup in StringUtil.SplitIntoGroups(accessCode, 4)) @if (accessCode.Length % 4 == 0 && StringUtil.OnlyHexInString(accessCode))
{
foreach (var digitGroup in StringUtil.SplitIntoGroups(accessCode, 4))
{ {
<span class="mr-2">@digitGroup</span> <span class="mr-2">@digitGroup</span>
} }
}
else
{
<span class="mr-2">@accessCode</span>
}
</pre> </pre>
</MudItem> </MudItem>
<MudItem xs="12" md="4" Class="d-flex justify-end"> <MudItem xs="12" md="4" Class="d-flex justify-end">

View File

@ -16,5 +16,10 @@
} }
return groups; return groups;
} }
public bool OnlyHexInString(string test)
{
return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z");
}
} }
} }

View File

@ -56,7 +56,7 @@
} }
tr.is-current-user { tr.is-current-user {
background-color: #d6e5f8 !important; background-color: #8c9eff75 !important
} }
tr.is-current-user td, tr.is-current-user td,