Added download to breakdown report.
This commit is contained in:
1 parent
8227a99c0a
commit
e0009cb414
2 files changed
+27
-11
No files matched your search
@@ -4,8 +4,9 @@ import { useState } from 'react';
|
||||
import { FieldSelectForm } from '@/app/(main)/websites/[websiteId]/(reports)/breakdown/FieldSelectForm';
|
||||
import { WebsiteControls } from '@/app/(main)/websites/[websiteId]/WebsiteControls';
|
||||
import { Panel } from '@/components/common/Panel';
|
||||
import { useDateRange, useMessages } from '@/components/hooks';
|
||||
import { useDateRange, useMessages, useResultQuery } from '@/components/hooks';
|
||||
import { ListCheck } from '@/components/icons';
|
||||
import { DownloadButton } from '@/components/input/DownloadButton';
|
||||
import { DialogButton } from '@/components/input/DialogButton';
|
||||
import { Breakdown } from './Breakdown';
|
||||
|
||||
@@ -14,13 +15,23 @@ export function BreakdownPage({ websiteId }: { websiteId: string }) {
|
||||
dateRange: { startDate, endDate },
|
||||
} = useDateRange();
|
||||
const [fields, setFields] = useState(['path']);
|
||||
const { data } = useResultQuery<any>(
|
||||
'breakdown',
|
||||
{ websiteId, startDate, endDate, fields },
|
||||
{ enabled: !!fields.length },
|
||||
);
|
||||
return (
|
||||
<Column gap>
|
||||
<WebsiteControls websiteId={websiteId} />
|
||||
<Row alignItems="center" justifyContent="flex-start">
|
||||
<FieldsButton value={fields} onChange={setFields} />
|
||||
</Row>
|
||||
<Panel height="900px" overflow="auto" allowFullscreen>
|
||||
<Panel
|
||||
height="900px"
|
||||
overflow="auto"
|
||||
allowFullscreen
|
||||
toolbar={<DownloadButton filename="breakdown" data={data} />}
|
||||
>
|
||||
<Breakdown
|
||||
websiteId={websiteId}
|
||||
startDate={startDate}
|
||||
|
||||
Reference in new issue
Block a user