* start moving ui to redux tlk * remove unused reducer * changes for gdpr and site types * ui: migrating duck/roles to mobx * ui: drop unreferenced types * ui: drop unreferenced types * ui: move player slice reducer to mobx family * ui: move assignments to issueReportingStore.ts * remove issues store * some fixes after issues store * remove errors reducer, drop old components * finish removing errors reducer * start moving integrations state to mobx * change(ui): funnel duck cleanup * change(ui): custom fields * change(ui): customMetrics cleanup * change(ui): customMetrics cleanup * change(ui): duck/filters minor cleanup * change(ui): duck/filters cleanup * change(ui): duck/customMetrics cleanup and upgrades * fix integrations service, fix babel config to >.25 + not ie * refactoring integrations reducers etc WIP * finish removing integrations state * some fixes for integrated check * start of projects refactoring * move api and "few" files to new project store * new batch for site -> projects * fix setid context * move all critical components, drop site duck * remove all duck/site refs, remove old components * fixup for SessionTags.tsx, remove duck/sources (?) * move session store * init sessionstore outside of context * fix userfilter * replace simple actions for session store * sessions sotre * Rtm temp (#2597) * change(ui): duck/search wip * change(ui): duck/search wip * change(ui): duck/search wip * change(ui): duck/searchLive wip * change(ui): duck/searchLive wip * change(ui): duck/searchLive wip * change(ui): duck/searchLive wip * change(ui): search states * change(ui): search states * change(ui): search states * change(ui): fix savedSearch store * change(ui): fix savedSearch store * some fixes for session connector * change(ui): fix savedSearch store * change(ui): fix searchLive * change(ui): fix searchLive * fixes for session replay * change(ui): bookmark fetch * last components for sessions * add fetchautoplaylist * finish session reducer, remove deleted reducers * change(ui): fix the search fetch * change(ui): fix the search fetch * fix integrations call ctx * ensure ctx for sessionstore * fix(ui): checking for latest sessions path * start removing user reducer * removing user reducer pt2... * finish user store * remove rand log * fix crashes * tinkering workflow file for tracker test * making sure prefetched sessions work properly * fix conflict * fix router redirects during loading --------- Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
87 lines
2.8 KiB
TypeScript
87 lines
2.8 KiB
TypeScript
import React from 'react';
|
|
import { SideMenuitem } from 'UI';
|
|
import { withRouter, RouteComponentProps } from 'react-router-dom';
|
|
import { sessions, fflags, withSiteId, notes, bookmarks } from 'App/routes';
|
|
import { useStore } from 'App/mstore';
|
|
|
|
interface Props {
|
|
activeTab: string;
|
|
}
|
|
|
|
const TabToUrlMap = {
|
|
all: sessions() as '/sessions',
|
|
bookmark: bookmarks() as '/bookmarks',
|
|
notes: notes() as '/notes',
|
|
flags: fflags() as '/feature-flags'
|
|
};
|
|
|
|
function OverviewMenu(props: Props & RouteComponentProps) {
|
|
// @ts-ignore
|
|
const { history, match: { params: { siteId } }, location } = props;
|
|
const { searchStore, userStore } = useStore();
|
|
const isEnterprise = userStore.isEnterprise;
|
|
const activeTab = searchStore.activeTab.type;
|
|
|
|
React.useEffect(() => {
|
|
const currentLocation = location.pathname;
|
|
const tab = Object.keys(TabToUrlMap).find((tab: keyof typeof TabToUrlMap) => currentLocation.includes(TabToUrlMap[tab]));
|
|
if (tab && tab !== activeTab) {
|
|
searchStore.setActiveTab({ type: tab });
|
|
}
|
|
}, [location.pathname]);
|
|
|
|
return (
|
|
<div className={'flex flex-col gap-2 w-full'}>
|
|
<div className="w-full">
|
|
<SideMenuitem
|
|
active={activeTab === 'all'}
|
|
id="menu-sessions"
|
|
title="Sessions"
|
|
iconName="play-circle-bold"
|
|
onClick={() => {
|
|
searchStore.setActiveTab({ type: 'all' });
|
|
!location.pathname.includes(sessions()) && history.push(withSiteId(sessions(), siteId));
|
|
}}
|
|
/>
|
|
</div>
|
|
<div className="w-full">
|
|
<SideMenuitem
|
|
active={activeTab === 'bookmark'}
|
|
id="menu-bookmarks"
|
|
title={`${isEnterprise ? 'Vault' : 'Bookmarks'}`}
|
|
iconName={isEnterprise ? 'safe' : 'star'}
|
|
onClick={() => {
|
|
// props.setActiveTab({ type: 'bookmark' });
|
|
!location.pathname.includes(bookmarks()) && history.push(withSiteId(bookmarks(), siteId));
|
|
}}
|
|
/>
|
|
</div>
|
|
<div className="w-full">
|
|
<SideMenuitem
|
|
active={activeTab === 'notes'}
|
|
id="menu-notes"
|
|
title="Notes"
|
|
iconName="stickies"
|
|
onClick={() => {
|
|
searchStore.setActiveTab({ type: 'notes' });
|
|
!location.pathname.includes(notes()) && history.push(withSiteId(notes(), siteId));
|
|
}}
|
|
/>
|
|
</div>
|
|
<div className="w-full">
|
|
<SideMenuitem
|
|
active={activeTab === 'flags'}
|
|
id="menu-flags"
|
|
title="Feature Flags"
|
|
iconName="toggles"
|
|
onClick={() => {
|
|
searchStore.setActiveTab({ type: 'flags' });
|
|
!location.pathname.includes(fflags()) && history.push(withSiteId(fflags(), siteId));
|
|
}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default withRouter(OverviewMenu);
|