@using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Localization @using Iceshrimp.Shared.Schemas.Web @using Microsoft.Extensions.Localization @inject IStringLocalizer Loc; @inject IJSRuntime Js;
@if (Attachment.ContentType.StartsWith("image")) { @Attachment.AltText } // else if (Attachment.ContentType == "audio/x-mod") // { // TODO: Module player // } else if (Attachment.ContentType.StartsWith("audio")) { } else if (Attachment.ContentType.StartsWith("video")) { } else { } @if (!string.IsNullOrWhiteSpace(Attachment.AltText)) { } else { }
@code { [Parameter] [EditorRequired] public required NoteAttachment Attachment { get; set; } [Parameter] [EditorRequired] public required EventCallback OnOpen { get; set; } private bool BlurImage { get; set; } private void Open() { if (BlurImage) { BlurImage = false; StateHasChanged(); } else if (Attachment.ContentType.StartsWith("image")) { OnOpen.InvokeAsync(Attachment); } } protected override void OnParametersSet() { BlurImage = Attachment.IsSensitive; } private async Task DisplayAlt() { await Js.InvokeVoidAsync("alert", string.IsNullOrWhiteSpace(Attachment.AltText) ? Loc["No alt text"] : Attachment.AltText); } }