mirror of
https://github.com/umami-software/umami.git
synced 2026-02-10 23:57:12 +01:00
add eventchart and metrictable to sharepage
This commit is contained in:
parent
a8e3b5efbc
commit
64b5a72963
3 changed files with 30 additions and 10 deletions
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
|
|
@ -364,8 +364,6 @@ importers:
|
||||||
specifier: ^5.9.3
|
specifier: ^5.9.3
|
||||||
version: 5.9.3
|
version: 5.9.3
|
||||||
|
|
||||||
dist: {}
|
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
'@ampproject/remapping@2.3.0':
|
'@ampproject/remapping@2.3.0':
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
import { Grid, Tabs, Tab, TabList, TabPanel, Heading, Row } from '@umami/react-zen';
|
|
||||||
import { GridRow } from '@/components/common/GridRow';
|
import { GridRow } from '@/components/common/GridRow';
|
||||||
import { Panel } from '@/components/common/Panel';
|
import { Panel } from '@/components/common/Panel';
|
||||||
import { WorldMap } from '@/components/metrics/WorldMap';
|
import { useMessages, useNavigation } from '@/components/hooks';
|
||||||
|
import { EventsChart } from '@/components/metrics/EventsChart';
|
||||||
import { MetricsTable } from '@/components/metrics/MetricsTable';
|
import { MetricsTable } from '@/components/metrics/MetricsTable';
|
||||||
import { WeeklyTraffic } from '@/components/metrics/WeeklyTraffic';
|
import { WeeklyTraffic } from '@/components/metrics/WeeklyTraffic';
|
||||||
import { useMessages } from '@/components/hooks';
|
import { WorldMap } from '@/components/metrics/WorldMap';
|
||||||
|
import { Grid, Heading, Row, Tab, TabList, TabPanel, Tabs } from '@umami/react-zen';
|
||||||
|
|
||||||
export function WebsitePanels({ websiteId }: { websiteId: string }) {
|
export function WebsitePanels({ websiteId }: { websiteId: string }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
|
const { pathname } = useNavigation();
|
||||||
const tableProps = {
|
const tableProps = {
|
||||||
websiteId,
|
websiteId,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
|
|
@ -16,6 +18,7 @@ export function WebsitePanels({ websiteId }: { websiteId: string }) {
|
||||||
metric: formatMessage(labels.visitors),
|
metric: formatMessage(labels.visitors),
|
||||||
};
|
};
|
||||||
const rowProps = { minHeight: '570px' };
|
const rowProps = { minHeight: '570px' };
|
||||||
|
const isSharePage = pathname.includes('/share/');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid gap="3">
|
<Grid gap="3">
|
||||||
|
|
@ -113,6 +116,23 @@ export function WebsitePanels({ websiteId }: { websiteId: string }) {
|
||||||
<WeeklyTraffic websiteId={websiteId} />
|
<WeeklyTraffic websiteId={websiteId} />
|
||||||
</Panel>
|
</Panel>
|
||||||
</GridRow>
|
</GridRow>
|
||||||
|
{isSharePage && (
|
||||||
|
<GridRow layout="two-one" {...rowProps}>
|
||||||
|
<Panel>
|
||||||
|
<MetricsTable
|
||||||
|
websiteId={websiteId}
|
||||||
|
type="event"
|
||||||
|
title={formatMessage(labels.events)}
|
||||||
|
metric={formatMessage(labels.count)}
|
||||||
|
limit={15}
|
||||||
|
filterLink={false}
|
||||||
|
/>
|
||||||
|
</Panel>
|
||||||
|
<Panel gridColumn="span 2">
|
||||||
|
<EventsChart websiteId={websiteId} />
|
||||||
|
</Panel>
|
||||||
|
</GridRow>
|
||||||
|
)}
|
||||||
</Grid>
|
</Grid>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
import { useEffect, useMemo } from 'react';
|
|
||||||
import { Icon, Row, Text } from '@umami/react-zen';
|
|
||||||
import { LinkButton } from '@/components/common/LinkButton';
|
import { LinkButton } from '@/components/common/LinkButton';
|
||||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||||
import { useMessages, useNavigation, useWebsiteMetricsQuery } from '@/components/hooks';
|
import { useMessages, useNavigation, useWebsiteMetricsQuery } from '@/components/hooks';
|
||||||
import { Maximize } from '@/components/icons';
|
import { Maximize } from '@/components/icons';
|
||||||
import { percentFilter } from '@/lib/filters';
|
|
||||||
import { ListTable, ListTableProps } from './ListTable';
|
|
||||||
import { MetricLabel } from '@/components/metrics/MetricLabel';
|
import { MetricLabel } from '@/components/metrics/MetricLabel';
|
||||||
|
import { percentFilter } from '@/lib/filters';
|
||||||
|
import { Icon, Row, Text } from '@umami/react-zen';
|
||||||
|
import { useEffect, useMemo } from 'react';
|
||||||
|
import { ListTable, ListTableProps } from './ListTable';
|
||||||
|
|
||||||
export interface MetricsTableProps extends ListTableProps {
|
export interface MetricsTableProps extends ListTableProps {
|
||||||
websiteId: string;
|
websiteId: string;
|
||||||
|
|
@ -14,6 +14,7 @@ export interface MetricsTableProps extends ListTableProps {
|
||||||
dataFilter?: (data: any) => any;
|
dataFilter?: (data: any) => any;
|
||||||
limit?: number;
|
limit?: number;
|
||||||
showMore?: boolean;
|
showMore?: boolean;
|
||||||
|
filterLink?: boolean;
|
||||||
params?: Record<string, any>;
|
params?: Record<string, any>;
|
||||||
onDataLoad?: (data: any) => void;
|
onDataLoad?: (data: any) => void;
|
||||||
}
|
}
|
||||||
|
|
@ -24,6 +25,7 @@ export function MetricsTable({
|
||||||
dataFilter,
|
dataFilter,
|
||||||
limit,
|
limit,
|
||||||
showMore = false,
|
showMore = false,
|
||||||
|
filterLink = true,
|
||||||
params,
|
params,
|
||||||
onDataLoad,
|
onDataLoad,
|
||||||
...props
|
...props
|
||||||
|
|
@ -64,7 +66,7 @@ export function MetricsTable({
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const renderLabel = (row: any) => {
|
const renderLabel = (row: any) => {
|
||||||
return <MetricLabel type={type} data={row} />;
|
return filterLink ? <MetricLabel type={type} data={row} /> : row.label;
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue