feat: add feature guard as hook and component.

This commit is contained in:
a.bouhuolia
2022-02-13 16:29:50 +02:00
parent fdd52f1ecf
commit 9b7befc544
12 changed files with 134 additions and 39 deletions

View File

@@ -1,12 +1,17 @@
import React from 'react';
import { Tab } from '@blueprintjs/core';
import { DrawerMainTabs, FormattedMessage as T } from 'components';
import { ItemPaymentTransactions } from './ItemPaymentTransactions';
import ItemDetailHeader from './ItemDetailHeader';
import WarehousesLocationsTable from './WarehousesLocations';
import { Features } from 'common';
import { useFeatureCan } from 'hooks/state';
export default function ItemDetailTab() {
const { featureCan } = useFeatureCan();
return (
<DrawerMainTabs renderActiveTabPanelOnly={true}>
<Tab
@@ -19,11 +24,13 @@ export default function ItemDetailTab() {
title={<T id={'transactions'} />}
panel={<ItemPaymentTransactions />}
/>
<Tab
id={'warehouses'}
title={<T id={'warehouse_locations.label'} />}
panel={<WarehousesLocationsTable />}
/>
{featureCan(Features.Warehouses) && (
<Tab
id={'warehouses'}
title={<T id={'warehouse_locations.label'} />}
panel={<WarehousesLocationsTable />}
/>
)}
</DrawerMainTabs>
);
}