Close open avanced filter
Some checks failed
Game Ideas build for PR / build_test (pull_request) Failing after 35s

This commit is contained in:
2025-05-18 15:59:58 +02:00
parent 6794dedf4f
commit fd3d0c347d
6 changed files with 33 additions and 7 deletions

View File

@@ -22,7 +22,7 @@ public partial class GameDetail : GameBaseComponent
private void HandleSubmitNewGame() private void HandleSubmitNewGame()
{ {
NavigationManager.NavigateTo("/"); NavigationManager.NavigateTo("/Games");
} }
private async Task FetchGameDetail() private async Task FetchGameDetail()

View File

@@ -4,6 +4,8 @@
@using GameIdeas.BlazorApp.Shared.Constants @using GameIdeas.BlazorApp.Shared.Constants
@using GameIdeas.Shared.Dto @using GameIdeas.Shared.Dto
<NavigationLock OnBeforeInternalNavigation="HandleLocationChanged" />
<div class="advanced-filter-container" style="@(ExpandedFilter ? "display: flex" : "")"> <div class="advanced-filter-container" style="@(ExpandedFilter ? "display: flex" : "")">
<span class="title">@ResourcesKey.Filters</span> <span class="title">@ResourcesKey.Filters</span>
@@ -33,9 +35,9 @@
<span class="title">@ResourcesKey.LastAdd</span> <span class="title">@ResourcesKey.LastAdd</span>
</div> </div>
<button type="button" class="open-filter" @onclick=HandleExpandFilter> <button type="button" class="open-filter" @onclick=HandleExpandFilterAsync>
@Icons.Filter @Icons.Filter
</button> </button>
<BackdropFilter @ref="BackdropFilter" OnClick="HandleBackdropFilterClicked" CloseOnClick="true" <BackdropFilter @ref="BackdropFilter" OnClick="HandleBackdropFilterClickedAsync" CloseOnClick="true"
AllowBodyScroll="false" Color="BackdropFilterColor.Overlay" /> AllowBodyScroll="false" Color="BackdropFilterColor.Overlay" />

View File

@@ -4,6 +4,7 @@ using GameIdeas.BlazorApp.Shared.Components.Select.Models;
using GameIdeas.Resources; using GameIdeas.Resources;
using GameIdeas.Shared.Dto; using GameIdeas.Shared.Dto;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Routing;
namespace GameIdeas.BlazorApp.Pages.Games.Filter; namespace GameIdeas.BlazorApp.Pages.Games.Filter;
@@ -48,13 +49,26 @@ public partial class AdvancedGameFilter
throw new ArgumentNullException(ResourcesKey.ErrorStorageSpaceLabel); throw new ArgumentNullException(ResourcesKey.ErrorStorageSpaceLabel);
} }
private void HandleExpandFilter(Microsoft.AspNetCore.Components.Web.MouseEventArgs args) private async Task HandleExpandFilterAsync(Microsoft.AspNetCore.Components.Web.MouseEventArgs args)
{ {
ExpandedFilter = true; ExpandedFilter = true;
await ExpandedFilterChanged.InvokeAsync(ExpandedFilter);
BackdropFilter?.Show(); BackdropFilter?.Show();
} }
private void HandleBackdropFilterClicked()
private async Task HandleBackdropFilterClickedAsync()
{ {
ExpandedFilter = false; ExpandedFilter = false;
await ExpandedFilterChanged.InvokeAsync(ExpandedFilter);
}
private void HandleLocationChanged(LocationChangingContext locationContext)
{
if (ExpandedFilter)
{
ExpandedFilter = false;
BackdropFilter?.Hide();
locationContext.PreventNavigation();
}
} }
} }

View File

@@ -1,4 +1,4 @@
@page "/" @page "/Games"
@using GameIdeas.BlazorApp.Pages.Games.Components @using GameIdeas.BlazorApp.Pages.Games.Components
@using GameIdeas.BlazorApp.Pages.Games.Filter @using GameIdeas.BlazorApp.Pages.Games.Filter
@using GameIdeas.BlazorApp.Shared.Components @using GameIdeas.BlazorApp.Shared.Components

View File

@@ -0,0 +1,10 @@
@page "/"
@inject NavigationManager navigationManager
@code {
protected override void OnInitialized()
{
navigationManager.NavigateTo("/Games");
}
}

View File

@@ -14,7 +14,7 @@ public partial class UserMenu
{ {
ContentVisile = false; ContentVisile = false;
await AuthGateway.Logout(); await AuthGateway.Logout();
NavigationManager.NavigateTo("/"); NavigationManager.NavigateTo("/Games");
} }
private void HandleAccountClicked() private void HandleAccountClicked()