mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 16:17:13 +01:00
Updated ReportsTable.
This commit is contained in:
parent
94a27226d1
commit
012d31e010
7 changed files with 12 additions and 81 deletions
|
|
@ -1,34 +1,12 @@
|
|||
'use client';
|
||||
import Page from 'components/layout/Page';
|
||||
import Empty from 'components/common/Empty';
|
||||
import ReportsTable from '../../../../(main)/reports/ReportsTable';
|
||||
import { useMessages, useWebsiteReports } from 'components/hooks';
|
||||
import Link from 'next/link';
|
||||
import { Button, Flexbox, Icon, Icons, Text } from 'react-basics';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import WebsiteHeader from '../WebsiteHeader';
|
||||
import ReportsDataTable from 'app/(main)/reports/ReportsDataTable';
|
||||
|
||||
export function WebsiteReports({ websiteId }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const {
|
||||
reports,
|
||||
error,
|
||||
isLoading,
|
||||
deleteReport,
|
||||
filter,
|
||||
handleFilterChange,
|
||||
handlePageChange,
|
||||
handlePageSizeChange,
|
||||
} = useWebsiteReports(websiteId);
|
||||
|
||||
const hasData = (reports && reports.data.length !== 0) || filter;
|
||||
|
||||
const handleDelete = async id => {
|
||||
await deleteReport(id);
|
||||
};
|
||||
|
||||
if (isLoading || error) {
|
||||
return <Page loading={isLoading} error={error} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -43,17 +21,7 @@ export function WebsiteReports({ websiteId }) {
|
|||
</Button>
|
||||
</Link>
|
||||
</Flexbox>
|
||||
{hasData && (
|
||||
<ReportsTable
|
||||
data={reports}
|
||||
onDelete={handleDelete}
|
||||
onFilterChange={handleFilterChange}
|
||||
onPageChange={handlePageChange}
|
||||
onPageSizeChange={handlePageSizeChange}
|
||||
filterValue={filter}
|
||||
/>
|
||||
)}
|
||||
{!hasData && <Empty />}
|
||||
<ReportsDataTable websiteId={websiteId} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue