mirror of
https://github.com/umami-software/umami.git
synced 2026-02-16 18:45:36 +01:00
Refactored funnel report. Made BarChart more generic.
This commit is contained in:
parent
050cd2f5d9
commit
fb4dd75e18
24 changed files with 327 additions and 367 deletions
|
|
@ -7,21 +7,35 @@ import ReportMenu from '../ReportMenu';
|
|||
import ReportBody from '../ReportBody';
|
||||
import Funnel from 'assets/funnel.svg';
|
||||
import { useReport } from 'hooks';
|
||||
import useApi from 'hooks/useApi';
|
||||
|
||||
export default function FunnelReport({ reportId }) {
|
||||
const report = useReport(reportId);
|
||||
const report = useReport(reportId, { window: 60, urls: ['/', '/docs'] });
|
||||
const { post, useQuery } = useApi();
|
||||
const { data, isLoading, error } = useQuery(
|
||||
['report:funnel', report?.update],
|
||||
() => {
|
||||
const { websiteId, parameters } = report || {};
|
||||
|
||||
console.log('REPORT', { report });
|
||||
return post(`/reports/funnel`, {
|
||||
websiteId: websiteId,
|
||||
...parameters,
|
||||
startAt: +parameters.dateRange.startDate,
|
||||
endAt: +parameters.dateRange.endDate,
|
||||
});
|
||||
},
|
||||
{ enabled: !!report?.update },
|
||||
);
|
||||
|
||||
return (
|
||||
<Report>
|
||||
<Report error={error} loading={data && isLoading}>
|
||||
<ReportHeader icon={<Funnel />} report={report} />
|
||||
<ReportMenu>
|
||||
<FunnelParameters report={report} />
|
||||
</ReportMenu>
|
||||
<ReportBody>
|
||||
<FunnelChart report={report} />
|
||||
<FunnelTable report={report} />
|
||||
<FunnelChart report={report} data={data} />
|
||||
<FunnelTable data={data} />
|
||||
</ReportBody>
|
||||
</Report>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue