umami/src/app/(main)/reports/create/ReportTemplates.tsx

94 lines
2.8 KiB
TypeScript
Raw Normal View History

2023-05-18 06:20:06 +00:00
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';
2024-03-14 09:45:00 +00:00
import Tag from 'assets/tag.svg';
2024-05-10 18:15:23 +00:00
import Target from 'assets/target.svg';
2024-02-05 02:03:26 +00:00
import { useMessages, useTeamUrl } from 'components/hooks';
2024-06-03 16:33:58 +00:00
import PageHeader from 'components/layout/PageHeader';
import Link from 'next/link';
import { Button, Icon, Icons, Text } from 'react-basics';
import styles from './ReportTemplates.module.css';
2023-05-18 06:20:06 +00:00
2024-01-30 08:10:25 +00:00
export function ReportTemplates({ showHeader = true }: { showHeader?: boolean }) {
2023-06-15 10:27:41 +00:00
const { formatMessage, labels } = useMessages();
2024-02-05 02:03:26 +00:00
const { renderTeamUrl } = useTeamUrl();
2023-06-15 10:27:41 +00:00
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),
2024-01-30 08:10:25 +00:00
url: renderTeamUrl('/reports/insights'),
2023-07-18 16:09:22 +00:00
icon: <Lightbulb />,
},
{
title: formatMessage(labels.funnel),
2023-09-01 09:14:51 +00:00
description: formatMessage(labels.funnelDescription),
2024-01-30 08:10:25 +00:00
url: renderTeamUrl('/reports/funnel'),
2023-07-18 16:09:22 +00:00
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),
2024-01-30 08:10:25 +00:00
url: renderTeamUrl('/reports/retention'),
2023-08-13 03:13:11 +00:00
icon: <Magnet />,
2023-08-04 20:10:03 +00:00
},
2024-03-14 09:45:00 +00:00
{
title: formatMessage(labels.utm),
description: formatMessage(labels.utmDescription),
url: renderTeamUrl('/reports/utm'),
icon: <Tag />,
},
2024-05-06 05:15:47 +00:00
{
title: formatMessage(labels.goals),
description: formatMessage(labels.goalsDescription),
url: renderTeamUrl('/reports/goals'),
2024-05-10 18:15:23 +00:00
icon: <Target />,
2024-05-06 05:15:47 +00:00
},
2024-06-03 16:33:58 +00:00
// {
// title: formatMessage(labels.journey),
// description: formatMessage(labels.journeyDescription),
// url: renderTeamUrl('/reports/journey'),
// icon: <Path />,
// },
2023-07-18 16:09:22 +00:00
];
2023-05-18 06:20:06 +00:00
return (
2023-09-29 12:29:22 +00:00
<>
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>
2023-09-29 12:29:22 +00:00
</>
2023-05-18 06:20:06 +00:00
);
}
2023-05-20 16:02:08 +00:00
2024-02-06 07:59:33 +00:00
function ReportItem({ title, description, url, icon }) {
const { formatMessage, labels } = useMessages();
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>
<Text>{formatMessage(labels.create)}</Text>
</Button>
</Link>
</div>
</div>
);
}
2023-06-15 10:27:41 +00:00
export default ReportTemplates;