fix(projects): disappear the info button in case the feature was not enabled.

This commit is contained in:
a.bouhuolia
2023-01-26 00:45:35 +02:00
parent 729fce9c70
commit 21199c45fa

View File

@@ -4,7 +4,7 @@ import intl from 'react-intl-universal';
import { MenuItem, Menu, Button, Position } from '@blueprintjs/core'; import { MenuItem, Menu, Button, Position } from '@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2'; import { Popover2 } from '@blueprintjs/popover2';
import { Align, CellType } from '@/constants'; import { Align, CellType, Features } from '@/constants';
import { Hint, Icon, FormattedMessage as T } from '@/components'; import { Hint, Icon, FormattedMessage as T } from '@/components';
import { formattedAmount } from '@/utils'; import { formattedAmount } from '@/utils';
import { import {
@@ -16,6 +16,7 @@ import {
CheckBoxFieldCell, CheckBoxFieldCell,
ProjectBillableEntriesCell, ProjectBillableEntriesCell,
} from '@/components/DataTableCells'; } from '@/components/DataTableCells';
import { useFeatureCan } from '@/hooks/state';
/** /**
* Item header cell. * Item header cell.
@@ -88,6 +89,9 @@ const LandedCostHeaderCell = () => {
* Retrieve editable items entries columns. * Retrieve editable items entries columns.
*/ */
export function useEditableItemsEntriesColumns({ landedCost }) { export function useEditableItemsEntriesColumns({ landedCost }) {
const { featureCan } = useFeatureCan();
const isProjectsFeatureEnabled = featureCan(Features.Projects);
return React.useMemo( return React.useMemo(
() => [ () => [
{ {
@@ -154,15 +158,19 @@ export function useEditableItemsEntriesColumns({ landedCost }) {
}, },
] ]
: []), : []),
{ ...(isProjectsFeatureEnabled
Header: '', ? [
accessor: 'invoicing', {
Cell: ProjectBillableEntriesCell, Header: '',
disableSortBy: true, accessor: 'invoicing',
disableResizing: true, Cell: ProjectBillableEntriesCell,
width: 45, disableSortBy: true,
align: Align.Center, disableResizing: true,
}, width: 45,
align: Align.Center,
},
]
: []),
{ {
Header: '', Header: '',
accessor: 'action', accessor: 'action',