Skip to content

Commit 6666ac7

Browse files
committed
Remove nested Gusto row ternary
1 parent ba5ad38 commit 6666ac7

1 file changed

Lines changed: 30 additions & 23 deletions

File tree

src/pages/workspace/hr/WorkspaceHRPage.tsx

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,35 @@ function WorkspaceHRPage({
101101
[icons.Sync, icons.Trashcan, isOffline, policy, translate],
102102
);
103103

104+
let gustoRowRightComponent;
105+
if (!isConnected) {
106+
gustoRowRightComponent = (
107+
<Button
108+
small
109+
text={translate('workspace.hr.gusto.connect')}
110+
onPress={() => setActiveGustoFlowKey(Math.random())}
111+
/>
112+
);
113+
} else if (isGustoSyncInProgress) {
114+
gustoRowRightComponent = (
115+
<ActivityIndicator
116+
style={[styles.popoverMenuIcon]}
117+
reasonAttributes={{context: 'WorkspaceHRPage.gustoSync'}}
118+
/>
119+
);
120+
} else {
121+
gustoRowRightComponent = (
122+
<ThreeDotsMenu
123+
shouldSelfPosition
124+
menuItems={overflowMenu}
125+
anchorAlignment={{
126+
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
127+
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
128+
}}
129+
/>
130+
);
131+
}
132+
104133
return (
105134
<AccessOrNotFoundWrapper
106135
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.CONTROL]}
@@ -146,29 +175,7 @@ function WorkspaceHRPage({
146175
errorTextStyle={[styles.mt5]}
147176
shouldShowRedDotIndicator
148177
shouldShowRightComponent
149-
rightComponent={
150-
!isConnected ? (
151-
<Button
152-
small
153-
text={translate('workspace.hr.gusto.connect')}
154-
onPress={() => setActiveGustoFlowKey(Math.random())}
155-
/>
156-
) : isGustoSyncInProgress ? (
157-
<ActivityIndicator
158-
style={[styles.popoverMenuIcon]}
159-
reasonAttributes={{context: 'WorkspaceHRPage.gustoSync'}}
160-
/>
161-
) : (
162-
<ThreeDotsMenu
163-
shouldSelfPosition
164-
menuItems={overflowMenu}
165-
anchorAlignment={{
166-
horizontal: CONST.MODAL.ANCHOR_ORIGIN_HORIZONTAL.RIGHT,
167-
vertical: CONST.MODAL.ANCHOR_ORIGIN_VERTICAL.TOP,
168-
}}
169-
/>
170-
)
171-
}
178+
rightComponent={gustoRowRightComponent}
172179
/>
173180
</Section>
174181
</View>

0 commit comments

Comments
 (0)