diff --git a/client/src/components/templates/Route.tsx b/client/src/components/templates/Route.tsx index e11d3cb..93732ed 100644 --- a/client/src/components/templates/Route.tsx +++ b/client/src/components/templates/Route.tsx @@ -24,9 +24,9 @@ const Route = ({ {description && } - -
-
+
+
+

{title}

{description && (

)} -

+ +
- {children} -
-
+ {children} + ) diff --git a/client/src/routes/About.tsx b/client/src/routes/About.tsx index 4b41fa3..d076246 100644 --- a/client/src/routes/About.tsx +++ b/client/src/routes/About.tsx @@ -1,5 +1,6 @@ import React, { Component } from 'react' import Route from '../components/templates/Route' +import Content from '../components/atoms/Content' class About extends Component { public render() { @@ -8,28 +9,31 @@ class About extends Component { title="About" description="A marketplace to find and publish open data sets in the Ocean Network." > -

- Commons is built on top of the Ocean{' '} - - Nile test network - {' '} - and is targeted at enthusiastic data scientists with some - crypto experience. It can be used with any Web3-capable - browser, like Firefox with MetaMask installed. -

+ +

+ Commons is built on top of the Ocean{' '} + + Nile test network + {' '} + and is targeted at enthusiastic data scientists with + some crypto experience. It can be used with any + Web3-capable browser, like Firefox with MetaMask + installed. +

- + +
) } diff --git a/client/src/routes/Details/index.tsx b/client/src/routes/Details/index.tsx index 2f3c507..eaefb6c 100644 --- a/client/src/routes/Details/index.tsx +++ b/client/src/routes/Details/index.tsx @@ -5,6 +5,7 @@ import Spinner from '../../components/atoms/Spinner' import { User } from '../../context' import AssetDetails from './AssetDetails' import stylesApp from '../../App.module.scss' +import Content from '../../components/atoms/Content' interface DetailsProps { location: Location @@ -46,7 +47,9 @@ export default class Details extends Component { return metadata.base.name !== '' ? ( - + + + ) : (
diff --git a/client/src/routes/Faucet.tsx b/client/src/routes/Faucet.tsx index 55130b3..fd97dba 100644 --- a/client/src/routes/Faucet.tsx +++ b/client/src/routes/Faucet.tsx @@ -6,6 +6,7 @@ import Spinner from '../components/atoms/Spinner' import { User } from '../context' import Web3message from '../components/organisms/Web3message' import styles from './Faucet.module.scss' +import Content from '../components/atoms/Content' interface FaucetState { isLoading: boolean @@ -101,19 +102,21 @@ export default class Faucet extends PureComponent<{}, FaucetState> { title="Faucet" description="Shower yourself with some Ether for Ocean's Nile test network." > - + + -
- {isLoading ? ( - - ) : error ? ( - - ) : success ? ( - - ) : ( - isWeb3 && - )} -
+
+ {isLoading ? ( + + ) : error ? ( + + ) : success ? ( + + ) : ( + isWeb3 && + )} +
+
) } diff --git a/client/src/routes/History.tsx b/client/src/routes/History.tsx index 70de132..06491e8 100644 --- a/client/src/routes/History.tsx +++ b/client/src/routes/History.tsx @@ -3,16 +3,18 @@ import Route from '../components/templates/Route' import AssetsUser from '../components/organisms/AssetsUser' import Web3message from '../components/organisms/Web3message' import { User } from '../context' +import Content from '../components/atoms/Content' export default class History extends Component { public render() { return ( - {(!this.context.isLogged || !this.context.isOceanNetwork) && ( - - )} + + {(!this.context.isLogged || + !this.context.isOceanNetwork) && } - + + ) } diff --git a/client/src/routes/Home.tsx b/client/src/routes/Home.tsx index 99e6146..df26b51 100644 --- a/client/src/routes/Home.tsx +++ b/client/src/routes/Home.tsx @@ -1,4 +1,5 @@ import React, { ChangeEvent, Component, FormEvent } from 'react' +import { Link } from 'react-router-dom' import { User } from '../context' import { Logger } from '@oceanprotocol/squid' import Spinner from '../components/atoms/Spinner' @@ -11,7 +12,9 @@ import Route from '../components/templates/Route' import styles from './Home.module.scss' import meta from '../data/meta.json' +import formPublish from '../data/form-publish.json' import { History } from 'history' +import Content from '../components/atoms/Content' interface HomeProps { history: History @@ -19,46 +22,15 @@ interface HomeProps { interface HomeState { search?: string - categoryAssets?: Array + categoryAssets?: any[] isLoading?: boolean } -const categories = [ - 'AI For Good', - 'Image Recognition', - 'Dataset Of Datasets', - 'Language', - 'Performing Arts', - 'Visual Arts & Design', - 'Philosophy', - 'History', - 'Theology', - 'Anthropology & Archeology', - 'Sociology', - 'Psychology', - 'Politics', - 'Interdisciplinary', - 'Economics & Finance', - 'Demography', - 'Biology', - 'Chemistry', - 'Physics & Energy', - 'Earth & Climate', - 'Space & Astronomy', - 'Mathematics', - 'Computer Technology', - 'Engineering', - 'Agriculture & Bio Engineering', - 'Transportation', - 'Urban Planning', - 'Medicine', - 'Business & Management', - 'Sports & Recreation', - 'Communication & Journalism', - 'Deep Learning', - 'Law', - 'Other' -] +const categories = + (formPublish.steps[1].fields && + formPublish.steps[1].fields.categories && + formPublish.steps[1].fields.categories.options) || + [] class Home extends Component { public state = { @@ -78,7 +50,7 @@ class Home extends Component { offset: 25, page: 1, query: { - categories: ["Economics & Finance"], + categories: ['Engineering'], price: [-1, 1] }, sort: { @@ -99,55 +71,59 @@ class Home extends Component { } public render() { + const { categoryAssets, isLoading, search } = this.state return ( -
- - Search - - } - /> -
-
+ +
+ + Search + + } + /> +
+
+ +

AI for Good

- { - this.state.isLoading ? ( - - ) : this.state.categoryAssets && this.state.categoryAssets.length ? ( -
- {this.state.categoryAssets.map((asset: any) => ( - - ))} -
- ) : ( -
No data sets found.
- ) - } + {isLoading ? ( + + ) : categoryAssets && categoryAssets.length ? ( +
+ {categoryAssets.map((asset: any) => ( + + ))} +
+ ) : ( +
No data sets found.
+ )}

Explore Categories

{categories.map((category: string) => ( -
- + + {category} -
+ ))}
-
+
) } diff --git a/client/src/routes/NotFound.tsx b/client/src/routes/NotFound.tsx index 684af7b..5561ef2 100644 --- a/client/src/routes/NotFound.tsx +++ b/client/src/routes/NotFound.tsx @@ -1,9 +1,14 @@ import React, { Component } from 'react' import Route from '../components/templates/Route' +import Content from '../components/atoms/Content' class NotFound extends Component { public render() { - return Not Found + return ( + + Not Found + + ) } } diff --git a/client/src/routes/Publish/index.tsx b/client/src/routes/Publish/index.tsx index 86b6857..93c72cc 100644 --- a/client/src/routes/Publish/index.tsx +++ b/client/src/routes/Publish/index.tsx @@ -10,6 +10,7 @@ import Progress from './Progress' import ReactGA from 'react-ga' import { steps } from '../../data/form-publish.json' +import Content from '../../components/atoms/Content' type AssetType = 'dataset' | 'algorithm' | 'container' | 'workflow' | 'other' @@ -319,33 +320,37 @@ class Publish extends Component<{}, PublishState> { title="Publish" description="Publish a new data set into the Ocean Protocol Network." > - {(!this.context.isLogged || !this.context.isOceanNetwork) && ( - - )} + + {(!this.context.isLogged || + !this.context.isOceanNetwork) && } - + -
- {steps.map((step: any, index: number) => ( - - ))} - +
+ {steps.map((step: any, index: number) => ( + + ))} + +
) } diff --git a/client/src/routes/Search.tsx b/client/src/routes/Search.tsx index f8832c5..6b43688 100644 --- a/client/src/routes/Search.tsx +++ b/client/src/routes/Search.tsx @@ -8,6 +8,7 @@ import { User } from '../context' import Asset from '../components/molecules/Asset' import Pagination from '../components/molecules/Pagination' import styles from './Search.module.scss' +import Content from '../components/atoms/Content' interface SearchProps { location: Location @@ -22,6 +23,7 @@ interface SearchState { currentPage: number isLoading: boolean searchTerm: string + searchCategories: string } export default class Search extends PureComponent { @@ -32,17 +34,25 @@ export default class Search extends PureComponent { totalPages: 1, currentPage: 1, isLoading: true, - searchTerm: '' + searchTerm: '', + searchCategories: '' } public async componentDidMount() { const searchTerm = await queryString.parse(this.props.location.search) .text - const searchPage = queryString.parse(this.props.location.search).page + const searchPage = await queryString.parse(this.props.location.search) + .page + const searchCategories = await queryString.parse( + this.props.location.search + ).categories - await this.setState({ - searchTerm: encodeURIComponent(`${searchTerm}`) - }) + if (searchTerm || searchCategories) { + await this.setState({ + searchTerm: encodeURIComponent(`${searchTerm}`), + searchCategories: `${searchCategories}` + }) + } // switch to respective page if query string is present if (searchPage) { @@ -55,12 +65,14 @@ export default class Search extends PureComponent { private searchAssets = async () => { const { ocean } = this.context + const { offset, currentPage, searchTerm, searchCategories } = this.state const searchQuery = { - offset: this.state.offset, - page: this.state.currentPage, + offset, + page: currentPage, query: { - text: [decodeURIComponent(this.state.searchTerm)], + text: [decodeURIComponent(searchTerm)], + categories: [decodeURIComponent(searchCategories)], price: [-1, 1] }, sort: { @@ -113,6 +125,7 @@ export default class Search extends PureComponent { return ( + {totalResults > 0 && (

{ __html: `${totalResults} results for ${decodeURIComponent( this.state.searchTerm )}` - }} - /> - )} - {this.renderResults()} + }} + /> + )} + {this.renderResults()} - + + ) } diff --git a/client/src/routes/Styleguide.tsx b/client/src/routes/Styleguide.tsx index caafdc9..ebf161a 100644 --- a/client/src/routes/Styleguide.tsx +++ b/client/src/routes/Styleguide.tsx @@ -5,6 +5,7 @@ import Input from '../components/atoms/Form/Input' import Route from '../components/templates/Route' import styles from './Styleguide.module.scss' import form from '../data/form-styleguide.json' +import Content from '../components/atoms/Content' class Styleguide extends Component { public formFields = (entries: any[]) => @@ -25,18 +26,22 @@ class Styleguide extends Component { const entries = Object.entries(form.fields) return ( -
- - - - -
+ +
+ + + + +
-
- {this.formFields(entries)} -
+
+ {this.formFields(entries)} +
+
) }