@using Iceshrimp.Assets.PhosphorIcons @using Iceshrimp.Frontend.Components @using Iceshrimp.Frontend.Localization @using Microsoft.Extensions.Localization @inject IStringLocalizer Loc; @implements IDisposable @inject NavigationManager Navigation;
@code { private Compose _compose = null!; private bool _open = false; private ElementReference SidebarElementRef { get; set; } private async void Open() { await _compose.OpenDialog(); } private void ToggleSidebar() { _open = !_open; StateHasChanged(); } private void Close() { _open = false; StateHasChanged(); } private void HandleLocationChanged(object? sender, LocationChangedEventArgs e) { _open = false; StateHasChanged(); } protected override async Task OnAfterRenderAsync(bool firstRender) { if (_open) await SidebarElementRef.FocusAsync(); } protected override void OnInitialized() { Navigation.LocationChanged += HandleLocationChanged; } public void Dispose() { Navigation.LocationChanged -= HandleLocationChanged; } }