From be6ebe59f3c40255955479c94b5120d17f109564 Mon Sep 17 00:00:00 2001 From: Kartik Gupta Date: Mon, 17 Jul 2023 19:43:12 +0530 Subject: [PATCH 1/3] minor fix --- src/components/Navbar/index.tsx | 35 ++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/components/Navbar/index.tsx b/src/components/Navbar/index.tsx index 77b869a6..cf253ce6 100644 --- a/src/components/Navbar/index.tsx +++ b/src/components/Navbar/index.tsx @@ -1,6 +1,6 @@ import type { NavbarProps as MantineNavbarProps } from '@mantine/core'; -import { Navbar as MantineNavbar, NavLink, Select ,Anchor,Card, Box, Modal ,Text ,Image} from '@mantine/core'; -import { IconNews, IconCodeCircle2, IconCheck, IconFileAlert, IconReload, IconHelpCircle, IconLogout, IconUser } from '@tabler/icons-react'; +import { Navbar as MantineNavbar, NavLink, Select, Anchor, Card, Box, Modal, Text, Image } from '@mantine/core'; +import { IconNews, IconCodeCircle2, IconCheck, IconFileAlert, IconReload, IconHelpCircle, IconLogout, IconUser } from '@tabler/icons-react'; import { FC, useEffect, useState } from 'react'; import docImage from '@/assets/images/doc.webp'; import githubLogo from '@/assets/images/github-logo.webp'; @@ -32,8 +32,8 @@ const Navbar: FC = (props) => { const [searchValue, setSearchValue] = useState(""); const { classes } = useNavbarStyles(); const { container, linkBtnActive, linkBtn, - selectStreambtn ,streamsBtn ,lowerContainer , - actionBtn, helpTitle, helpDescription ,userBtn} = classes; + selectStreambtn, streamsBtn, lowerContainer, + actionBtn, helpTitle, helpDescription, userBtn } = classes; const { streamName } = useParams(); const nav = useNavigate(); const [, , removeCredentials] = useLocalStorage({ key: 'credentials' }); @@ -70,20 +70,19 @@ const Navbar: FC = (props) => { if (streamName) { setActiveStream(streamName); setSearchValue(streamName); - if (streamName !== subLogQuery.get().streamName) { - const now = dayjs(); - subLogQuery.set((state) => { - state.streamName = streamName || ''; - state.startTime = now.subtract(DEFAULT_FIXED_DURATIONS.milliseconds, 'milliseconds').toDate(); - state.endTime = now.toDate(); - }); - subLogSelectedTimeRange.set(DEFAULT_FIXED_DURATIONS.name); - } + const now = dayjs(); + subLogQuery.set((state) => { + state.streamName = streamName || ''; + state.startTime = now.subtract(DEFAULT_FIXED_DURATIONS.milliseconds, 'milliseconds').toDate(); + state.endTime = now.toDate(); + }); + subLogSelectedTimeRange.set(DEFAULT_FIXED_DURATIONS.name); + subRefreshInterval.set(null); } else if (streams && Boolean(streams.length)) { navigate(`/${streams[0].name}/logs`); } - }, [streams ,location]); + }, [streams, location]); const handleChange = (value: string) => { setActiveStream(value); @@ -142,12 +141,12 @@ const Navbar: FC = (props) => { return ( -