Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add an "Invite" button to the workspace profile page #53719

Merged
merged 8 commits into from
Dec 24, 2024
10 changes: 10 additions & 0 deletions src/pages/workspace/WorkspaceProfilePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function WorkspaceProfilePage({policyDraft, policy: policyProp, route}: Workspac

// When we create a new workspace, the policy prop will be empty on the first render. Therefore, we have to use policyDraft until policy has been set in Onyx.
const policy = policyDraft?.id ? policyDraft : policyProp;
const isPolicyAdmin = PolicyUtils.isPolicyAdmin(policy);
const outputCurrency = policy?.outputCurrency ?? DistanceRequestUtils.getDefaultMileageRate(policy)?.currency ?? PolicyUtils.getPersonalPolicy()?.outputCurrency ?? '';
const currencySymbol = currencyList?.[outputCurrency]?.symbol ?? '';
const formattedCurrency = !isEmptyObject(policy) && !isEmptyObject(currencyList) ? `${outputCurrency} - ${currencySymbol}` : '';
Expand Down Expand Up @@ -346,6 +347,15 @@ function WorkspaceProfilePage({policyDraft, policy: policyProp, route}: Workspac
)}
{!readOnly && (
<View style={[styles.flexRow, styles.mt6, styles.mnw120]}>
{isPolicyAdmin && (
<Button
accessibilityLabel={translate('common.invite')}
text={translate('common.invite')}
onPress={() => Navigation.navigate(ROUTES.WORKSPACE_INVITE.getRoute(route.params.policyID))}
icon={Expensicons.UserPlus}
style={[styles.mr2]}
/>
)}
<Button
accessibilityLabel={translate('common.share')}
text={translate('common.share')}
Expand Down
Loading