Adds localization across the launcher and includes English, German, Spanish, French, Italian, Japanese, Korean, Dutch, Portuguese, Ukranian, and Chinese. These localizations were generated by Claude 3.5 and need to be reviewed by a human for accuracy.
88 lines
2.5 KiB
Text
88 lines
2.5 KiB
Text
@inject SDK.Client Client
|
|
@inject DepotService DepotService
|
|
@inject LocalizationService LocalizationService
|
|
|
|
<Spin Spinning="!Loaded" WrapperClassName="depot-list-spinner">
|
|
@if (ListItems.Any())
|
|
{
|
|
<div class="depot-list no-scrollbar">
|
|
@if (Groups.Count > 1)
|
|
{
|
|
@foreach (var group in Groups)
|
|
{
|
|
<div class="depot-list-group">
|
|
<Divider Text="@group" />
|
|
|
|
<div class="depot-list-group-items">
|
|
@foreach (var item in ListItems.Where(i => i.Groups.Contains(group) || (group == "Uncategorized" && i.Groups.Length == 0)))
|
|
{
|
|
<DepotGameItem Item="item" OnClick="OnItemSelected" />
|
|
}
|
|
</div>
|
|
</div>
|
|
}
|
|
}
|
|
else
|
|
{
|
|
<div class="depot-list-items">
|
|
@foreach (var item in ListItems)
|
|
{
|
|
<DepotGameItem Item="item" OnClick="OnItemSelected" />
|
|
}
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
else if (DepotService.GetItemCount() > 0)
|
|
{
|
|
<Result Title="@LocalizationService.GetString("NoResults")" />
|
|
}
|
|
else if (Loaded)
|
|
{
|
|
<Result
|
|
Status="ResultStatus.Error"
|
|
Title="@LocalizationService.GetString("NoResults")"
|
|
SubTitle="@LocalizationService.GetString("DepotEmptyOrUnauthorized")" />
|
|
}
|
|
</Spin>
|
|
|
|
@code {
|
|
[Parameter] public EventCallback<Models.ListItem> OnItemSelected { get; set; }
|
|
|
|
IEnumerable<Models.ListItem> ListItems { get; set; } = new List<Models.ListItem>();
|
|
|
|
List<string> Groups = new();
|
|
|
|
bool Loaded = false;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
base.OnInitialized();
|
|
|
|
DepotService.OnItemsFiltered += LoadFilteredItems;
|
|
}
|
|
|
|
async Task LoadFilteredItems(IEnumerable<Models.ListItem> listItems)
|
|
{
|
|
ListItems = listItems;
|
|
|
|
Loaded = true;
|
|
|
|
await UpdateGroups();
|
|
}
|
|
|
|
async Task UpdateGroups()
|
|
{
|
|
Groups = ListItems.DistinctBy(i => i.Key).SelectMany(i => i.Groups).Distinct().ToList();
|
|
|
|
if (ListItems.DistinctBy(i => i.Key).Any(i => i.Groups == null || i.Groups.Length == 0))
|
|
Groups.Add(LocalizationService.GetString("Uncategorized"));
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
DepotService.OnItemsFiltered -= LoadFilteredItems;
|
|
}
|
|
}
|