Skip to content

Commit 69d9f5e

Browse files
authored
Merge pull request Expensify#65796 from s77rt/add-statements-suggestion-lhn
[No QA] Suggested search: Add ‘Statements’
2 parents a003c86 + 9441fbd commit 69d9f5e

18 files changed

Lines changed: 178 additions & 47 deletions

src/CONST/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6430,6 +6430,7 @@ const CONST = {
64306430
APPROVE: 'approve',
64316431
PAY: 'pay',
64326432
EXPORT: 'export',
6433+
STATEMENTS: 'statements',
64336434
UNAPPROVED: 'unapproved',
64346435
UNAPPROVED_CASH: 'unapprovedCash',
64356436
UNAPPROVED_COMPANY_CARDS: 'unapprovedCompanyCards',

src/hooks/useSearchTypeMenu.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ export default function useSearchTypeMenu(queryJSON: SearchQueryJSON) {
4949
const [isPopoverVisible, setIsPopoverVisible] = useState(false);
5050
const [processedMenuItems, setProcessedMenuItems] = useState<PopoverMenuItem[]>([]);
5151

52-
const allCards = useMemo(() => {
53-
return mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList);
54-
}, [userCardList, workspaceCardFeeds]);
52+
const allCards = useMemo(() => mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList), [userCardList, workspaceCardFeeds]);
5553
const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER, {canBeMissing: true});
5654

5755
// this is a performance fix, rendering popover menu takes a lot of time and we don't need this component initially, that's why we postpone rendering it until everything else is rendered

src/hooks/useSearchTypeMenuSections.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import {useMemo} from 'react';
2-
import {mergeCardListWithWorkspaceFeeds} from '@libs/CardUtils';
32
import {buildSearchQueryJSON} from '@libs/SearchQueryUtils';
43
import {createTypeMenuSections} from '@libs/SearchUIUtils';
5-
import CONST from '@src/CONST';
64
import ONYXKEYS from '@src/ONYXKEYS';
75
import useOnyx from './useOnyx';
86

@@ -11,16 +9,14 @@ import useOnyx from './useOnyx';
119
* currently focused search, based on the hash
1210
*/
1311
const useSearchTypeMenuSections = (hash = 0) => {
14-
const [session] = useOnyx(ONYXKEYS.SESSION, {canBeMissing: false});
12+
const [currentUserLoginAndAccountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => ({email: session?.email, accountID: session?.accountID}), canBeMissing: false});
13+
const [allFeeds] = useOnyx(ONYXKEYS.COLLECTION.SHARED_NVP_PRIVATE_DOMAIN_MEMBER, {canBeMissing: true});
1514
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true});
16-
const [userCardList] = useOnyx(ONYXKEYS.CARD_LIST, {canBeMissing: true});
17-
const [workspaceCardFeeds] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST, {canBeMissing: true});
1815

19-
const hasCardFeed = useMemo(() => {
20-
return Object.keys(mergeCardListWithWorkspaceFeeds(workspaceCardFeeds ?? CONST.EMPTY_OBJECT, userCardList)).length > 0;
21-
}, [userCardList, workspaceCardFeeds]);
22-
23-
const typeMenuSections = useMemo(() => createTypeMenuSections(session, hasCardFeed, allPolicies), [allPolicies, hasCardFeed, session]);
16+
const typeMenuSections = useMemo(
17+
() => createTypeMenuSections(currentUserLoginAndAccountID?.email, currentUserLoginAndAccountID?.accountID, allFeeds, allPolicies),
18+
[currentUserLoginAndAccountID?.email, currentUserLoginAndAccountID?.accountID, allPolicies, allFeeds],
19+
);
2420

2521
const currentSearch = useMemo(() => {
2622
const flatMenuItems = typeMenuSections.map((section) => section.menuItems).flat();

src/languages/de.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5928,11 +5928,16 @@ const translations = {
59285928
title: 'Keine Ausgaben zum Exportieren',
59295929
subtitle: 'Zeit, es ruhig angehen zu lassen, gute Arbeit.',
59305930
},
5931+
emptyStatementsResults: {
5932+
title: 'Keine Ausgaben zu sehen',
5933+
subtitle: 'Keine Ergebnisse. Bitte versuchen Sie, Ihre Filter anzupassen.',
5934+
},
59315935
emptyUnapprovedResults: {
59325936
title: 'Keine Ausgaben zur Genehmigung',
59335937
subtitle: 'Null Ausgaben. Maximale Entspannung. Gut gemacht!',
59345938
},
59355939
},
5940+
statements: 'Erklärungen',
59365941
unapproved: 'Nicht bewilligt',
59375942
unapprovedCash: 'Nicht genehmigtes Bargeld',
59385943
unapprovedCompanyCards: 'Nicht genehmigte Firmenkarten',

src/languages/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5899,11 +5899,16 @@ const translations = {
58995899
title: 'No expenses to export',
59005900
subtitle: 'Time to take it easy, nice work.',
59015901
},
5902+
emptyStatementsResults: {
5903+
title: 'No expenses to display',
5904+
subtitle: 'No results. Please try adjusting your filters.',
5905+
},
59025906
emptyUnapprovedResults: {
59035907
title: 'No expenses to approve',
59045908
subtitle: 'Zero expenses. Maximum chill. Well done!',
59055909
},
59065910
},
5911+
statements: 'Statements',
59075912
unapproved: 'Unapproved',
59085913
unapprovedCash: 'Unapproved cash',
59095914
unapprovedCompanyCards: 'Unapproved company cards',

