mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 22:57:12 +01:00
Bootstrap User Journey report.
This commit is contained in:
parent
37eb157ab5
commit
76cab03bb2
18 changed files with 329 additions and 19 deletions
|
|
@ -6,6 +6,7 @@ import Lightbulb from 'assets/lightbulb.svg';
|
|||
import Magnet from 'assets/magnet.svg';
|
||||
import Tag from 'assets/tag.svg';
|
||||
import Target from 'assets/target.svg';
|
||||
import Path from 'assets/path.svg';
|
||||
import styles from './ReportTemplates.module.css';
|
||||
import { useMessages, useTeamUrl } from 'components/hooks';
|
||||
|
||||
|
|
@ -44,6 +45,12 @@ export function ReportTemplates({ showHeader = true }: { showHeader?: boolean })
|
|||
url: renderTeamUrl('/reports/goals'),
|
||||
icon: <Target />,
|
||||
},
|
||||
{
|
||||
title: formatMessage(labels.journey),
|
||||
description: formatMessage(labels.journeyDescription),
|
||||
url: renderTeamUrl('/reports/journey'),
|
||||
icon: <Path />,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
|
|
|
|||
36
src/app/(main)/reports/journey/JourneyParameters.tsx
Normal file
36
src/app/(main)/reports/journey/JourneyParameters.tsx
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import { useContext } from 'react';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import { Form, FormButtons, SubmitButton } from 'react-basics';
|
||||
import { ReportContext } from '../[reportId]/Report';
|
||||
import BaseParameters from '../[reportId]/BaseParameters';
|
||||
|
||||
export function JourneyParameters() {
|
||||
const { report, runReport, isRunning } = useContext(ReportContext);
|
||||
const { formatMessage, labels } = useMessages();
|
||||
|
||||
const { id, parameters } = report || {};
|
||||
const { websiteId, dateRange } = parameters || {};
|
||||
const queryDisabled = !websiteId || !dateRange;
|
||||
|
||||
const handleSubmit = (data: any, e: any) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
||||
if (!queryDisabled) {
|
||||
runReport(data);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Form values={parameters} onSubmit={handleSubmit} preventSubmit={true}>
|
||||
<BaseParameters showDateSelect={true} allowWebsiteSelect={!id} />
|
||||
<FormButtons>
|
||||
<SubmitButton variant="primary" disabled={queryDisabled} isLoading={isRunning}>
|
||||
{formatMessage(labels.runQuery)}
|
||||
</SubmitButton>
|
||||
</FormButtons>
|
||||
</Form>
|
||||
);
|
||||
}
|
||||
|
||||
export default JourneyParameters;
|
||||
28
src/app/(main)/reports/journey/JourneyReport.tsx
Normal file
28
src/app/(main)/reports/journey/JourneyReport.tsx
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'use client';
|
||||
import Report from '../[reportId]/Report';
|
||||
import ReportHeader from '../[reportId]/ReportHeader';
|
||||
import ReportMenu from '../[reportId]/ReportMenu';
|
||||
import ReportBody from '../[reportId]/ReportBody';
|
||||
import JourneyParameters from './JourneyParameters';
|
||||
import JourneyView from './JourneyView';
|
||||
import Path from 'assets/path.svg';
|
||||
import { REPORT_TYPES } from 'lib/constants';
|
||||
|
||||
const defaultParameters = {
|
||||
type: REPORT_TYPES.journey,
|
||||
parameters: {},
|
||||
};
|
||||
|
||||
export default function JourneyReport({ reportId }: { reportId?: string }) {
|
||||
return (
|
||||
<Report reportId={reportId} defaultParameters={defaultParameters}>
|
||||
<ReportHeader icon={<Path />} />
|
||||
<ReportMenu>
|
||||
<JourneyParameters />
|
||||
</ReportMenu>
|
||||
<ReportBody>
|
||||
<JourneyView />
|
||||
</ReportBody>
|
||||
</Report>
|
||||
);
|
||||
}
|
||||
5
src/app/(main)/reports/journey/JourneyReportPage.tsx
Normal file
5
src/app/(main)/reports/journey/JourneyReportPage.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import JourneyReport from './JourneyReport';
|
||||
|
||||
export default function JourneyReportPage() {
|
||||
return <JourneyReport />;
|
||||
}
|
||||
14
src/app/(main)/reports/journey/JourneyView.module.css
Normal file
14
src/app/(main)/reports/journey/JourneyView.module.css
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
.title {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: 50% 50%;
|
||||
gap: 20px;
|
||||
border-bottom: 1px solid var(--base300);
|
||||
padding-bottom: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
13
src/app/(main)/reports/journey/JourneyView.tsx
Normal file
13
src/app/(main)/reports/journey/JourneyView.tsx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { useContext } from 'react';
|
||||
import { ReportContext } from '../[reportId]/Report';
|
||||
|
||||
export default function JourneyView() {
|
||||
const { report } = useContext(ReportContext);
|
||||
const { data } = report || {};
|
||||
|
||||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <div>{JSON.stringify(data)}</div>;
|
||||
}
|
||||
10
src/app/(main)/reports/journey/page.tsx
Normal file
10
src/app/(main)/reports/journey/page.tsx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import { Metadata } from 'next';
|
||||
import JourneyReportPage from './JourneyReportPage';
|
||||
|
||||
export default function () {
|
||||
return <JourneyReportPage />;
|
||||
}
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'Journey Report',
|
||||
};
|
||||
|
|
@ -34,6 +34,7 @@ export default function UTMView() {
|
|||
{
|
||||
data: items.map(({ value }) => value),
|
||||
backgroundColor: CHART_COLORS,
|
||||
borderWidth: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export function WebsiteSettings({
|
|||
</Tabs>
|
||||
{tab === 'details' && <WebsiteEditForm websiteId={websiteId} onSave={handleSave} />}
|
||||
{tab === 'tracking' && <TrackingCode websiteId={websiteId} />}
|
||||
{tab === 'share' && <ShareUrl websiteId={websiteId} onSave={handleSave} />}
|
||||
{tab === 'share' && <ShareUrl onSave={handleSave} />}
|
||||
{tab === 'data' && <WebsiteData websiteId={websiteId} onSave={handleSave} />}
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue