mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 03:55:37 +01:00
Updated reports.
This commit is contained in:
parent
28e872f219
commit
01bd21c5b4
75 changed files with 1373 additions and 980 deletions
64
src/app/(main)/websites/[websiteId]/WebsiteTabs.tsx
Normal file
64
src/app/(main)/websites/[websiteId]/WebsiteTabs.tsx
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import { Tabs, TabList, Tab, Icon, Text, Row } from '@umami/react-zen';
|
||||
import { useWebsite } from '@/components/hooks/useWebsite';
|
||||
import { useMessages, useNavigation } from '@/components/hooks';
|
||||
import { Clock, Eye, Lightning, User, ChartPie } from '@/components/icons';
|
||||
|
||||
export function WebsiteTabs() {
|
||||
const website = useWebsite();
|
||||
const { pathname, renderTeamUrl } = useNavigation();
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
const links = [
|
||||
{
|
||||
id: 'overview',
|
||||
label: formatMessage(labels.overview),
|
||||
icon: <Eye />,
|
||||
path: '',
|
||||
},
|
||||
{
|
||||
id: 'events',
|
||||
label: formatMessage(labels.events),
|
||||
icon: <Lightning />,
|
||||
path: '/events',
|
||||
},
|
||||
{
|
||||
id: 'sessions',
|
||||
label: formatMessage(labels.users),
|
||||
icon: <User />,
|
||||
path: '/sessions',
|
||||
},
|
||||
{
|
||||
id: 'realtime',
|
||||
label: formatMessage(labels.realtime),
|
||||
icon: <Clock />,
|
||||
path: '/realtime',
|
||||
},
|
||||
{
|
||||
id: 'reports',
|
||||
label: formatMessage(labels.reports),
|
||||
icon: <ChartPie />,
|
||||
path: '/reports',
|
||||
},
|
||||
];
|
||||
|
||||
const selectedKey = links.find(({ path }) => path && pathname.includes(path))?.id || 'overview';
|
||||
|
||||
return (
|
||||
<Row marginBottom="6">
|
||||
<Tabs selectedKey={selectedKey}>
|
||||
<TabList>
|
||||
{links.map(({ id, label, icon, path }) => {
|
||||
return (
|
||||
<Tab key={id} id={id} href={renderTeamUrl(`/websites/${website.id}${path}`)}>
|
||||
<Row alignItems="center" gap>
|
||||
<Icon>{icon}</Icon>
|
||||
<Text>{label}</Text>
|
||||
</Row>
|
||||
</Tab>
|
||||
);
|
||||
})}
|
||||
</TabList>
|
||||
</Tabs>
|
||||
</Row>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue