@@ -40,6 +40,7 @@ function WorkspaceEditTaxPage({
40
40
const { windowWidth} = useWindowDimensions ( ) ;
41
41
const [ isDeleteModalVisible , setIsDeleteModalVisible ] = useState ( false ) ;
42
42
const canEdit = policy && PolicyUtils . canEditTaxRate ( policy , taxID ) ;
43
+ const hasAccountingConnections = PolicyUtils . hasAccountingConnections ( policy ) ;
43
44
44
45
const toggleTaxRate = ( ) => {
45
46
if ( ! currentTaxRate ) {
@@ -58,14 +59,17 @@ function WorkspaceEditTaxPage({
58
59
} ;
59
60
60
61
const threeDotsMenuItems : ThreeDotsMenuItem [ ] = useMemo (
61
- ( ) => [
62
- {
63
- icon : Expensicons . Trashcan ,
64
- text : translate ( 'common.delete' ) ,
65
- onSelected : ( ) => setIsDeleteModalVisible ( true ) ,
66
- } ,
67
- ] ,
68
- [ translate ] ,
62
+ ( ) =>
63
+ canEdit && ! hasAccountingConnections
64
+ ? [
65
+ {
66
+ icon : Expensicons . Trashcan ,
67
+ text : translate ( 'common.delete' ) ,
68
+ onSelected : ( ) => setIsDeleteModalVisible ( true ) ,
69
+ } ,
70
+ ]
71
+ : [ ] ,
72
+ [ translate , canEdit , hasAccountingConnections ] ,
69
73
) ;
70
74
71
75
if ( ! currentTaxRate ) {
@@ -86,7 +90,7 @@ function WorkspaceEditTaxPage({
86
90
< HeaderWithBackButton
87
91
title = { currentTaxRate ?. name }
88
92
threeDotsMenuItems = { threeDotsMenuItems }
89
- shouldShowThreeDotsButton = { ! ! canEdit }
93
+ shouldShowThreeDotsButton = { threeDotsMenuItems . length > 0 }
90
94
threeDotsAnchorPosition = { styles . threeDotsPopoverOffsetNoCloseButton ( windowWidth ) }
91
95
/>
92
96
< OfflineWithFeedback
0 commit comments