123
This commit is contained in:
57
pages/marketplaces/components/MarketplacesTable/columns.tsx
Normal file
57
pages/marketplaces/components/MarketplacesTable/columns.tsx
Normal file
@ -0,0 +1,57 @@
|
||||
import { useMemo } from 'react';
|
||||
import { IconSettings } from '@tabler/icons-react';
|
||||
import { DataTableColumn } from 'mantine-datatable';
|
||||
import { Center } from '@mantine/core';
|
||||
import BaseTableActions from '@/components/Tables/Actions/BaseTableActions';
|
||||
import { MarketplaceSchema } from '@/lib/client';
|
||||
import { zMarketplaceSchema } from '@/lib/client/zod.gen';
|
||||
import BaseMarketplaceColumnRender from '@/pages/marketplaces/components/BaseMarketplaceColumnRender/BaseMarketplaceColumnRender';
|
||||
|
||||
const useMarketplacesTableColumns = () => {
|
||||
return useMemo(
|
||||
() =>
|
||||
[
|
||||
{
|
||||
accessor: 'id',
|
||||
title: 'ID',
|
||||
width: '0%',
|
||||
},
|
||||
{
|
||||
accessor: 'baseMarketplace',
|
||||
title: 'Базовый маркетплейс',
|
||||
render: ({ baseMarketplace }: MarketplaceSchema) => (
|
||||
<BaseMarketplaceColumnRender object={baseMarketplace} />
|
||||
),
|
||||
width: '0%',
|
||||
},
|
||||
{
|
||||
accessor: 'name',
|
||||
title: 'Название',
|
||||
},
|
||||
{
|
||||
width: '0%',
|
||||
accessor: 'actions',
|
||||
title: (
|
||||
<Center>
|
||||
<IconSettings size={16} />
|
||||
</Center>
|
||||
),
|
||||
render: (element) => (
|
||||
<BaseTableActions
|
||||
element={element}
|
||||
onChange={async () => {
|
||||
// const zodSchema = await zMarketplaceSchema.parseAsync(element)
|
||||
Object.entries(zMarketplaceSchema.shape).forEach(([key, val], index, arr) => {
|
||||
console.log(val.type);
|
||||
});
|
||||
}}
|
||||
onDelete={async () => {}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
] as DataTableColumn<MarketplaceSchema>[],
|
||||
[]
|
||||
);
|
||||
};
|
||||
|
||||
export default useMarketplacesTableColumns;
|
||||
Reference in New Issue
Block a user