2025-05-25 18:35:01 +02:00
|
|
|
@using LANCommander.Launcher.Data.Models
|
2025-11-29 18:24:27 -06:00
|
|
|
@using LANCommander.SDK.Enums
|
2025-12-31 20:01:04 -06:00
|
|
|
@namespace LANCommander.Launcher.UI
|
2025-05-25 18:35:01 +02:00
|
|
|
@inherits FeedbackComponent<Models.ListItem, string>
|
|
|
|
|
@inject LibraryService LibraryService
|
|
|
|
|
@inject IMessageService MessageService
|
|
|
|
|
@inject ILogger<RemoveFromLibraryDialog> Logger
|
Add localization support to launcher
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.
2025-08-18 21:29:38 -05:00
|
|
|
@inject LocalizationService LocalizationService
|
2025-05-25 18:35:01 +02:00
|
|
|
|
|
|
|
|
<div class="remove-from-library-dialog" style="padding: 16px;">
|
|
|
|
|
<div class="game-item">
|
|
|
|
|
<div class="icon">
|
|
|
|
|
<MediaImage Id="@Options.IconId" />
|
|
|
|
|
</div>
|
Add localization support to launcher
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.
2025-08-18 21:29:38 -05:00
|
|
|
<span class="title-pre">@LocalizationService.GetString("BaseGame")</span>
|
2025-05-25 18:35:01 +02:00
|
|
|
<span class="title">@Options.Name</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
@if (DependentGames.Any())
|
|
|
|
|
{
|
Add localization support to launcher
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.
2025-08-18 21:29:38 -05:00
|
|
|
<Divider Text="@LocalizationService.GetString("AddonsToRemove")" Orientation="DividerOrientation.Left" Plain />
|
2025-05-25 18:35:01 +02:00
|
|
|
|
|
|
|
|
<CheckboxButtonGroup @bind-Selected="SelectedDependentGames" DataSource="DependentGames"
|
|
|
|
|
KeySelector="a => a.Id"
|
|
|
|
|
LabelSelector="a => a.Title"
|
|
|
|
|
Direction="SpaceDirection.Vertical"
|
|
|
|
|
IconSelected="@IconType.Outline.Close"
|
|
|
|
|
IconUnselected="@IconType.Fill.Pushpin"
|
|
|
|
|
ButtonPropsSelected="@(new[] { ("Danger", (object)true) })"
|
2025-11-29 18:24:27 -06:00
|
|
|
DisableSelector="g => g.Type == GameType.Mod || g.Type == GameType.Expansion"
|
2025-05-25 18:35:01 +02:00
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<Flex Gap="FlexGap.Middle" Style="padding: 16px; padding-top: 0px" Justify="FlexJustify.FlexEnd">
|
Add localization support to launcher
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.
2025-08-18 21:29:38 -05:00
|
|
|
<Button Type="ButtonType.Primary" OnClick="RemoveFromLibrary">@LocalizationService.GetString("Remove")</Button>
|
|
|
|
|
<Button OnClick="() => Close()">@LocalizationService.GetString("Close")</Button>
|
2025-05-25 18:35:01 +02:00
|
|
|
</Flex>
|
|
|
|
|
|
|
|
|
|
@code {
|
|
|
|
|
Data.Models.Game? Game;
|
|
|
|
|
List<Data.Models.Game> DependentGames = new();
|
|
|
|
|
|
|
|
|
|
IEnumerable<Data.Models.Game> SelectedDependentGames = [];
|
|
|
|
|
|
|
|
|
|
protected override void OnInitialized()
|
|
|
|
|
{
|
|
|
|
|
base.OnInitialized();
|
|
|
|
|
|
|
|
|
|
Game = (Game)Options.DataItem;
|
|
|
|
|
DependentGames = Game?.DependentGames.OrderBy(g => g.SortTitle ?? g.Title).ToList() ?? [];
|
|
|
|
|
|
2025-11-29 18:24:27 -06:00
|
|
|
SelectedDependentGames = DependentGames?.Where(g => g.Type == GameType.Expansion || g.Type == GameType.Mod) ?? [];
|
2025-05-25 18:35:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task Close()
|
|
|
|
|
{
|
|
|
|
|
await CloseFeedbackAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async Task RemoveFromLibrary()
|
|
|
|
|
{
|
|
|
|
|
if (Options.DataItem is Game game)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var addonIds = SelectedDependentGames?.Select(a => a.Id).ToArray() ?? [];
|
|
|
|
|
|
|
|
|
|
await LibraryService.RemoveFromLibraryAsync(game!.Id, addonIds);
|
|
|
|
|
await LibraryService.RefreshItemsAsync(true);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
Add localization support to launcher
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.
2025-08-18 21:29:38 -05:00
|
|
|
MessageService.Error(LocalizationService.GetString("CouldNotRemoveGame"));
|
2025-05-25 18:35:01 +02:00
|
|
|
Logger?.LogError(ex, "Could not remove game {GameTitle}", game.Title);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await CloseFeedbackAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|