= ({
- queryResult,
- className
-}) => {
- const location = useLocation()
-
- // Construct the urls on the pagination links. This is only for UX,
- // since the links are no they will not work by itself.
- function hrefBuilder(pageIndex: number) {
- const newUrl = updateQueryStringParameter(
- location.pathname + location.search,
- 'page',
- `${pageIndex}`
- )
- return newUrl
- }
-
- // // This is what iniitates a new search with new `page`
- // // url parameter
- function onPageChange(selected: number) {
- const newUrl = updateQueryStringParameter(
- location.pathname + location.search,
- 'page',
- `${selected + 1}`
- )
- return navigate(newUrl)
- }
-
- const styleClasses = cx({
- assetList: true,
- [className]: className
- })
-
- return (
- <>
-
- {queryResult?.results.length > 0 ? (
- queryResult.results.map((ddo: DDO) => (
-
- ))
- ) : (
-
No results found.
- )}
-
-
- {/*
- Little hack cause the pagination navigation only works
- on the search page right now.
- */}
- {location.pathname === '/search' && queryResult && (
-
- )}
- >
- )
-}
-
-export default AssetQueryList
diff --git a/src/components/pages/History/PublishedList.tsx b/src/components/pages/History/PublishedList.tsx
index 7543ffbf6..0cd116b8f 100644
--- a/src/components/pages/History/PublishedList.tsx
+++ b/src/components/pages/History/PublishedList.tsx
@@ -3,7 +3,7 @@ import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/Metadata
import { useOcean } from '@oceanprotocol/react'
import React, { ReactElement, useEffect, useState } from 'react'
import Loader from '../../atoms/Loader'
-import AssetQueryList from '../../organisms/AssetQueryList'
+import AssetList from '../../organisms/AssetList'
export default function PublishedList(): ReactElement {
const { ocean, status, accountId } = useOcean()
@@ -29,8 +29,8 @@ export default function PublishedList(): ReactElement {
return isLoading ? (
- ) : accountId && ocean ? (
-
+ ) : accountId && ocean && queryResult ? (
+
) : (
Connect your wallet to see your published data sets.
)
diff --git a/src/components/pages/Home.tsx b/src/components/pages/Home.tsx
index 2acc3c7fd..84111a2a9 100644
--- a/src/components/pages/Home.tsx
+++ b/src/components/pages/Home.tsx
@@ -1,7 +1,7 @@
import React, { ReactElement, useEffect, useState } from 'react'
import SearchBar from '../molecules/SearchBar'
import styles from './Home.module.css'
-import AssetQueryList from '../organisms/AssetQueryList'
+import AssetList from '../organisms/AssetList'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import Container from '../atoms/Container'
import Loader from '../atoms/Loader'
@@ -84,7 +84,7 @@ function SectionQueryResult({
{loading ? (
) : (
- result &&
+ result &&
)}
{action && action}
diff --git a/src/components/templates/Search/index.tsx b/src/components/templates/Search/index.tsx
index 874bfee99..e1d43079a 100644
--- a/src/components/templates/Search/index.tsx
+++ b/src/components/templates/Search/index.tsx
@@ -1,12 +1,14 @@
import React, { ReactElement, useState, useEffect } from 'react'
import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache'
import SearchBar from '../../molecules/SearchBar'
-import AssetQueryList from '../../organisms/AssetQueryList'
+import AssetList from '../../organisms/AssetList'
import styles from './index.module.css'
import queryString from 'query-string'
import PriceFilter from './filterPrice'
import Sort from './sort'
-import { getResults, addExistingParamsToUrl } from './utils'
+import { getResults } from './utils'
+import { navigate } from 'gatsby'
+import { updateQueryStringParameter } from '../../../utils'
import Loader from '../../atoms/Loader'
import { useOcean } from '@oceanprotocol/react'
@@ -44,13 +46,22 @@ export default function SearchPage({
text,
owner,
tags,
- page,
sort,
+ page,
priceType,
sortOrder,
config.metadataCacheUri
])
+ function setPage(page: number) {
+ const newUrl = updateQueryStringParameter(
+ location.pathname + location.search,
+ 'page',
+ `${page}`
+ )
+ return navigate(newUrl)
+ }
+
return (
<>
@@ -69,7 +80,19 @@ export default function SearchPage({
- {loading ?
:
}
+ {loading ? (
+
+ ) : queryResult ? (
+
+ ) : (
+ ''
+ )}
>
)