Skip to content

Commit f87ccb0

Browse files
committed
Merge branch 'main' into change_workspace
2 parents cef198d + 9a88559 commit f87ccb0

29 files changed

Lines changed: 215 additions & 37 deletions

File tree

src/CONST/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5142,6 +5142,8 @@ const CONST = {
51425142
VIDEO_PLAYER_TEST_ID: 'VideoPlayer',
51435143
LOTTIE_VIEW_TEST_ID: 'LottieView',
51445144

5145+
DOT_INDICATOR_TEST_ID: 'DotIndicator',
5146+
51455147
CHAT_HEADER_LOADER_HEIGHT: 36,
51465148

51475149
HORIZONTAL_SPACER: {

src/components/Navigation/SearchSidebar.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import SearchTypeMenu from '@pages/Search/SearchTypeMenu';
1616
import CONST from '@src/CONST';
1717
import ONYXKEYS from '@src/ONYXKEYS';
1818
import SCREENS from '@src/SCREENS';
19-
import type {SearchResultsInfo} from '@src/types/onyx/SearchResults';
19+
import type {SearchResults} from '@src/types/onyx';
2020
import NavigationTabBar from './NavigationTabBar';
2121
import NAVIGATION_TABS from './NavigationTabBar/NAVIGATION_TABS';
2222
import TopBar from './TopBar';
@@ -43,24 +43,21 @@ function SearchSidebar({state}: SearchSidebarProps) {
4343
}, [params?.q]);
4444

4545
const currentSearchResultsKey = queryJSON?.hash ?? CONST.DEFAULT_NUMBER_ID;
46-
const [currentSearchResults] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchResultsKey}`, {canBeMissing: true, selector: (snapshot) => snapshot?.search});
47-
const [lastNonEmptySearchResults, setLastNonEmptySearchResults] = useState<SearchResultsInfo | undefined>(undefined);
46+
const [currentSearchResults] = useOnyx(`${ONYXKEYS.COLLECTION.SNAPSHOT}${currentSearchResultsKey}`, {canBeMissing: true});
47+
const [lastNonEmptySearchResults, setLastNonEmptySearchResults] = useState<SearchResults | undefined>(undefined);
4848

4949
useEffect(() => {
50-
if (!currentSearchResults?.type) {
50+
if (!currentSearchResults?.search?.type) {
5151
return;
5252
}
5353

54-
setLastSearchType(currentSearchResults.type);
55-
if (currentSearchResults.hasResults ?? currentSearchResults.hasMoreResults) {
54+
setLastSearchType(currentSearchResults.search.type);
55+
if (currentSearchResults.data) {
5656
setLastNonEmptySearchResults(currentSearchResults);
5757
}
5858
}, [lastSearchType, queryJSON, setLastSearchType, currentSearchResults]);
5959

60-
const searchResultsToUse = (currentSearchResults?.hasResults ?? currentSearchResults?.hasMoreResults) ? currentSearchResults : lastNonEmptySearchResults;
61-
62-
const isDataLoaded = isSearchDataLoaded(searchResultsToUse, queryJSON);
63-
60+
const isDataLoaded = isSearchDataLoaded(currentSearchResults?.data ? currentSearchResults : lastNonEmptySearchResults, queryJSON);
6461
const shouldShowLoadingState = route?.name === SCREENS.SEARCH.MONEY_REQUEST_REPORT ? false : !isOffline && !isDataLoaded;
6562

6663
if (shouldUseNarrowLayout) {

src/components/ReportActionItem/IssueCardMessage.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@ import Button from '@components/Button';
44
import {useSession} from '@components/OnyxListItemProvider';
55
import RenderHTML from '@components/RenderHTML';
66
import useLocalize from '@hooks/useLocalize';
7+
import useOnyx from '@hooks/useOnyx';
78
import useThemeStyles from '@hooks/useThemeStyles';
89
import {getExpensifyCardFromReportAction} from '@libs/CardMessageUtils';
910
import Navigation from '@libs/Navigation/Navigation';
1011
import {getCardIssuedMessage, getOriginalMessage, shouldShowAddMissingDetails} from '@libs/ReportActionsUtils';
12+
import ONYXKEYS from '@src/ONYXKEYS';
1113
import ROUTES from '@src/ROUTES';
1214
import type {ReportAction} from '@src/types/onyx';
1315
import type {IssueNewCardOriginalMessage} from '@src/types/onyx/OriginalMessage';
@@ -23,13 +25,15 @@ function IssueCardMessage({action, policyID}: IssueCardMessageProps) {
2325
const styles = useThemeStyles();
2426
const session = useSession();
2527
const assigneeAccountID = (getOriginalMessage(action) as IssueNewCardOriginalMessage)?.assigneeAccountID;
26-
const card = getExpensifyCardFromReportAction({reportAction: action, policyID});
28+
const expensifyCard = getExpensifyCardFromReportAction({reportAction: action, policyID});
2729
const isAssigneeCurrentUser = !isEmptyObject(session) && session.accountID === assigneeAccountID;
28-
const shouldShowAddMissingDetailsButton = isAssigneeCurrentUser && shouldShowAddMissingDetails(action?.actionName, card);
30+
const shouldShowAddMissingDetailsButton = isAssigneeCurrentUser && shouldShowAddMissingDetails(action?.actionName, expensifyCard);
31+
const [cardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
32+
const companyCard = cardList?.[(getOriginalMessage(action) as IssueNewCardOriginalMessage)?.cardID];
2933

3034
return (
3135
<>
32-
<RenderHTML html={`<muted-text>${getCardIssuedMessage({reportAction: action, shouldRenderHTML: true, policyID, card})}</muted-text>`} />
36+
<RenderHTML html={`<muted-text>${getCardIssuedMessage({reportAction: action, shouldRenderHTML: true, policyID, expensifyCard, companyCard})}</muted-text>`} />
3337
{shouldShowAddMissingDetailsButton && (
3438
<Button
3539
onPress={() => Navigation.navigate(ROUTES.MISSING_PERSONAL_DETAILS)}

src/components/Search/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ function Search({queryJSON, searchResults, onSearchListScroll, contentContainerS
261261

262262
// There's a race condition in Onyx which makes it return data from the previous Search, so in addition to checking that the data is loaded
263263
// we also need to check that the searchResults matches the type and status of the current search
264-
const isDataLoaded = isSearchDataLoaded(searchResults?.search, queryJSON) ?? false;
264+
const isDataLoaded = isSearchDataLoaded(searchResults, queryJSON);
265265

266266
const shouldShowLoadingState = !isOffline && (!isDataLoaded || (!!searchResults?.search.isLoading && Array.isArray(searchResults?.data) && searchResults?.data.length === 0));
267267
const shouldShowLoadingMoreItems = !shouldShowLoadingState && searchResults?.search?.isLoading && searchResults?.search?.offset > 0;

src/components/SelectionList/BaseListItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function BaseListItem<TItem extends ListItem>({
142142
{(!item.isSelected || !!item.canShowSeveralIndicators) && !!item.brickRoadIndicator && shouldDisplayRBR && (
143143
<View style={[styles.alignItemsCenter, styles.justifyContentCenter]}>
144144
<Icon
145+
testID={CONST.DOT_INDICATOR_TEST_ID}
145146
src={Expensicons.DotIndicator}
146147
fill={item.brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.INFO ? theme.iconSuccessFill : theme.danger}
147148
/>

src/languages/de.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2680,6 +2680,8 @@ const translations = {
26802680
validationAmounts: 'Die eingegebenen Validierungsbeträge sind falsch. Bitte überprüfen Sie Ihren Kontoauszug und versuchen Sie es erneut.',
26812681
fullName: 'Bitte geben Sie einen gültigen vollständigen Namen ein',
26822682
ownershipPercentage: 'Bitte geben Sie eine gültige Prozentzahl ein.',
2683+
deletePaymentBankAccount:
2684+
'Dieses Bankkonto kann nicht gelöscht werden, da es für Expensify-Karten-Zahlungen verwendet wird. Wenn Sie dieses Konto trotzdem löschen möchten, wenden Sie sich bitte an den Concierge.',
26832685
},
26842686
},
26852687
addPersonalBankAccount: {

src/languages/en.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,6 +2676,8 @@ const translations = {
26762676
validationAmounts: 'The validation amounts you entered are incorrect. Please double check your bank statement and try again.',
26772677
fullName: 'Please enter a valid full name',
26782678
ownershipPercentage: 'Please enter a valid percentage number',
2679+
deletePaymentBankAccount:
2680+
"This bank account can't be deleted because it is used for Expensify Card payments. If you would still like to delete this account, please reach out to Concierge.",
26792681
},
26802682
},
26812683
addPersonalBankAccount: {

src/languages/es.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,6 +2665,8 @@ const translations = {
26652665
validationAmounts: 'Los importes de validación que introduciste son incorrectos. Por favor, comprueba tu cuenta bancaria e inténtalo de nuevo.',
26662666
fullName: 'Por favor, introduce un nombre completo válido',
26672667
ownershipPercentage: 'Por favor, ingrese un número de porcentaje válido',
2668+
deletePaymentBankAccount:
2669+
'Esta cuenta bancaria no se puede eliminar porque se utiliza para pagos con la tarjeta Expensify. Si aún deseas eliminar esta cuenta, por favor contacta con Concierge.',
26682670
},
26692671
},
26702672
addPersonalBankAccount: {

src/languages/fr.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2682,6 +2682,8 @@ const translations = {
26822682
validationAmounts: 'Les montants de validation que vous avez saisis sont incorrects. Veuillez vérifier votre relevé bancaire et réessayer.',
26832683
fullName: 'Veuillez entrer un nom complet valide',
26842684
ownershipPercentage: 'Veuillez entrer un nombre en pourcentage valide',
2685+
deletePaymentBankAccount:
2686+
'Ce compte bancaire ne peut pas être supprimé car il est utilisé pour les paiements par carte Expensify. Si vous souhaitez toujours supprimer ce compte, veuillez contacter le Concierge.',
26852687
},
26862688
},
26872689
addPersonalBankAccount: {

src/languages/it.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,6 +2692,8 @@ const translations = {
26922692
validationAmounts: "Gli importi di convalida inseriti non sono corretti. Si prega di ricontrollare l'estratto conto bancario e riprovare.",
26932693
fullName: 'Per favore, inserisci un nome completo valido',
26942694
ownershipPercentage: 'Per favore, inserisci un numero percentuale valido',
2695+
deletePaymentBankAccount:
2696+
'Questo conto bancario non può essere eliminato perché viene utilizzato per i pagamenti con la carta Expensify. Se desideri comunque eliminare questo conto, contatta il Concierge.',
26952697
},
26962698
},
26972699
addPersonalBankAccount: {

0 commit comments

Comments
 (0)