src/languages/es.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5921,11 +5921,16 @@ const translations = {
59215921
title: 'No hay gastos para exportar',
59225922
subtitle: 'Es hora de relajarse, buen trabajo.',
59235923
},
5924+
emptyStatementsResults: {
5925+
title: 'No hay gastos para mostrar',
5926+
subtitle: 'Sin resultados. Intenta ajustar tus filtros.',
5927+
},
59245928
emptyUnapprovedResults: {
59255929
title: 'No hay gastos para aprobar',
59265930
subtitle: 'Cero gastos. Máxima relajación. ¡Bien hecho!',
59275931
},
59285932
},
5933+
statements: 'Extractos',
59295934
unapproved: 'No aprobado',
59305935
unapprovedCash: 'Efectivo no aprobado',
59315936
unapprovedCompanyCards: 'Tarjetas de empresa no aprobadas',

src/languages/fr.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5939,11 +5939,16 @@ const translations = {
59395939
title: 'Aucune dépense à exporter',
59405940
subtitle: 'Il est temps de se détendre, beau travail.',
59415941
},
5942+
emptyStatementsResults: {
5943+
title: 'Aucun relevé à afficher',
5944+
subtitle: "Aucun résultat. Veuillez essayer d'ajuster vos filtres.",
5945+
},
59425946
emptyUnapprovedResults: {
59435947
title: 'Aucune dépense à approuver',
59445948
subtitle: 'Zéro dépenses. Détente maximale. Bien joué !',
59455949
},
59465950
},
5951+
statements: 'Relevés',
59475952
unapproved: 'Non approuvé',
59485953
unapprovedCash: 'Espèces non approuvées',
59495954
unapprovedCompanyCards: "Cartes d'entreprise non approuvées",

src/languages/it.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5942,11 +5942,16 @@ const translations = {
59425942
title: 'Nessuna spesa da esportare',
59435943
subtitle: 'È ora di rilassarsi, bel lavoro.',
59445944
},
5945+
emptyStatementsResults: {
5946+
title: 'Nessuna spesa da visualizzare',
5947+
subtitle: 'Nessun risultato. Provare a regolare i filtri.',
5948+
},
59455949
emptyUnapprovedResults: {
59465950
title: 'Nessuna spesa da approvare',
59475951
subtitle: 'Zero spese. Massimo relax. Ben fatto!',
59485952
},
59495953
},
5954+
statements: 'Dichiarazioni',
59505955
unapproved: 'Non approvato',
59515956
unapprovedCash: 'Contanti non approvati',
59525957
unapprovedCompanyCards: 'Carte aziendali non approvate',

src/languages/ja.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5902,11 +5902,16 @@ const translations = {
59025902
title: 'エクスポートする経費はありません',
59035903
subtitle: 'ゆっくりする時間です。お疲れ様でした。',
59045904
},
5905+
emptyStatementsResults: {
5906+
title: '表示する経費がない',
5907+
subtitle: '結果がありません。フィルターを調整してください。',
5908+
},
59055909
emptyUnapprovedResults: {
59065910
title: '承認する経費はありません',
59075911
subtitle: '経費ゼロ。最大限のリラックス。よくやった!',
59085912
},
59095913
},
5914+
statements: 'ステートメント',
59105915
unapproved: '未承認',
59115916
unapprovedCash: '未承認現金',
59125917
unapprovedCompanyCards: '未承認の社用カード',

src/languages/nl.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5934,11 +5934,16 @@ const translations = {
59345934
title: 'Geen uitgaven om te exporteren',
59355935
subtitle: 'Tijd om het rustig aan te doen, goed werk.',
59365936
},
5937+
emptyStatementsResults: {
5938+
title: 'Geen uitgaven om weer te geven',
5939+
subtitle: 'Geen resultaten. Probeer uw filters aan te passen.',
5940+
},
59375941
emptyUnapprovedResults: {
59385942
title: 'Geen uitgaven om goed te keuren',
59395943
subtitle: 'Nul uitgaven. Maximale ontspanning. Goed gedaan!',
59405944
},
59415945
},
5946+
statements: 'Verklaringen',
59425947
unapproved: 'Niet goedgekeurd',
59435948
unapprovedCash: 'Niet goedgekeurd contant geld',
59445949
unapprovedCompanyCards: 'Ongoedgekeurde bedrijfskaarten',

0 commit comments

Comments
 (0)