@* ReSharper disable once RedundantUsingDirective *@
@using Iceshrimp.Frontend.Components.Note
@using Iceshrimp.Shared.Schemas.Web
@inject NavigationManager Navigation
@if (Note.Filtered is { Hide: true }) { }
else
{
    <div class="note-container" id="@Note.Id">
        @if (Note.Reply is not null)
        {
            <div class="ancestor-wrapper" @onclick="() => OpenNote(Note.Reply.Id)">
                <div class="note-indent">
                    <UserAvatar User="@Note.Reply.User"/>
                    <Line></Line>
                </div>
                <div class="note">
                    <NoteComponent Note="Note.Reply" Indented="true"/>
                </div>
            </div>
        }
        <div class="link-wrapper" @onclick="() => OpenNote(Note.RenoteId ?? Note.Id)">
            <Note NoteResponse="Note"/>
        </div>
    </div>
}

@code {
    [Parameter] [EditorRequired] public required NoteResponse Note { get; set; }

    private void OpenNote(string id)
    {
        Navigation.NavigateTo($"/notes/{id}");
    }
}