mirror of
https://github.com/umami-software/umami.git
synced 2026-02-20 12:35:38 +01:00
allow showing pageview custom data on website detail page
This commit is contained in:
parent
46dd16260a
commit
996c02ef1a
5 changed files with 77 additions and 4 deletions
29
src/components/metrics/PageviewCustomDataTable.tsx
Normal file
29
src/components/metrics/PageviewCustomDataTable.tsx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import useMessages from 'components/hooks/useMessages';
|
||||
import MetricsTable, { MetricsTableProps } from 'components/metrics/MetricsTable';
|
||||
|
||||
export function PageviewCustomDataTable(props: MetricsTableProps) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
function renderLink({ x: field }) {
|
||||
return <>{field}</>;
|
||||
}
|
||||
|
||||
function titleize(fieldName: string) {
|
||||
return fieldName
|
||||
.split(/[_-]/)
|
||||
.map((word, i) => (i === 0 ? word[0].toUpperCase() + word.slice(1) : word))
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
return (
|
||||
<MetricsTable
|
||||
{...props}
|
||||
title={titleize(props.fieldName)}
|
||||
type="custom"
|
||||
metric={formatMessage(labels.visitors)}
|
||||
renderLabel={renderLink}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default PageviewCustomDataTable;
|
||||
Loading…
Add table
Add a link
Reference in a new issue