From a90cbac5e6ed135d4ec0d71fde916d867b90d666 Mon Sep 17 00:00:00 2001 From: Charles Bochet Date: Mon, 31 Jul 2023 01:50:02 -0700 Subject: [PATCH] Fix table mock mode (#1007) --- .../table/components/CompanyTableMockData.tsx | 11 +++++++++++ .../table/components/CompanyTableMockMode.tsx | 3 +++ front/src/modules/ui/table/components/EntityTable.tsx | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 front/src/modules/companies/table/components/CompanyTableMockData.tsx diff --git a/front/src/modules/companies/table/components/CompanyTableMockData.tsx b/front/src/modules/companies/table/components/CompanyTableMockData.tsx new file mode 100644 index 0000000000..500ed892a1 --- /dev/null +++ b/front/src/modules/companies/table/components/CompanyTableMockData.tsx @@ -0,0 +1,11 @@ +import { companyViewFields } from '@/companies/constants/companyViewFields'; +import { useSetEntityTableData } from '@/ui/table/hooks/useSetEntityTableData'; + +import { mockedCompaniesData } from './companies-mock-data'; +export function CompanyTableMockData() { + const setEntityTableData = useSetEntityTableData(); + + setEntityTableData(mockedCompaniesData, companyViewFields, []); + + return <>; +} diff --git a/front/src/modules/companies/table/components/CompanyTableMockMode.tsx b/front/src/modules/companies/table/components/CompanyTableMockMode.tsx index 0b83d8544d..a7de979c8f 100644 --- a/front/src/modules/companies/table/components/CompanyTableMockMode.tsx +++ b/front/src/modules/companies/table/components/CompanyTableMockMode.tsx @@ -3,9 +3,12 @@ import { EntityTable } from '@/ui/table/components/EntityTable'; import { useUpdateOneCompanyMutation } from '~/generated/graphql'; import { availableSorts } from '~/pages/companies/companies-sorts'; +import { CompanyTableMockData } from './CompanyTableMockData'; + export function CompanyTableMockMode() { return ( <> + } diff --git a/front/src/modules/ui/table/components/EntityTable.tsx b/front/src/modules/ui/table/components/EntityTable.tsx index 6f9bcb5655..594f41fb25 100644 --- a/front/src/modules/ui/table/components/EntityTable.tsx +++ b/front/src/modules/ui/table/components/EntityTable.tsx @@ -127,7 +127,7 @@ export function EntityTable({ onSortsUpdate={onSortsUpdate} /> - {viewFields.length && ( + {viewFields.length > 0 && (