mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-24 22:24:24 +08:00
50 lines
1.0 KiB
TypeScript
50 lines
1.0 KiB
TypeScript
import { Col } from 'antd';
|
|
import ROUTES from 'constants/routes';
|
|
import history from 'lib/history';
|
|
import React from 'react';
|
|
import { matchPath } from 'react-router-dom';
|
|
|
|
import ShowBreadcrumbs from './Breadcrumbs';
|
|
import DateTimeSelector from './DateTimeSelection';
|
|
import { Container } from './styles';
|
|
|
|
const routesToSkip = [
|
|
ROUTES.SETTINGS,
|
|
ROUTES.LIST_ALL_ALERT,
|
|
ROUTES.TRACE_DETAIL,
|
|
ROUTES.ALL_CHANNELS,
|
|
];
|
|
|
|
function TopNav(): JSX.Element | null {
|
|
if (history.location.pathname === ROUTES.SIGN_UP) {
|
|
return null;
|
|
}
|
|
|
|
const checkRouteExists = (currentPath: string): boolean => {
|
|
for (let i = 0; i < routesToSkip.length; i += 1) {
|
|
if (
|
|
matchPath(currentPath, { path: routesToSkip[i], exact: true, strict: true })
|
|
) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
};
|
|
|
|
return (
|
|
<Container>
|
|
<Col span={16}>
|
|
<ShowBreadcrumbs />
|
|
</Col>
|
|
|
|
{!checkRouteExists(history.location.pathname) && (
|
|
<Col span={8}>
|
|
<DateTimeSelector />
|
|
</Col>
|
|
)}
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
export default TopNav;
|