mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-29 08:04:10 +00:00
* feat: sidebar revamp - initial commit * feat: move billinga and other isolated routes to settings * feat: handle channel related routes * feat: update account settings page * feat: show dropdown for secondary items * feat: handle reordering of pinned nav items * feat: improve font load performance * feat: update font reference * feat: update page content styles * feat: handle external links in sidebar * feat: handle secondary nav item clicks * feat: handle pinned nav items reordering * feat: handle sidenav pinned state using preference, handle light mode * feat: show sidenav items conditionally * feat: show version diff indicator only to self hosted users * feat: show billing to admins only and integrations to cloud and enterprise users * feat: update fallback link * feat: handle settings menu items * fix: settings page reload on nav chnage * feat: intercom to pylon * feat: show invite user to admin only * feat: handle review comments * chore: remove react query dev tools * feat: minor ui updates * feat: update changes based on preference store changes * feat: handle sidenav shortcut state * feat: handle scroll for more * feat: maintain shortcuts order * feat: manage license ui updates * feat: manage settings options based on license and roles * feat: update types * chore: add logEvents * feat: update types * chore: fix type errors * chore: remove unused variable * feat: update my settings page test cases --------- Co-authored-by: makeavish <makeavish786@gmail.com>
71 lines
1.7 KiB
TypeScript
71 lines
1.7 KiB
TypeScript
import './NewExplorerCTA.styles.scss';
|
|
|
|
import { Badge, Button } from 'antd';
|
|
import ROUTES from 'constants/routes';
|
|
import history from 'lib/history';
|
|
import { Undo } from 'lucide-react';
|
|
import { useCallback, useMemo } from 'react';
|
|
import { useLocation } from 'react-router-dom';
|
|
|
|
import { buttonText, RIBBON_STYLES } from './config';
|
|
|
|
function NewExplorerCTA(): JSX.Element | null {
|
|
const location = useLocation();
|
|
|
|
const isTraceOrLogsExplorerPage = useMemo(
|
|
() =>
|
|
location.pathname === ROUTES.LOGS_EXPLORER ||
|
|
location.pathname === ROUTES.TRACE ||
|
|
location.pathname === ROUTES.OLD_LOGS_EXPLORER ||
|
|
location.pathname === ROUTES.TRACES_EXPLORER,
|
|
[location.pathname],
|
|
);
|
|
|
|
const onClickHandler = useCallback((): void => {
|
|
if (location.pathname === ROUTES.LOGS_EXPLORER) {
|
|
history.push(ROUTES.OLD_LOGS_EXPLORER);
|
|
} else if (location.pathname === ROUTES.TRACE) {
|
|
history.push(ROUTES.TRACES_EXPLORER);
|
|
} else if (location.pathname === ROUTES.OLD_LOGS_EXPLORER) {
|
|
history.push(ROUTES.LOGS_EXPLORER);
|
|
} else if (location.pathname === ROUTES.TRACES_EXPLORER) {
|
|
history.push(ROUTES.TRACE);
|
|
}
|
|
}, [location.pathname]);
|
|
|
|
const button = useMemo(
|
|
() => (
|
|
<Button
|
|
icon={<Undo size={16} />}
|
|
onClick={onClickHandler}
|
|
data-testid="newExplorerCTA"
|
|
type="text"
|
|
className="periscope-btn link"
|
|
>
|
|
{buttonText[location.pathname]}
|
|
</Button>
|
|
),
|
|
[location.pathname, onClickHandler],
|
|
);
|
|
|
|
if (!isTraceOrLogsExplorerPage) {
|
|
return null;
|
|
}
|
|
|
|
if (location.pathname === ROUTES.TRACES_EXPLORER) {
|
|
return button;
|
|
}
|
|
|
|
if (location.pathname === ROUTES.LOGS_EXPLORER) {
|
|
return button;
|
|
}
|
|
|
|
return (
|
|
<Badge.Ribbon style={RIBBON_STYLES} text="New">
|
|
{button}
|
|
</Badge.Ribbon>
|
|
);
|
|
}
|
|
|
|
export default NewExplorerCTA;
|