(websiteId: string)
| 15 | import { useNavigation } from './useNavigation'; |
| 16 | |
| 17 | export function useWebsiteNavItems(websiteId: string) { |
| 18 | const { t, labels } = useMessages(); |
| 19 | const { pathname, renderUrl } = useNavigation(); |
| 20 | |
| 21 | const renderPath = (path: string) => |
| 22 | renderUrl(`/websites/${websiteId}${path}`, { |
| 23 | event: undefined, |
| 24 | compare: undefined, |
| 25 | view: undefined, |
| 26 | unit: undefined, |
| 27 | excludeBounce: undefined, |
| 28 | }); |
| 29 | |
| 30 | const items = [ |
| 31 | { |
| 32 | label: t(labels.traffic), |
| 33 | items: [ |
| 34 | { |
| 35 | id: 'overview', |
| 36 | label: t(labels.overview), |
| 37 | icon: <Eye />, |
| 38 | path: renderPath(''), |
| 39 | }, |
| 40 | { |
| 41 | id: 'events', |
| 42 | label: t(labels.events), |
| 43 | icon: <Lightning />, |
| 44 | path: renderPath('/events'), |
| 45 | }, |
| 46 | { |
| 47 | id: 'sessions', |
| 48 | label: t(labels.sessions), |
| 49 | icon: <User />, |
| 50 | path: renderPath('/sessions'), |
| 51 | }, |
| 52 | { |
| 53 | id: 'realtime', |
| 54 | label: t(labels.realtime), |
| 55 | icon: <Clock />, |
| 56 | path: renderPath('/realtime'), |
| 57 | }, |
| 58 | { |
| 59 | id: 'performance', |
| 60 | label: t(labels.performance), |
| 61 | icon: <Gauge />, |
| 62 | path: renderPath('/performance'), |
| 63 | }, |
| 64 | { |
| 65 | id: 'compare', |
| 66 | label: t(labels.compare), |
| 67 | icon: <AlignEndHorizontal />, |
| 68 | path: renderPath('/compare'), |
| 69 | }, |
| 70 | { |
| 71 | id: 'breakdown', |
| 72 | label: t(labels.breakdown), |
| 73 | icon: <Sheet />, |
| 74 | path: renderPath('/breakdown'), |
no test coverage detected