mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 13:50:31 +00:00
feat: add feature guard as hook and component.
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user