diff --git a/src/components/molecules/SearchBar.tsx b/src/components/molecules/SearchBar.tsx index c3112493d..78e65a95e 100644 --- a/src/components/molecules/SearchBar.tsx +++ b/src/components/molecules/SearchBar.tsx @@ -17,20 +17,30 @@ export default function SearchBar({ filters?: boolean size?: 'small' | 'large' }): ReactElement { - const [value, setValue] = useState(initialValue || '') - - function handleChange(e: ChangeEvent) { - setValue(e.target.value) - } + let [value, setValue] = useState(initialValue || '') async function startSearch(e: FormEvent) { e.preventDefault() - if (value === '') return + if (value === '') value = ' ' const urlEncodedValue = encodeURIComponent(value) const url = await addExistingParamsToUrl(location, 'text') navigate(`${url}&text=${urlEncodedValue}`) } + async function emptySearch() { + const searchParams = new URLSearchParams(window.location.href) + const text = searchParams.get('text') + if (text !== ('' || undefined || null)) { + const url = await addExistingParamsToUrl(location, 'text') + navigate(`${url}&text=%20`) + } + } + + function handleChange(e: ChangeEvent) { + setValue(e.target.value) + e.target.value === '' && emptySearch() + } + return (
diff --git a/src/components/organisms/AssetActions/Compute/index.tsx b/src/components/organisms/AssetActions/Compute/index.tsx index 62c12d62b..b05a86739 100644 --- a/src/components/organisms/AssetActions/Compute/index.tsx +++ b/src/components/organisms/AssetActions/Compute/index.tsx @@ -492,7 +492,9 @@ export default function Compute({ action={} /> )} - + {type !== 'algorithm' && ( + + )} ) diff --git a/src/pages/search.tsx b/src/pages/search.tsx index d6743f445..cd6a5946c 100644 --- a/src/pages/search.tsx +++ b/src/pages/search.tsx @@ -20,7 +20,7 @@ export default function PageGatsbySearch(props: PageProps): ReactElement { ? `Published by ${accountTruncate(owner as string)}` : `${ totalResults !== undefined - ? searchValue + ? searchValue && searchValue !== ' ' ? totalResults === 0 ? 'No results' : totalResults +