From 8eb8ff510053aa32b4ec197a851d68579ad18cc8 Mon Sep 17 00:00:00 2001 From: rrrockey Date: Thu, 5 Mar 2026 19:56:01 -0600 Subject: [PATCH 1/2] fix: redirect employee to tasks page and remove home page --- .../Components/Layout/Home.razor | 8 +- .../Components/Layout/NavMenu.razor | 75 ++++++++----------- .../Components/Pages/PostLogin.razor | 8 +- 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/CulinaryCommandApp/Components/Layout/Home.razor b/CulinaryCommandApp/Components/Layout/Home.razor index f14e477..45089f5 100644 --- a/CulinaryCommandApp/Components/Layout/Home.razor +++ b/CulinaryCommandApp/Components/Layout/Home.razor @@ -231,7 +231,13 @@ var ctx = await UserCtx.GetAsync(); if (ctx.User?.Id != null) { - Nav.NavigateTo("/dashboard", forceLoad: true); + if (ctx.User?.Role == "Employee") { + Nav.NavigateTo("/tasks"); + } + else { + Console.WriteLine("DEBUG: dashboard nav. Role: " + ctx.User?.Role); + Nav.NavigateTo("/dashboard", forceLoad: true); + } } } } diff --git a/CulinaryCommandApp/Components/Layout/NavMenu.razor b/CulinaryCommandApp/Components/Layout/NavMenu.razor index 399dd38..0b05486 100644 --- a/CulinaryCommandApp/Components/Layout/NavMenu.razor +++ b/CulinaryCommandApp/Components/Layout/NavMenu.razor @@ -20,80 +20,67 @@ - } + @* all users have access for now *@ + diff --git a/CulinaryCommandApp/Components/Pages/PostLogin.razor b/CulinaryCommandApp/Components/Pages/PostLogin.razor index c438889..539d719 100644 --- a/CulinaryCommandApp/Components/Pages/PostLogin.razor +++ b/CulinaryCommandApp/Components/Pages/PostLogin.razor @@ -62,7 +62,13 @@ // JS-safe now (we're in OnAfterRender) await LocationState.SetLocationsAsync(ctx.AccessibleLocations); - var target = (ctx.AccessibleLocations?.Any() == true) ? "/dashboard" : "/onboarding"; + var target = (ctx.AccessibleLocations?.Any() == false) ? "/onboarding" : "/dashboard"; + if (target == "/dashboard") { + if (ctx.User?.Role == "Employee") { + target = "/tasks"; + } + } + status = $"Redirecting to {target}…"; StateHasChanged(); From dbc6fe2b3134e7643aaf48cc71c745391bae606e Mon Sep 17 00:00:00 2001 From: rrrockey Date: Thu, 5 Mar 2026 20:02:35 -0600 Subject: [PATCH 2/2] chore: remove old employee dashboard --- .../Components/Pages/EmployeeView.razor | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 CulinaryCommandApp/Components/Pages/EmployeeView.razor diff --git a/CulinaryCommandApp/Components/Pages/EmployeeView.razor b/CulinaryCommandApp/Components/Pages/EmployeeView.razor deleted file mode 100644 index 4de9701..0000000 --- a/CulinaryCommandApp/Components/Pages/EmployeeView.razor +++ /dev/null @@ -1,35 +0,0 @@ -@rendermode InteractiveServer -@implements IDisposable -
-

Employee Dashboard

-

Welcome,

- -
    -
  • View your active tasks and prep items
  • -
  • Check your assigned location:
  • -
  • Submit updates to your manager
  • -
-
- -@code { - [Inject] private CulinaryCommand.Services.LocationState LocationState { get; set; } = default!; - - private async void HandleLocationStateChanged() - { - await InvokeAsync(async () => - { - StateHasChanged(); - }); - } - - protected override void OnInitialized() - { - // Subscribe to the change event - LocationState.OnChange += HandleLocationStateChanged; - } - - public void Dispose() - { - LocationState.OnChange -= HandleLocationStateChanged; - } -}