From 51cf0fbd17d70b756a3b6d4bff4e4caa1b84c932 Mon Sep 17 00:00:00 2001 From: estifanos Date: Sat, 15 Aug 2026 07:02:37 +0000 Subject: [PATCH] UI landing page route fix --- apps/backoffice/src/app/router/LandingRoute.tsx | 10 +++++++--- apps/portal/src/app/components/LandingRoute.tsx | 12 +++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/apps/backoffice/src/app/router/LandingRoute.tsx b/apps/backoffice/src/app/router/LandingRoute.tsx index c353e91d5..b03e67f8b 100644 --- a/apps/backoffice/src/app/router/LandingRoute.tsx +++ b/apps/backoffice/src/app/router/LandingRoute.tsx @@ -1,12 +1,16 @@ +import { Navigate } from 'react-router-dom'; import { LandingPage } from '@ema-platform/ui'; import { useAuthToken } from '@ema-platform/auth'; /** - * Public `/` — mounts the shared landing page. Backoffice has no /signup - * (enableSignup: false) and no /verify route, so those props are omitted. + * Public `/`. Signed-in visitors skip the landing page entirely and go + * straight to the dashboard. Backoffice has no /signup (enableSignup: false) + * and no /verify route, so those props are omitted. */ export function LandingRoute() { const token = useAuthToken(); - return ; + if (token) return ; + + return ; } diff --git a/apps/portal/src/app/components/LandingRoute.tsx b/apps/portal/src/app/components/LandingRoute.tsx index 8bab1d394..1d5b82bdc 100644 --- a/apps/portal/src/app/components/LandingRoute.tsx +++ b/apps/portal/src/app/components/LandingRoute.tsx @@ -1,14 +1,16 @@ +import { Navigate } from 'react-router-dom'; import { LandingPage } from '@ema-platform/ui'; import { useAuthToken } from '@ema-platform/auth'; /** - * Public `/` — mounts the shared landing page with portal-specific routes. - * Auth state is read via `useAuthToken`, the same hook ProtectedRoute uses, - * so the header can show "Go to dashboard" instead of Login/Sign Up without - * gating the route itself. + * Public `/`. Signed-in visitors skip the landing page entirely and go + * straight to the dashboard — the landing page is a front door for people + * who aren't in yet, not a screen for people who already are. */ export function LandingRoute() { const token = useAuthToken(); - return ; + if (token) return ; + + return ; }