umami/src/components/pages/reports/ReportTemplates.js

74 lines
2.1 KiB
JavaScript
Raw Normal View History

2023-05-18 06:20:06 +00:00
import Link from 'next/link';
import { Button, Icons, Text, Icon } from 'react-basics';
import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import Funnel from 'assets/funnel.svg';
import Lightbulb from 'assets/lightbulb.svg';
2023-08-13 03:13:11 +00:00
import Magnet from 'assets/magnet.svg';
2023-06-15 10:27:41 +00:00
import styles from './ReportTemplates.module.css';
import { useMessages } from 'components/hooks';
2023-05-18 06:20:06 +00:00
2023-05-20 16:02:08 +00:00
function ReportItem({ title, description, url, icon }) {
2023-09-01 09:14:51 +00:00
const { formatMessage, labels } = useMessages();
2023-05-18 06:20:06 +00:00
return (
<div className={styles.report}>
<div className={styles.title}>
<Icon size="lg">{icon}</Icon>
<Text>{title}</Text>
</div>
<div className={styles.description}>{description}</div>
<div className={styles.buttons}>
<Link href={url}>
<Button variant="primary">
<Icon>
<Icons.Plus />
</Icon>
2023-09-01 09:14:51 +00:00
<Text>{formatMessage(labels.create)}</Text>
2023-05-18 06:20:06 +00:00
</Button>
</Link>
</div>
</div>
);
}
2023-08-19 04:52:59 +00:00
export function ReportTemplates({ showHeader = true }) {
2023-06-15 10:27:41 +00:00
const { formatMessage, labels } = useMessages();
2023-07-18 16:09:22 +00:00
const reports = [
{
title: formatMessage(labels.insights),
2023-09-01 09:14:51 +00:00
description: formatMessage(labels.insightsDescription),
2023-07-18 16:09:22 +00:00
url: '/reports/insights',
icon: <Lightbulb />,
},
{
title: formatMessage(labels.funnel),
2023-09-01 09:14:51 +00:00
description: formatMessage(labels.funnelDescription),
2023-07-18 16:09:22 +00:00
url: '/reports/funnel',
icon: <Funnel />,
},
2023-08-04 20:10:03 +00:00
{
title: formatMessage(labels.retention),
2023-09-01 09:14:51 +00:00
description: formatMessage(labels.retentionDescription),
2023-08-04 20:10:03 +00:00
url: '/reports/retention',
2023-08-13 03:13:11 +00:00
icon: <Magnet />,
2023-08-04 20:10:03 +00:00
},
2023-07-18 16:09:22 +00:00
];
2023-05-18 06:20:06 +00:00
return (
<Page>
2023-08-19 04:52:59 +00:00
{showHeader && <PageHeader title={formatMessage(labels.reports)} />}
2023-05-18 06:20:06 +00:00
<div className={styles.reports}>
{reports.map(({ title, description, url, icon }) => {
return (
2023-05-20 16:02:08 +00:00
<ReportItem key={title} icon={icon} title={title} description={description} url={url} />
2023-05-18 06:20:06 +00:00
);
})}
</div>
</Page>
);
}
2023-05-20 16:02:08 +00:00
2023-06-15 10:27:41 +00:00
export default ReportTemplates;