import { AlignEndHorizontal, ChartPie, Clock, Eye, Sheet, Tag, User, UserPlus, } from '@/components/icons'; import { Funnel, Lightning, Magnet, Money, Network, Path, Target } from '@/components/svg'; import { useMessages } from './useMessages'; import { useNavigation } from './useNavigation'; export function useWebsiteNavItems(websiteId: string) { const { t, labels } = useMessages(); const { pathname, renderUrl } = useNavigation(); const renderPath = (path: string) => renderUrl(`/websites/${websiteId}${path}`, { event: undefined, compare: undefined, view: undefined, unit: undefined, excludeBounce: undefined, }); const items = [ { label: t(labels.traffic), items: [ { id: 'overview', label: t(labels.overview), icon: , path: renderPath(''), }, { id: 'events', label: t(labels.events), icon: , path: renderPath('/events'), }, { id: 'sessions', label: t(labels.sessions), icon: , path: renderPath('/sessions'), }, { id: 'realtime', label: t(labels.realtime), icon: , path: renderPath('/realtime'), }, { id: 'compare', label: t(labels.compare), icon: , path: renderPath('/compare'), }, { id: 'breakdown', label: t(labels.breakdown), icon: , path: renderPath('/breakdown'), }, ], }, { label: t(labels.behavior), items: [ { id: 'goals', label: t(labels.goals), icon: , path: renderPath('/goals'), }, { id: 'funnel', label: t(labels.funnels), icon: , path: renderPath('/funnels'), }, { id: 'journeys', label: t(labels.journeys), icon: , path: renderPath('/journeys'), }, { id: 'retention', label: t(labels.retention), icon: , path: renderPath('/retention'), }, ], }, { label: t(labels.audience), items: [ { id: 'segments', label: t(labels.segments), icon: , path: renderPath('/segments'), }, { id: 'cohorts', label: t(labels.cohorts), icon: , path: renderPath('/cohorts'), }, ], }, { label: t(labels.growth), items: [ { id: 'utm', label: t(labels.utm), icon: , path: renderPath('/utm'), }, { id: 'revenue', label: t(labels.revenue), icon: , path: renderPath('/revenue'), }, { id: 'attribution', label: t(labels.attribution), icon: , path: renderPath('/attribution'), }, ], }, ]; const selectedKey = items .flatMap(e => e.items) .find(({ path }) => path && pathname.endsWith(path.split('?')[0]))?.id; return { items, selectedKey, renderPath }; }