From 64c102413498b2d3de7ef64b3cddd1d9c9a424a2 Mon Sep 17 00:00:00 2001 From: kwasniew Date: Tue, 1 Oct 2024 11:56:54 +0200 Subject: [PATCH] feat: redirect to personal dashboard when no last project --- frontend/src/component/InitialRedirect.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/component/InitialRedirect.tsx b/frontend/src/component/InitialRedirect.tsx index 4377385f5261..553f69cb0746 100644 --- a/frontend/src/component/InitialRedirect.tsx +++ b/frontend/src/component/InitialRedirect.tsx @@ -4,8 +4,10 @@ import useProjects from '../hooks/api/getters/useProjects/useProjects'; import { useLastViewedProject } from '../hooks/useLastViewedProject'; import Loader from './common/Loader/Loader'; import { getSessionStorageItem, setSessionStorageItem } from '../utils/storage'; +import { useUiFlag } from '../hooks/useUiFlag'; export const InitialRedirect = () => { + const personalDashboardUiEnabled = useUiFlag('personalDashboardUI'); const { lastViewed } = useLastViewedProject(); const { projects, loading } = useProjects(); const navigate = useNavigate(); @@ -17,6 +19,10 @@ export const InitialRedirect = () => { return `/projects/${lastViewed}`; } + if (personalDashboardUiEnabled) { + return '/personal'; + } + if (projects && !lastViewed && projects.length === 1) { return `/projects/${projects[0].id}`; }