diff --git a/src/components/DataTable/DataTable.tsx b/src/components/DataTable/DataTable.tsx index 50fc67e..6d1734a 100644 --- a/src/components/DataTable/DataTable.tsx +++ b/src/components/DataTable/DataTable.tsx @@ -24,7 +24,6 @@ export function DataTable({ }: { data: any[]; columns: any[]; - subRow?: any; sorting: SortingState; setSorting: Dispatch>; filtersEnabled: boolean; diff --git a/src/pages/homepage/Homepage.tsx b/src/pages/homepage/Homepage.tsx index d4f6efa..5e42548 100644 --- a/src/pages/homepage/Homepage.tsx +++ b/src/pages/homepage/Homepage.tsx @@ -27,14 +27,14 @@ export function Homepage() { currentLocation, setCurrentLocation, } = useCommonHooks(); - const dateOptions: Intl.DateTimeFormatOptions = !isMobile - ? { + const dateOptions: Intl.DateTimeFormatOptions = isMobile + ? {} + : { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', - } - : {}; + }; const date = new Date().toLocaleDateString('en-US', dateOptions); diff --git a/src/pages/homepage/components/Search/Search.tsx b/src/pages/homepage/components/Search/Search.tsx index 118dfca..0172430 100644 --- a/src/pages/homepage/components/Search/Search.tsx +++ b/src/pages/homepage/components/Search/Search.tsx @@ -139,6 +139,8 @@ export default function Search({ } if (item.key === 'Enter') { if (providerLabel === 'Show help') { + setSearchValue(''); + closeDropdown(); openProviderModal(); } else if (item.target.value.startsWith('/')) { mutateAsync({ @@ -162,9 +164,9 @@ export default function Search({ open(validUrl, '_self'); } else if (urlPattern.test(item.target.value)) { if (/^(https?:\/\/).*/i.test(item.target.value)) - window.location = item.target.value; + globalThis.location = item.target.value; else open(`https://${item.target.value}`, '_self'); - } else if (item.target.value !== '') { + } else if (item.target.value.length > 0) { mutateAsync({ method: 'POST', endpoint: searchEndpoint, @@ -309,19 +311,17 @@ export default function Search({ }; }); } - const historyOptions = [ - ...options - .filter((option: any) => { - return splittedSearch.every((searchWord) => - option.value - .toLowerCase() - .trim() - .split(' ') - .some((word: string) => word.includes(searchWord)), - ); - }) - .slice(0, 10 * historyMultiplier), - ]; + const historyOptions = options + .filter((option: any) => { + return splittedSearch.every((searchWord) => + option.value + .toLowerCase() + .trim() + .split(' ') + .some((word: string) => word.includes(searchWord)), + ); + }) + .slice(0, 10 * historyMultiplier); if (historyOptions.length >= 10 * historyMultiplier) { return [ @@ -343,43 +343,14 @@ export default function Search({ const renderItem: any = (item: any) => { const Icon = allIcons[ - (item.option.icon ?? item.option.prefix === '/g') - ? 'FaGoogle' - : (providers.find((p: Provider) => p.prefix === item.option.prefix)?.icon ?? '') + item.option.icon + ? item.option.icon + : item.option.prefix === '/g' + ? 'FaGoogle' + : (providers.find((p: Provider) => p.prefix === item.option.prefix)?.icon ?? + '') ]; - return !searchValue.startsWith('!') ? ( - item.option.value === 'load' ? ( - { - e.preventDefault(); - e.stopPropagation(); - setHistoryMultiplier((prev: number) => prev + 1); - }} - > - - {item.option.label} - - - ) : ( - - ) - ) : ( + return searchValue.startsWith('!') ? ( + ) : item.option.value === 'load' ? ( + { + e.preventDefault(); + e.stopPropagation(); + setHistoryMultiplier((prev: number) => prev + 1); + }} + > + + {item.option.label} + + + ) : ( + ); }; @@ -490,7 +491,7 @@ export default function Search({ return ( <> - {dropdownOpened && } + {dropdownOpened && }