Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7994,7 +7994,6 @@ const CONST = {
AUTOCOMPLETE_SUGGESTION: 'autocompleteSuggestion',
SEARCH: 'searchItem',
FIND_ITEM: 'findItem',
ASK_CONCIERGE: 'askConcierge',
},
SEARCH_USER_FRIENDLY_KEYS: {
TYPE: 'type',
Expand Down
12 changes: 6 additions & 6 deletions src/components/Search/SearchAutocompleteList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ type SearchAutocompleteListProps = {
/** Callback to trigger search action * */
handleSearch: (value: string) => void;

/** Optional items to always display at the top of the router list */
searchQueryItems?: SearchQueryItem[];
/** An optional item to always display on the top of the router list */
searchQueryItem?: SearchQueryItem;

/** Any extra sections that should be displayed in the router list. */
getAdditionalSections?: GetAdditionalSectionsCallback;
Expand Down Expand Up @@ -131,7 +131,7 @@ function SearchRouterItem(props: UserListItemProps<AutocompleteListItem> | Searc
function SearchAutocompleteList({
autocompleteQueryValue,
handleSearch,
searchQueryItems,
searchQueryItem,
getAdditionalSections,
onListItemPress,
shouldSubscribeToArrowKeyEvents = true,
Expand Down Expand Up @@ -402,8 +402,8 @@ function SearchAutocompleteList({
nextSuggestionsCount += section.data.filter((item) => item.keyForList !== CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM).length;
};

if (searchQueryItems && searchQueryItems.length > 0) {
pushSection({data: searchQueryItems as AutocompleteListItem[], sectionIndex: sectionIndex++});
if (searchQueryItem) {
pushSection({data: [searchQueryItem as AutocompleteListItem], sectionIndex: sectionIndex++});
}

const additionalSections = getAdditionalSections?.(searchOptions, sectionIndex);
Expand Down Expand Up @@ -493,7 +493,7 @@ function SearchAutocompleteList({
recentReportsOptions,
recentSearchesData,
searchOptions,
searchQueryItems,
searchQueryItem,
styles,
translate,
isLoadingOptions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import type IconAsset from '@src/types/utils/IconAsset';

type SearchQueryItem = ListItem & {
singleIcon?: IconAsset;
/** Whether to apply the theme fill color to the icon. Set to false for multi-colored icons like avatars. Defaults to true. */
shouldIconApplyFill?: boolean;
searchItemType?: ValueOf<typeof CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE>;
searchQuery?: string;
autocompleteID?: string;
Expand Down Expand Up @@ -58,7 +56,7 @@ function SearchQueryListItem({item, isFocused, showTooltip, onSelectRow, onFocus
{!!item.singleIcon && (
<Icon
src={item.singleIcon}
fill={item.shouldIconApplyFill !== false ? theme.icon : undefined}
fill={theme.icon}
additionalStyles={styles.mr3}
medium
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function SearchPageInputNarrow({queryJSON, searchRouterListVisible, hideSearchRo
const {
autocompleteSubstitutions,
autocompleteQueryValue,
searchQueryItems,
searchQueryItem,
selection,
textInputRef,
textInputValue,
Expand Down Expand Up @@ -80,7 +80,7 @@ function SearchPageInputNarrow({queryJSON, searchRouterListVisible, hideSearchRo
<SearchAutocompleteList
autocompleteQueryValue={autocompleteQueryValue}
handleSearch={handleSearchAction}
searchQueryItems={searchQueryItems}
searchQueryItem={searchQueryItem}
onListItemPress={onListItemPress}
textInputRef={textInputRef}
autocompleteSubstitutions={autocompleteSubstitutions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function SearchPageInputWide({queryJSON, handleSearch}: SearchPageInputWideProps
const {
autocompleteSubstitutions,
autocompleteQueryValue,
searchQueryItems,
searchQueryItem,
selection,
textInputRef,
textInputValue,
Expand Down Expand Up @@ -98,7 +98,7 @@ function SearchPageInputWide({queryJSON, handleSearch}: SearchPageInputWideProps
<SearchAutocompleteList
autocompleteQueryValue={autocompleteQueryValue}
handleSearch={handleSearchAction}
searchQueryItems={searchQueryItems}
searchQueryItem={searchQueryItem}
onListItemPress={onListItemPress}
ref={listRef}
shouldSubscribeToArrowKeyEvents={isAutocompleteListVisible}
Expand Down
22 changes: 10 additions & 12 deletions src/components/Search/SearchPageHeader/useSearchPageInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,15 @@ function useSearchPageInput({queryJSON, onSearch, onSubmit}: UseSearchPageInputP
}
}

const searchQueryItems = textInputValue?.trim()
? [
{
text: textInputValue,
singleIcon: expensifyIcons.MagnifyingGlass,
searchQuery: textInputValue,
itemStyle: styles.activeComponentBG,
keyForList: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM,
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.SEARCH,
},
]
const searchQueryItem = textInputValue
? {
text: textInputValue,
singleIcon: expensifyIcons.MagnifyingGlass,
searchQuery: textInputValue,
itemStyle: styles.activeComponentBG,
keyForList: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM,
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.SEARCH,
}
: undefined;

return {
Expand All @@ -218,7 +216,7 @@ function useSearchPageInput({queryJSON, onSearch, onSubmit}: UseSearchPageInputP
personalAndWorkspaceCards,
personalDetails,
reports,
searchQueryItems,
searchQueryItem,
selection,
textInputRef,
textInputValue,
Expand Down
44 changes: 12 additions & 32 deletions src/components/Search/SearchRouter/SearchRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import {getQueryWithSubstitutions} from './getQueryWithSubstitutions';
import {getUpdatedSubstitutionsMap} from './getUpdatedSubstitutionsMap';
import {getContextualReportData, getContextualSearchAutocompleteKey, getContextualSearchQuery} from './SearchRouterUtils';
import updateAutocompleteSubstitutionsForSelection from './updateAutocompleteSubstitutionsForSelection';
import useAskConcierge from './useAskConcierge';

const privateIsArchivedSelector = (nvp: {private_isArchived?: string} | undefined): boolean | undefined => !!nvp?.private_isArchived;

Expand All @@ -73,8 +72,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
const personalDetails = usePersonalDetails();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const listRef = useRef<SelectionListWithSectionsHandle>(null);
const expensifyIcons = useMemoizedLazyExpensifyIcons(['MagnifyingGlass', 'ConciergeAvatar']);
const askConcierge = useAskConcierge();
const expensifyIcons = useMemoizedLazyExpensifyIcons(['MagnifyingGlass']);

// The actual input text that the user sees
const [textInputValue, , setTextInputValue] = useDebouncedState('', 500);
Expand Down Expand Up @@ -200,26 +198,15 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
],
);

const searchQueryItems = textInputValue?.trim()
? [
{
text: textInputValue,
singleIcon: expensifyIcons.MagnifyingGlass,
searchQuery: textInputValue,
itemStyle: styles.activeComponentBG,
keyForList: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM,
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.SEARCH,
},
{
text: translate('search.askConcierge', textInputValue),
singleIcon: expensifyIcons.ConciergeAvatar,
shouldIconApplyFill: false,
searchQuery: textInputValue,
itemStyle: styles.activeComponentBG,
keyForList: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.ASK_CONCIERGE,
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.ASK_CONCIERGE,
},
]
const searchQueryItem = textInputValue
? {
text: textInputValue,
singleIcon: expensifyIcons.MagnifyingGlass,
searchQuery: textInputValue,
itemStyle: styles.activeComponentBG,
keyForList: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM,
searchItemType: CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.SEARCH,
}
: undefined;

const shouldScrollRef = useRef(false);
Expand Down Expand Up @@ -321,12 +308,6 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
setAutocompleteSubstitutions,
});
setFocusAndScrollToRight();
} else if (item.searchItemType === CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.ASK_CONCIERGE) {
const {searchQuery} = item;
backHistory(() => {
askConcierge(searchQuery);
});
onRouterClose();
} else {
submitSearch(item.searchQuery, item.keyForList !== CONST.SEARCH.SEARCH_ROUTER_ITEM_TYPE.FIND_ITEM);
}
Expand Down Expand Up @@ -354,14 +335,13 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
betas,
contextualPoliciesMap,
contextualReportsMap,
askConcierge,
],
);

useKeyboardShortcut(CONST.KEYBOARD_SHORTCUTS.ESCAPE, () => {
onRouterClose();
});
const updateAndScrollToFocusedIndex = useCallback(() => listRef.current?.updateAndScrollToFocusedIndex(searchQueryItems?.length ?? 1, true), [searchQueryItems?.length]);
const updateAndScrollToFocusedIndex = useCallback(() => listRef.current?.updateAndScrollToFocusedIndex(1, true), []);

const modalWidth = shouldUseNarrowLayout ? styles.w100 : {width: variables.searchRouterPopoverWidth};

Expand Down Expand Up @@ -407,7 +387,7 @@ function SearchRouter({onRouterClose, shouldHideInputCaret, isSearchRouterDispla
<DeferredAutocompleteList
autocompleteQueryValue={autocompleteQueryValue || textInputValue}
handleSearch={searchInServer}
searchQueryItems={searchQueryItems}
searchQueryItem={searchQueryItem}
getAdditionalSections={getAdditionalSections}
onListItemPress={onListItemPress}
onHighlightFirstItem={updateAndScrollToFocusedIndex}
Expand Down
44 changes: 0 additions & 44 deletions src/components/Search/SearchRouter/useAskConcierge.tsx

This file was deleted.

11 changes: 2 additions & 9 deletions src/components/SidePanel/SidePanelContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ function SidePanelContextProvider({children}: PropsWithChildren) {

if (prevShouldHideSidePanel !== shouldHideSidePanel) {
setPrevShouldHideSidePanel(shouldHideSidePanel);
if (shouldHideSidePanel) {
setSessionStartTime(null);
} else if (!sessionStartTime) {
if (!shouldHideSidePanel) {
setSessionStartTime(DateUtils.getDBTime());
}
}
Expand Down Expand Up @@ -137,11 +135,6 @@ function SidePanelContextProvider({children}: PropsWithChildren) {
focusComposerWithDelay(ReportActionComposeFocusManager.composerRef.current, CONST.SIDE_PANEL_ANIMATED_TRANSITION + CONST.COMPOSER_FOCUS_DELAY)(true);
};

const openSidePanel = () => {
setSessionStartTime(DateUtils.getDBTime());
SidePanelActions.openSidePanel(!isExtraLargeScreenWidth);
};

// Because of the React Compiler we don't need to memoize it manually
// eslint-disable-next-line react/jsx-no-constructed-context-values
const stateValue = {
Expand All @@ -160,7 +153,7 @@ function SidePanelContextProvider({children}: PropsWithChildren) {
// Because of the React Compiler we don't need to memoize it manually
// eslint-disable-next-line react/jsx-no-constructed-context-values
const actionsValue = {
openSidePanel,
openSidePanel: () => SidePanelActions.openSidePanel(!isExtraLargeScreenWidth),
closeSidePanel,
};

Expand Down
25 changes: 0 additions & 25 deletions src/hooks/useOpenConciergeAnywhere/index.native.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions src/hooks/useOpenConciergeAnywhere/index.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7818,7 +7818,6 @@ Fügen Sie weitere Ausgabelimits hinzu, um den Cashflow Ihres Unternehmens zu sc
recentSearches: 'Letzte Suchen',
recentChats: 'Neueste Chats',
searchIn: 'Suchen in',
askConcierge: (message: string) => `Frage Concierge „${message}“`,
searchPlaceholder: 'Nach etwas suchen...',
suggestions: 'Vorschläge',
suggestionsAvailable: (
Expand Down
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7831,7 +7831,6 @@ const translations = {
recentSearches: 'Recent searches',
recentChats: 'Recent chats',
searchIn: 'Search in',
askConcierge: (message: string) => `Ask Concierge “${message}”`,
searchPlaceholder: 'Search for something...',
suggestions: 'Suggestions',
suggestionsAvailable: ({count}: {count: number}, query = '') => ({
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7676,7 +7676,6 @@ ${amount} para ${merchant} - ${date}`,
recentSearches: 'Búsquedas recientes',
recentChats: 'Chats recientes',
searchIn: 'Buscar en',
askConcierge: (message: string) => `Pregunta a Concierge “${message}”`,
searchPlaceholder: 'Busca algo...',
suggestions: 'Sugerencias',
suggestionsAvailable: ({count}: {count: number}, query = '') => ({
Expand Down
1 change: 0 additions & 1 deletion src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7840,7 +7840,6 @@ Ajoutez davantage de règles de dépenses pour protéger la trésorerie de l’e
recentSearches: 'Recherches récentes',
recentChats: 'Discussions récentes',
searchIn: 'Rechercher dans',
askConcierge: (message: string) => `Demander à Concierge « ${message} »`,
searchPlaceholder: 'Rechercher quelque chose...',
suggestions: 'Suggestions',
suggestionsAvailable: (
Expand Down
1 change: 0 additions & 1 deletion src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7808,7 +7808,6 @@ Aggiungi altre regole di spesa per proteggere il flusso di cassa aziendale.`,
recentSearches: 'Ricerche recenti',
recentChats: 'Chat recenti',
searchIn: 'Cerca in',
askConcierge: (message: string) => `Chiedi a Concierge “${message}”`,
searchPlaceholder: 'Cerca qualcosa...',
suggestions: 'Suggerimenti',
suggestionsAvailable: (
Expand Down
Loading
Loading