diff --git a/Pages/Pages/Database/CatalogPage.razor b/Pages/Pages/Database/CatalogPage.razor index 4c2f319..4a5ffe6 100644 --- a/Pages/Pages/Database/CatalogPage.razor +++ b/Pages/Pages/Database/CatalogPage.razor @@ -6,7 +6,6 @@ @implements IDisposable @inject IEntityDisplayService EntityDisplayService -@inject NavigationManager NavigationManager Catalog @@ -32,7 +31,7 @@ @foreach (var entity in searches) { -
+
@entity.Info().Name @entity.EntityType.Replace("_", " ") @@ -113,6 +112,11 @@ +@if (selectedEntity != null) +{ + +} + + +@code { + + [Parameter] public EntityModel Entity { get; set; } = default!; + + [Parameter] public EventCallback OnClose { get; set; } + + List history = new(); + EntityModel Current => history.Count > 0 ? EntityModel.Get(history[^1]) : Entity; + + protected override void OnInitialized() + { + base.OnInitialized(); + if (Entity != null) + { + history.Add(Entity.DataType); + } + } + + async Task Close() + { + await OnClose.InvokeAsync(); + } + + void NavigateTo(string entityId) + { + if (EntityData.Get().ContainsKey(entityId)) + { + history.Add(entityId); + StateHasChanged(); + } + } + + void GoBack() + { + if (history.Count > 1) + { + history.RemoveAt(history.Count - 1); + StateHasChanged(); + } + } + +}