mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-01 12:29:35 +01:00
Updated data table render check.
This commit is contained in:
parent
3c27f08a97
commit
90bd72cf98
@ -1,16 +1,23 @@
|
|||||||
import { useReports } from 'components/hooks';
|
import { useReports } from 'components/hooks';
|
||||||
import ReportsTable from './ReportsTable';
|
import ReportsTable from './ReportsTable';
|
||||||
import DataTable from 'components/common/DataTable';
|
import DataTable from 'components/common/DataTable';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
export default function ReportsDataTable({
|
export default function ReportsDataTable({
|
||||||
websiteId,
|
websiteId,
|
||||||
teamId,
|
teamId,
|
||||||
|
children,
|
||||||
}: {
|
}: {
|
||||||
websiteId?: string;
|
websiteId?: string;
|
||||||
teamId?: string;
|
teamId?: string;
|
||||||
|
children?: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const queryResult = useReports({ websiteId, teamId });
|
const queryResult = useReports({ websiteId, teamId });
|
||||||
|
|
||||||
|
if (queryResult?.result?.data?.length === 0) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataTable queryResult={queryResult}>
|
<DataTable queryResult={queryResult}>
|
||||||
{({ data }) => <ReportsTable data={data} showDomain={!websiteId} />}
|
{({ data }) => <ReportsTable data={data} showDomain={!websiteId} />}
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
import DataTable from 'components/common/DataTable';
|
import DataTable from 'components/common/DataTable';
|
||||||
import TeamsTable from 'app/(main)/settings/teams/TeamsTable';
|
import TeamsTable from 'app/(main)/settings/teams/TeamsTable';
|
||||||
import { useLogin, useTeams } from 'components/hooks';
|
import { useLogin, useTeams } from 'components/hooks';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
export function TeamsDataTable({
|
export function TeamsDataTable({
|
||||||
allowEdit,
|
allowEdit,
|
||||||
showActions,
|
showActions,
|
||||||
|
children,
|
||||||
}: {
|
}: {
|
||||||
allowEdit?: boolean;
|
allowEdit?: boolean;
|
||||||
showActions?: boolean;
|
showActions?: boolean;
|
||||||
|
children?: ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const { user } = useLogin();
|
const { user } = useLogin();
|
||||||
const queryResult = useTeams(user.id);
|
const queryResult = useTeams(user.id);
|
||||||
|
|
||||||
|
if (queryResult?.result?.data?.length === 0) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataTable queryResult={queryResult}>
|
<DataTable queryResult={queryResult}>
|
||||||
{({ data }) => {
|
{({ data }) => {
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
import DataTable from 'components/common/DataTable';
|
import DataTable from 'components/common/DataTable';
|
||||||
import { useUsers } from 'components/hooks';
|
import { useUsers } from 'components/hooks';
|
||||||
import UsersTable from './UsersTable';
|
import UsersTable from './UsersTable';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
export function UsersDataTable({ showActions }: { showActions?: boolean }) {
|
export function UsersDataTable({
|
||||||
|
showActions,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
showActions?: boolean;
|
||||||
|
children?: ReactNode;
|
||||||
|
}) {
|
||||||
const queryResult = useUsers();
|
const queryResult = useUsers();
|
||||||
|
|
||||||
|
if (queryResult?.result?.data?.length === 0) {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataTable queryResult={queryResult}>
|
<DataTable queryResult={queryResult}>
|
||||||
{({ data }) => <UsersTable data={data} showActions={showActions} />}
|
{({ data }) => <UsersTable data={data} showActions={showActions} />}
|
||||||
|
@ -18,7 +18,7 @@ export function WebsitesDataTable({
|
|||||||
}) {
|
}) {
|
||||||
const queryResult = useWebsites({ teamId });
|
const queryResult = useWebsites({ teamId });
|
||||||
|
|
||||||
if (!queryResult?.result?.data?.length) {
|
if (queryResult?.result?.data?.length === 0) {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user