-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55300 from Expensify/cristi_domainSelection-when-…
…provisionTravel Domain selection when enabling travel for workspaces with admins from multiple domains
- Loading branch information
Showing
31 changed files
with
694 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import React, {useCallback} from 'react'; | ||
import {View} from 'react-native'; | ||
import Badge from '@components/Badge'; | ||
import PressableWithFeedback from '@components/Pressable/PressableWithFeedback'; | ||
import SelectCircle from '@components/SelectCircle'; | ||
import TextWithTooltip from '@components/TextWithTooltip'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import CONST from '@src/CONST'; | ||
import BaseListItem from './BaseListItem'; | ||
import type {BaseListItemProps, ListItem} from './types'; | ||
|
||
type AdditionalDomainItemProps = { | ||
value?: string; | ||
isRecommended?: boolean; | ||
}; | ||
|
||
type DomainItemProps<TItem extends ListItem> = BaseListItemProps<TItem & AdditionalDomainItemProps> & {shouldHighlightSelectedItem?: boolean}; | ||
|
||
function TravelDomainListItem<TItem extends ListItem>({ | ||
item, | ||
isFocused, | ||
showTooltip, | ||
isDisabled, | ||
onSelectRow, | ||
onCheckboxPress, | ||
onFocus, | ||
shouldSyncFocus, | ||
shouldHighlightSelectedItem, | ||
}: DomainItemProps<TItem>) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const handleCheckboxPress = useCallback(() => { | ||
if (onCheckboxPress) { | ||
onCheckboxPress(item); | ||
} else { | ||
onSelectRow(item); | ||
} | ||
}, [item, onCheckboxPress, onSelectRow]); | ||
const showRecommendedTag = item.isRecommended ?? false; | ||
|
||
return ( | ||
<BaseListItem | ||
pressableStyle={[[shouldHighlightSelectedItem && item.isSelected && styles.activeComponentBG]]} | ||
item={item} | ||
wrapperStyle={[styles.flex1, styles.sidebarLinkInner, styles.userSelectNone, styles.optionRow, styles.justifyContentBetween]} | ||
isFocused={isFocused} | ||
isDisabled={isDisabled} | ||
showTooltip={showTooltip} | ||
canSelectMultiple | ||
onSelectRow={onSelectRow} | ||
keyForList={item.keyForList} | ||
onFocus={onFocus} | ||
shouldSyncFocus={shouldSyncFocus} | ||
> | ||
<> | ||
<View style={[styles.flexRow, styles.alignItemsCenter]}> | ||
<PressableWithFeedback | ||
onPress={handleCheckboxPress} | ||
disabled={isDisabled} | ||
role={CONST.ROLE.BUTTON} | ||
accessibilityLabel={item.text ?? ''} | ||
style={[styles.mr2, styles.optionSelectCircle]} | ||
> | ||
<SelectCircle | ||
isChecked={item.isSelected ?? false} | ||
selectCircleStyles={styles.ml0} | ||
/> | ||
</PressableWithFeedback> | ||
<View style={[styles.flexRow, styles.alignItemsCenter]}> | ||
<TextWithTooltip | ||
shouldShowTooltip={showTooltip} | ||
text={item.text ?? ''} | ||
style={[ | ||
styles.optionDisplayName, | ||
isFocused ? styles.sidebarLinkActiveText : styles.sidebarLinkText, | ||
item.isBold !== false && styles.sidebarLinkTextBold, | ||
styles.pre, | ||
]} | ||
/> | ||
</View> | ||
</View> | ||
{showRecommendedTag && <Badge text={translate('travel.domainSelector.recommended')} />} | ||
</> | ||
</BaseListItem> | ||
); | ||
} | ||
|
||
TravelDomainListItem.displayName = 'TravelDomainListItem'; | ||
|
||
export default TravelDomainListItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2566,6 +2566,23 @@ const translations = { | |
departs: 'Departs', | ||
errorMessage: 'Something went wrong. Please try again later.', | ||
phoneError: 'To book travel, your default contact method must be a valid email', | ||
domainSelector: { | ||
title: 'Domain', | ||
subtitle: 'Choose a domain for Expensify Travel setup.', | ||
recommended: 'Recommended', | ||
}, | ||
domainPermissionInfo: { | ||
title: 'Domain', | ||
restrictionPrefix: `You don't have permission to enable Expensify Travel for the domain`, | ||
restrictionSuffix: `You'll need to ask someone from that domain to enable travel instead.`, | ||
accountantInvitationPrefix: `If you're an accountant, consider joining the`, | ||
accountantInvitationLink: `ExpensifyApproved! accountants program`, | ||
accountantInvitationSuffix: `to enable travel for this domain.`, | ||
}, | ||
publicDomainError: { | ||
title: 'Get started with Expensify Travel', | ||
message: `You'll need to use your work email (e.g., [email protected]) with Expensify Travel, not your personal email (e.g., [email protected]).`, | ||
}, | ||
}, | ||
workspace: { | ||
common: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2590,6 +2590,23 @@ const translations = { | |
departs: 'Sale', | ||
errorMessage: 'Ha ocurrido un error. Por favor, inténtalo mas tarde.', | ||
phoneError: 'Para reservar viajes, tu método de contacto predeterminado debe ser un correo electrónico válido', | ||
domainSelector: { | ||
title: 'Dominio', | ||
subtitle: 'Elige un dominio para configurar Expensify Travel.', | ||
recommended: 'Recomendado', | ||
}, | ||
domainPermissionInfo: { | ||
title: 'Dominio', | ||
restrictionPrefix: `No tienes permiso para habilitar Expensify Travel para el dominio`, | ||
restrictionSuffix: `Tendrás que pedir a alguien de ese dominio que habilite Travel por ti.`, | ||
accountantInvitationPrefix: `Si eres contador, considera unirte al`, | ||
accountantInvitationLink: `programa de contadores ExpensifyApproved!`, | ||
accountantInvitationSuffix: `para habilitar Travel para este dominio.`, | ||
}, | ||
publicDomainError: { | ||
title: 'Comienza con Expensify Travel', | ||
message: 'Tendrás que usar tu correo electrónico laboral (por ejemplo, [email protected]) con Expensify Travel, no tu correo personal (por ejemplo, [email protected]).', | ||
}, | ||
}, | ||
workspace: { | ||
common: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type AcceptSpotnanaTermsParams = { | ||
domain?: string; | ||
}; | ||
|
||
export default AcceptSpotnanaTermsParams; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.