diff --git a/src/App.tsx b/src/App.tsx index 3482b42..299155d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -142,7 +142,11 @@ const App = ({ ui, navigation, tuneData }: { ui: UIState, navigation: Navigation return ( <> - + 0} + hasToothLogs={tuneData && (tuneData.toothLogFiles || []).length > 0} + /> } />} /> } />} /> diff --git a/src/components/TopBar.tsx b/src/components/TopBar.tsx index bfca012..23bda9a 100644 --- a/src/components/TopBar.tsx +++ b/src/components/TopBar.tsx @@ -57,7 +57,7 @@ const { Header } = Layout; const { useBreakpoint } = Grid; const { SubMenu } = Menu; -const TopBar = ({ tuneId }: { tuneId: string | null }) => { +const TopBar = ({ tuneId, hasLogs, hasToothLogs }: { tuneId: string | null; hasLogs: boolean; hasToothLogs: boolean }) => { const { xs, sm, lg } = useBreakpoint(); const { pathname } = useLocation(); const { currentUser, logout } = useAuth(); @@ -119,13 +119,13 @@ const TopBar = ({ tuneId }: { tuneId: string | null }) => { {lg && 'Tune'} - + {lg && 'Logs'} - + {lg && 'Diagnose'} @@ -133,7 +133,7 @@ const TopBar = ({ tuneId }: { tuneId: string | null }) => { - ), [pathname, tuneTuneMatch?.pathnameBase, tabMatch?.pathname, tuneRootMatch?.pathname, hubPathMatch?.pathname, tuneLogMatch?.pathnameBase, buildTuneUrl, lg, navigate]); + ), [pathname, tuneLogMatch?.pathnameBase, tuneTuneMatch?.pathnameBase, tabMatch?.pathname, tuneRootMatch?.pathname, hubPathMatch?.pathname, buildTuneUrl, lg, hasLogs, hasToothLogs, navigate]); const rightMenuColProps = tuneId ? { span: 8, diff --git a/src/pages/Logs.tsx b/src/pages/Logs.tsx index d80625a..eb8a32e 100644 --- a/src/pages/Logs.tsx +++ b/src/pages/Logs.tsx @@ -218,6 +218,13 @@ const Logs = ({ } }; + // user didn't upload any logs + if (tuneData && (tuneData.logFiles || []).length === 0) { + navigate(Routes.HUB); + + return undefined; + } + // user navigated to logs root page if (!routeMatch?.params.fileName && tuneData.logFiles?.length) { // either redirect to the first log or to the latest selected