Skip to content

Commit

Permalink
♻️ Fix UI side warnings (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hona authored Jul 3, 2024
1 parent fe4b163 commit b611976
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</FluentCard>

@code {
[Parameter]
public string Value { get; set; }
[Parameter, EditorRequired]
public required string Value { get; set; }

[Parameter]
public string Label { get; set; }
[Parameter, EditorRequired]
public required string Label { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

@code {

[Parameter]
public string Tier { get; set; }
[Parameter, EditorRequired]
public required string Tier { get; set; }

[Parameter]
public string Style { get; set; }
public string? Style { get; set; }

private string GetStyle()
private string? GetStyle()
{
if (Tier is "0")
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
NavigationManager.LocationChanged += HandleLocationChanged;
}

public void HandleLocationChanged(object sender, LocationChangedEventArgs e)
public void HandleLocationChanged(object? sender, LocationChangedEventArgs e)
{
JS.InvokeVoidAsync("collapseNavMenu");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<FluentButton Appearance="Appearance.Stealth" IconStart="new Icons.Filled.Size12.Dismiss()" OnClick="HandleOnClose"/>
</FluentStack>
<FluentAutocomplete TOption="OneOf<ServerPlayerModel, MapInfo>"
OptionValue="@(x => x.Match(x => x?.Id.ToString(), x=> x?.Name))"
OptionValue="@(x => x.Match(x => x?.Id.ToString(), x => x?.Name))"
Placeholder="Search everything"
OnOptionsSearch="HandleOptionsSearch"
SelectedOptionChanged="HandleSelectedOptionChanged"
Expand Down Expand Up @@ -73,9 +73,7 @@
}

private Timer? timer = null;

private FluentSearch? searchTest;


private string? searchValue = null;

private string? SearchValue
Expand Down Expand Up @@ -109,9 +107,7 @@
private List<OneOf<ServerPlayerModel, MapInfo>>? defaultResults => null;

private Dictionary<long, SteamProfile> _steamProfiles = new();

private bool _searchLoading;


private async void TimerElapsed_TickAsync(object? sender, EventArgs e)
{
DisposeTimer();
Expand All @@ -133,7 +129,6 @@
{
if (!string.IsNullOrWhiteSpace(SearchValue))
{
_searchLoading = true;
await InvokeAsync(StateHasChanged);

var results = await TempusClient.GetSearchResultAsync(SearchValue);
Expand All @@ -156,8 +151,6 @@
_steamProfiles = await TempusClient.GetSteamProfilesAsync(tempusPlayerIds);
}

_searchLoading = false;
}
else
{
Expand All @@ -172,7 +165,6 @@
await InvokeAsync(StateHasChanged);
}

_searchLoading = false;
if (_searchContext != null) _searchContext.Items = searchResults;
await InvokeAsync(StateHasChanged);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@
<FluentGridItem xs="12" sm="12" md="0">
<FluentStack Orientation="Orientation.Vertical" Style="margin-right: 1rem" Width="fit-content">
<h3>
@Map?.MapInfo.Name
@Map.MapInfo.Name
</h3>

<div>
<FluentStack HorizontalGap="2" Wrap>
<span style="padding-right: 0.125rem">Authored by</span>

@if (Map != null)
@foreach (var author in Map.Authors)
{
foreach (var author in Map.Authors)
{
<a href="/leaderboard/players/@author.PlayerInfo.Id">
@author.Name
</a>
}
<a href="/leaderboard/players/@author.PlayerInfo.Id">
@author.Name
</a>
}

</FluentStack>

@((DateTimeOffset.UtcNow - Map.MapInfo.DateAdded.ToDateTimeOffset()).Humanize(maxUnit: TimeUnit.Year)) old
Expand All @@ -50,7 +48,7 @@

@code
{
[Parameter] public FullMapOverview2? Map { get; set; }
[Parameter, EditorRequired] public required FullMapOverview2 Map { get; set; }

[Parameter] public Class Class { get; set; }
[Parameter] public EventCallback<Class> ClassChanged { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@

@code
{
[Parameter]
public List<RecordInfoShort> Runs { get; set; }
[Parameter, EditorRequired]
public required List<RecordInfoShort> Runs { get; set; }

[Parameter]
public Class Class { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
</div>
@code {
private List<Order> Orders { get; set; } = GetOrders();
private ApexChartOptions<Order> options;
private ApexChartOptions<Order> _options = null!;

protected override void OnInitialized()
{
options = new ApexChartOptions<Order>
_options = new ApexChartOptions<Order>
{
Chart = new Chart
{
Expand Down Expand Up @@ -87,8 +87,8 @@ public static List<Order> GetOrders()
public class Order
{
public Guid OrderId { get; set; } = Guid.NewGuid();
public string CustomerName { get; set; }
public string Country { get; set; }
public string? CustomerName { get; set; }
public string? Country { get; set; }
public DateTimeOffset OrderDate { get; set; }
public OrderType OrderType { get; set; }
public decimal GrossValue { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

@code
{
[Parameter]
public FullMapOverview2 Map { get; set; }
[Parameter, EditorRequired]
public required FullMapOverview2 Map { get; set; }

[Parameter] public SelectedZone? SelectedZone { get; set; } = new(ZoneType.Map, 1);
[Parameter] public EventCallback<SelectedZone?> SelectedZoneChanged { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@
</FluentOption>
}
@code {
[Parameter]
public List<ZoneInfo> Zones { get; set; }
[Parameter, EditorRequired]
public required List<ZoneInfo> Zones { get; set; }

[Parameter]
public FullMapOverview2 Map { get; set; }
[Parameter, EditorRequired]
public required FullMapOverview2 Map { get; set; }

[Parameter] public Class SelectedClass { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
@using TF2Jump.WebUI
@using TF2Jump.WebUI.Components
@using TempusApi
@using TF2Jump.WebUI.Client
@using TF2Jump.WebUI.Client.Components.Common
@using TF2Jump.WebUI.Utilities
@using OneOf
1 change: 0 additions & 1 deletion UI/src/TF2Jump.WebUI/TF2Jump.WebUI/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
@using TF2Jump.WebUI
@using TF2Jump.WebUI.Components
@using TempusApi
@using TF2Jump.WebUI.Client
@using TF2Jump.WebUI.Client.Components.Common
@using TF2Jump.WebUI.Client.Components.Layout
@using TF2Jump.WebUI.Utilities
Expand Down

0 comments on commit b611976

Please sign in to comment.