Browse Source

fix media card selection (#1840)

pull/1842/head
Jason Dove 1 year ago committed by GitHub
parent
commit
8dc1cab222
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      ErsatzTV/Shared/MediaCard.razor

17
ErsatzTV/Shared/MediaCard.razor

@ -1,6 +1,7 @@
@using ErsatzTV.Application.MediaCards @using ErsatzTV.Application.MediaCards
@using static Prelude @using static Prelude
@inject IMediator Mediator @inject IMediator Mediator
@inject NavigationManager NavigationManager
<div class="@((ContainerClass ?? "media-card-container mr-6") + " pb-3")" id="@($"item_{Data.MediaItemId}")"> <div class="@((ContainerClass ?? "media-card-container mr-6") + " pb-3")" id="@($"item_{Data.MediaItemId}")">
@if (SelectClicked.HasDelegate || !string.IsNullOrWhiteSpace(Href)) @if (SelectClicked.HasDelegate || !string.IsNullOrWhiteSpace(Href))
@ -36,9 +37,8 @@
</div> </div>
} }
<div class="media-card-overlay" style=""> <div class="media-card-overlay" style="">
<MudButton Href="@(IsSelectMode ? null : Href)" <MudButton Style="height: 100%; width: 100%"
Style="height: 100%; width: 100%" OnClick="OnOverlayClick">
OnClick="@(e => IsSelectMode || string.IsNullOrWhiteSpace(Href) ? SelectClicked.InvokeAsync(e) : Task.CompletedTask)">
</MudButton> </MudButton>
@if (SelectClicked.HasDelegate) @if (SelectClicked.HasDelegate)
{ {
@ -162,4 +162,15 @@
_ => "posters" _ => "posters"
}; };
private void OnOverlayClick(MouseEventArgs e)
{
if (IsSelectMode || string.IsNullOrWhiteSpace(Href))
{
SelectClicked.InvokeAsync(e);
}
else
{
NavigationManager.NavigateTo(Href);
}
}
} }
Loading…
Cancel
Save