@inherits Fluxor.Blazor.Web.Components.FluxorComponent @using Fluxor @using Koogle.Application.DTOs @using Koogle.Domain.Enums @using Koogle.Web.Store.GifState @inject IState GifState @inject IDispatcher Dispatcher @if (GifState.Value.IsPlaying && GifState.Value.CurrentGif != null) {
@if (IsVideo) { } else { @GifState.Value.CurrentGif.Name }
@GetEventDisplayName(GifState.Value.TriggerEvent) @GifState.Value.CurrentGif.Name
@if (ShowRating) {
}
} @code { private ElementReference _videoElement; [Parameter] public bool ShowRating { get; set; } = true; [Parameter] public Guid? UserProfileId { get; set; } private bool IsVideo => GifState.Value.CurrentGif?.ContentType.StartsWith("video/") ?? false; private void DismissGif() { Dispatcher.Dispatch(new EndGifPlaybackAction()); } private void RateGif(int value) { if (UserProfileId.HasValue && GifState.Value.CurrentGif != null) { Dispatcher.Dispatch(new RateCurrentGifAction(UserProfileId.Value, value)); } DismissGif(); } private static string GetEventDisplayName(ThrowEventType? eventType) => eventType switch { ThrowEventType.Strike => "ALLE NEUNE!", ThrowEventType.Circle => "KRANZ!", ThrowEventType.Bell => "GLOCKE!", ThrowEventType.Gutter => "RINNE!", ThrowEventType.NoWood => "KEIN HOLZ!", _ => "" }; }