- Move all Launcher components to LANCommander.Launcher.UI namespace - Move all SCSS files next to components (when possible) - Refactor styles that control overflow of content into titlebar to MainWindow only - Remove use in launcher UI of SDK.Client
73 lines
No EOL
2.6 KiB
Text
73 lines
No EOL
2.6 KiB
Text
@using LANCommander.Launcher.Data.Models
|
|
@namespace LANCommander.Launcher.UI
|
|
@inject GameClient GameClient
|
|
@inject ILogger<GameDetails> Logger
|
|
|
|
<CascadingValue Value="CurrentGame">
|
|
<CascadingValue Value="RemoteGame">
|
|
<div class="game-details no-scrollbar">
|
|
@if (CurrentGame != null)
|
|
{
|
|
<div class="game-hero">
|
|
@if (CurrentGame.Media.Any(m => m.Type == SDK.Enums.MediaType.Logo))
|
|
{
|
|
<MediaImage Id="@(CurrentGame.Media.First(m => m.Type == SDK.Enums.MediaType.Logo).Id)" Key="GameDetailsLogo" Class="game-details-logo"/>
|
|
}
|
|
else
|
|
{
|
|
<h1>@CurrentGame.Title</h1>
|
|
}
|
|
|
|
@if (CurrentGame.Media.Any(m => m.Type == SDK.Enums.MediaType.Background))
|
|
{
|
|
<MediaImage Id="@(CurrentGame.Media.First(m => m.Type == SDK.Enums.MediaType.Background).Id)" Key="GameDetailsBackground" Class="game-details-background"/>
|
|
}
|
|
</div>
|
|
<GridRow Gutter="32" Class="game-info" Wrap="false">
|
|
<GridCol Flex="@("auto")">
|
|
<GameActionBar/>
|
|
<GameMetadata/>
|
|
</GridCol>
|
|
|
|
<GridCol Flex="@("256px")" Class="game-cover">
|
|
@if (CurrentGame.Media.Any(m => m.Type == SDK.Enums.MediaType.Cover))
|
|
{
|
|
<MediaImage Key="GameDetailsCover" Id="@(CurrentGame.Media.First(m => m.Type == SDK.Enums.MediaType.Cover).Id)"/>
|
|
}
|
|
</GridCol>
|
|
</GridRow>
|
|
}
|
|
</div>
|
|
</CascadingValue>
|
|
</CascadingValue>
|
|
|
|
@code {
|
|
[CascadingParameter] public required Models.ListItem CurrentItem { get; set; }
|
|
|
|
Guid _currentId { get; set; }
|
|
|
|
Game? CurrentGame { get; set; }
|
|
SDK.Models.Game? RemoteGame { get; set; }
|
|
|
|
protected override async Task OnParametersSetAsync()
|
|
{
|
|
if (CurrentItem.Key != _currentId)
|
|
{
|
|
// Selection has changed, either through list click or nav
|
|
_currentId = CurrentItem.Key;
|
|
CurrentGame = CurrentItem.DataItem as Game;
|
|
|
|
try
|
|
{
|
|
RemoteGame = await GameClient.GetAsync(_currentId);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Logger.LogError(ex, "Could not load game {GameId} from server", _currentId);
|
|
}
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
|
|
} |