From fe31539d6982554504591026ab04ac917d82ac6e Mon Sep 17 00:00:00 2001 From: grafixeyehero Date: Mon, 15 Jul 2024 22:15:52 +0300 Subject: [PATCH] apply suggestion Co-authored-by: Bill Thornton --- src/components/search/SearchFields.tsx | 3 +-- src/hooks/searchHook/useSearchItems.ts | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/components/search/SearchFields.tsx b/src/components/search/SearchFields.tsx index e9eb6325ce..865e8d7520 100644 --- a/src/components/search/SearchFields.tsx +++ b/src/components/search/SearchFields.tsx @@ -24,8 +24,7 @@ const SearchFields: FC = ({ const inputValue = inputRef.current?.value || ''; if (value === 'backspace') { - onSearch(inputValue.length ? inputValue.substring(0, inputValue.length - 1) : '' - ); + onSearch(inputValue.length ? inputValue.substring(0, inputValue.length - 1) : ''); } else { onSearch(inputValue + value); } diff --git a/src/hooks/searchHook/useSearchItems.ts b/src/hooks/searchHook/useSearchItems.ts index c88d8f2f4e..e720c8ac17 100644 --- a/src/hooks/searchHook/useSearchItems.ts +++ b/src/hooks/searchHook/useSearchItems.ts @@ -18,7 +18,7 @@ import { useApi } from '../useApi'; import type { CardOptions } from 'types/cardOptions'; import { CardShape } from 'utils/card'; -const Parameters_OPTIONS = { +const QUERY_OPTIONS = { limit: 100, fields: [ ItemFields.PrimaryImageAspectRatio, @@ -37,7 +37,7 @@ const fetchItemsByType = async ( ) => { const response = await getItemsApi(api).getItems( { - ...Parameters_OPTIONS, + ...QUERY_OPTIONS, userId: userId, recursive: true, ...params @@ -55,7 +55,7 @@ const fetchPeople = async ( ) => { const response = await getPersonsApi(api).getPersons( { - ...Parameters_OPTIONS, + ...QUERY_OPTIONS, userId: userId, ...params }, @@ -72,7 +72,7 @@ const fetchArtists = async ( ) => { const response = await getArtistsApi(api).getArtists( { - ...Parameters_OPTIONS, + ...QUERY_OPTIONS, userId: userId, ...params }, @@ -93,7 +93,7 @@ const isTVShows = (collectionType: string) => const isLivetv = (collectionType: string) => collectionType === CollectionType.Livetv; -const Livetv_CARD_OPTIONS = { +const LIVETV_CARD_OPTIONS = { preferThumb: true, inheritThumb: false, showParentTitleOrTitle: true, @@ -151,7 +151,7 @@ export const useSearchItems = ( { signal } ); addSection('Movies', moviesData.Items, { - ...Livetv_CARD_OPTIONS, + ...LIVETV_CARD_OPTIONS, shape: CardShape.PortraitOverflow }); @@ -171,7 +171,7 @@ export const useSearchItems = ( { signal } ); addSection('Episodes', episodesData.Items, { - ...Livetv_CARD_OPTIONS + ...LIVETV_CARD_OPTIONS }); // Sports row @@ -186,7 +186,7 @@ export const useSearchItems = ( { signal } ); addSection('Sports', sportsData.Items, { - ...Livetv_CARD_OPTIONS + ...LIVETV_CARD_OPTIONS }); // Kids row @@ -201,7 +201,7 @@ export const useSearchItems = ( { signal } ); addSection('Kids', kidsData.Items, { - ...Livetv_CARD_OPTIONS + ...LIVETV_CARD_OPTIONS }); // News row @@ -216,7 +216,7 @@ export const useSearchItems = ( { signal } ); addSection('News', newsData.Items, { - ...Livetv_CARD_OPTIONS + ...LIVETV_CARD_OPTIONS }); // Programs row @@ -235,7 +235,7 @@ export const useSearchItems = ( { signal } ); addSection('Programs', programsData.Items, { - ...Livetv_CARD_OPTIONS + ...LIVETV_CARD_OPTIONS }); // Channels row @@ -420,7 +420,7 @@ export const useSearchItems = ( { signal } ); addSection('Programs', programsData.Items, { - ...Livetv_CARD_OPTIONS + ...LIVETV_CARD_OPTIONS }); // Channels row