mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Merge branch 'main' into feature/consume
This commit is contained in:
commit
581e9d05d6
1592
package-lock.json
generated
1592
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -5,7 +5,7 @@
|
|||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"homepage": "https://oceanprotocol.com",
|
"homepage": "https://oceanprotocol.com",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "gatsby clean && gatsby develop --host 0.0.0.0",
|
"start": "gatsby develop --host 0.0.0.0",
|
||||||
"build": "gatsby clean && gatsby build",
|
"build": "gatsby clean && gatsby build",
|
||||||
"serve": "serve -s public/",
|
"serve": "serve -s public/",
|
||||||
"jest": "NODE_ENV=test jest -c tests/unit/jest.config.js",
|
"jest": "NODE_ENV=test jest -c tests/unit/jest.config.js",
|
||||||
@ -38,7 +38,7 @@
|
|||||||
"filesize": "^6.1.0",
|
"filesize": "^6.1.0",
|
||||||
"formik": "^2.1.5",
|
"formik": "^2.1.5",
|
||||||
"formik-persist": "^1.1.0",
|
"formik-persist": "^1.1.0",
|
||||||
"gatsby": "^2.24.24",
|
"gatsby": "^2.24.27",
|
||||||
"gatsby-image": "^2.4.14",
|
"gatsby-image": "^2.4.14",
|
||||||
"gatsby-plugin-manifest": "^2.4.21",
|
"gatsby-plugin-manifest": "^2.4.21",
|
||||||
"gatsby-plugin-react-helmet": "^3.3.10",
|
"gatsby-plugin-react-helmet": "^3.3.10",
|
||||||
@ -70,23 +70,23 @@
|
|||||||
"shortid": "^2.2.15",
|
"shortid": "^2.2.15",
|
||||||
"slugify": "^1.4.5",
|
"slugify": "^1.4.5",
|
||||||
"swr": "^0.3.0",
|
"swr": "^0.3.0",
|
||||||
"yup": "^0.29.2"
|
"yup": "^0.29.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.11.0",
|
"@babel/core": "^7.11.1",
|
||||||
"@babel/preset-typescript": "^7.10.1",
|
"@babel/preset-typescript": "^7.10.1",
|
||||||
"@storybook/addon-actions": "^6.0.0-rc.24",
|
"@storybook/addon-actions": "^6.0.0-rc.26",
|
||||||
"@storybook/addon-storyshots": "^6.0.0-rc.24",
|
"@storybook/addon-storyshots": "^6.0.0-rc.26",
|
||||||
"@storybook/react": "^6.0.0-rc.24",
|
"@storybook/react": "^6.0.0-rc.26",
|
||||||
"@svgr/webpack": "^5.4.0",
|
"@svgr/webpack": "^5.4.0",
|
||||||
"@testing-library/jest-dom": "^5.11.2",
|
"@testing-library/jest-dom": "^5.11.2",
|
||||||
"@testing-library/react": "^10.4.7",
|
"@testing-library/react": "^10.4.8",
|
||||||
"@types/jest": "^26.0.8",
|
"@types/jest": "^26.0.8",
|
||||||
"@types/loadable__component": "^5.13.0",
|
"@types/loadable__component": "^5.13.0",
|
||||||
"@types/node": "^14.0.27",
|
"@types/node": "^14.0.27",
|
||||||
"@types/react": "^16.9.44",
|
"@types/react": "^16.9.44",
|
||||||
"@types/react-datepicker": "^3.1.1",
|
"@types/react-datepicker": "^3.1.1",
|
||||||
"@types/react-helmet": "^6.0.0",
|
"@types/react-helmet": "^6.1.0",
|
||||||
"@types/react-paginate": "^6.2.1",
|
"@types/react-paginate": "^6.2.1",
|
||||||
"@types/react-tabs": "^2.3.2",
|
"@types/react-tabs": "^2.3.2",
|
||||||
"@types/shortid": "0.0.29",
|
"@types/shortid": "0.0.29",
|
||||||
|
@ -6,26 +6,17 @@ import FilesInput from '../../molecules/FormFields/FilesInput'
|
|||||||
import Terms from '../../molecules/FormFields/Terms'
|
import Terms from '../../molecules/FormFields/Terms'
|
||||||
import Price from '../../molecules/FormFields/Price'
|
import Price from '../../molecules/FormFields/Price'
|
||||||
|
|
||||||
const DefaultInput = (
|
const DefaultInput = (props: InputProps) => (
|
||||||
{ name, type }: { name: string; type?: string },
|
<input className={styles.input} id={props.name} {...props} />
|
||||||
props: InputProps
|
|
||||||
) => (
|
|
||||||
<input
|
|
||||||
id={name}
|
|
||||||
className={styles.input}
|
|
||||||
name={name}
|
|
||||||
{...props}
|
|
||||||
type={type || 'text'}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
export default function InputElement(props: InputProps): ReactElement {
|
export default function InputElement(props: InputProps): ReactElement {
|
||||||
const { type, options, rows, name, prefix, postfix } = props
|
const { type, options, name, prefix, postfix } = props
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'select':
|
case 'select':
|
||||||
return (
|
return (
|
||||||
<select id={name} className={styles.select} name={name} {...props}>
|
<select id={name} className={styles.select} {...props}>
|
||||||
<option value="">---</option>
|
<option value="">---</option>
|
||||||
{options &&
|
{options &&
|
||||||
options
|
options
|
||||||
@ -38,15 +29,7 @@ export default function InputElement(props: InputProps): ReactElement {
|
|||||||
</select>
|
</select>
|
||||||
)
|
)
|
||||||
case 'textarea':
|
case 'textarea':
|
||||||
return (
|
return <textarea id={name} className={styles.input} {...props} />
|
||||||
<textarea
|
|
||||||
id={name}
|
|
||||||
className={styles.input}
|
|
||||||
rows={rows}
|
|
||||||
name={name}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
case 'radio':
|
case 'radio':
|
||||||
case 'checkbox':
|
case 'checkbox':
|
||||||
return (
|
return (
|
||||||
@ -58,7 +41,6 @@ export default function InputElement(props: InputProps): ReactElement {
|
|||||||
className={styles.radio}
|
className={styles.radio}
|
||||||
id={slugify(option)}
|
id={slugify(option)}
|
||||||
type={type}
|
type={type}
|
||||||
name={name}
|
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
<label className={styles.radioLabel} htmlFor={slugify(option)}>
|
<label className={styles.radioLabel} htmlFor={slugify(option)}>
|
||||||
@ -69,20 +51,20 @@ export default function InputElement(props: InputProps): ReactElement {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
case 'files':
|
case 'files':
|
||||||
return <FilesInput name={name} {...props} />
|
return <FilesInput {...props} />
|
||||||
case 'price':
|
case 'price':
|
||||||
return <Price name={name} {...props} />
|
return <Price {...props} />
|
||||||
case 'terms':
|
case 'terms':
|
||||||
return <Terms name={name} {...props} />
|
return <Terms {...props} />
|
||||||
default:
|
default:
|
||||||
return prefix || postfix ? (
|
return prefix || postfix ? (
|
||||||
<div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}>
|
<div className={`${prefix ? styles.prefixGroup : styles.postfixGroup}`}>
|
||||||
{prefix && <div className={styles.prefix}>{prefix}</div>}
|
{prefix && <div className={styles.prefix}>{prefix}</div>}
|
||||||
<DefaultInput name={name} type={type || 'text'} />
|
<DefaultInput type={type || 'text'} {...props} />
|
||||||
{postfix && <div className={styles.postfix}>{postfix}</div>}
|
{postfix && <div className={styles.postfix}>{postfix}</div>}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<DefaultInput name={name} type={type || 'text'} />
|
<DefaultInput type={type || 'text'} {...props} />
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,44 @@
|
|||||||
import React from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { Link } from 'gatsby'
|
import { Link } from 'gatsby'
|
||||||
import Dotdotdot from 'react-dotdotdot'
|
import Dotdotdot from 'react-dotdotdot'
|
||||||
import { MetadataMarket } from '../../@types/Metadata'
|
import { MetadataMarket } from '../../@types/Metadata'
|
||||||
import Price from '../atoms/Price'
|
import Price from '../atoms/Price'
|
||||||
import styles from './AssetTeaser.module.css'
|
import styles from './AssetTeaser.module.css'
|
||||||
|
import { useMetadata } from '@oceanprotocol/react'
|
||||||
|
import { DDO } from '@oceanprotocol/lib'
|
||||||
|
|
||||||
declare type AssetTeaserProps = {
|
declare type AssetTeaserProps = {
|
||||||
did: string
|
ddo: DDO
|
||||||
metadata: MetadataMarket
|
metadata: MetadataMarket
|
||||||
}
|
}
|
||||||
|
|
||||||
const AssetTeaser: React.FC<AssetTeaserProps> = ({
|
const AssetTeaser: React.FC<AssetTeaserProps> = ({
|
||||||
did,
|
ddo,
|
||||||
metadata
|
metadata
|
||||||
}: AssetTeaserProps) => {
|
}: AssetTeaserProps) => {
|
||||||
if (!metadata.additionalInformation) return null
|
if (!metadata.additionalInformation) return null
|
||||||
|
|
||||||
const { name } = metadata.main
|
const { name } = metadata.main
|
||||||
const { description, access } = metadata.additionalInformation
|
const { description } = metadata.additionalInformation
|
||||||
|
|
||||||
|
const { getBestPrice } = useMetadata(ddo.id)
|
||||||
|
const [price, setPrice] = useState<string>()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
async function init() {
|
||||||
|
const price = await getBestPrice(ddo.dataToken)
|
||||||
|
price && setPrice(price)
|
||||||
|
}
|
||||||
|
init()
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<article className={styles.teaser}>
|
<article className={styles.teaser}>
|
||||||
<Link to={`/asset/${did}`} className={styles.link}>
|
<Link to={`/asset/${ddo.id}`} className={styles.link}>
|
||||||
<h1 className={styles.title}>{name}</h1>
|
<h1 className={styles.title}>{name}</h1>
|
||||||
{access === 'Compute' && (
|
{/* {access === 'Compute' && (
|
||||||
<div className={styles.accessLabel}>{access}</div>
|
<div className={styles.accessLabel}>{access}</div>
|
||||||
)}
|
)} */}
|
||||||
|
|
||||||
<div className={styles.content}>
|
<div className={styles.content}>
|
||||||
<Dotdotdot tagName="p" clamp={3}>
|
<Dotdotdot tagName="p" clamp={3}>
|
||||||
@ -33,7 +46,9 @@ const AssetTeaser: React.FC<AssetTeaserProps> = ({
|
|||||||
</Dotdotdot>
|
</Dotdotdot>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer className={styles.foot}>{/* <Price price={price} /> */}</footer>
|
<footer className={styles.foot}>
|
||||||
|
{price && <Price price={price} />}
|
||||||
|
</footer>
|
||||||
</Link>
|
</Link>
|
||||||
</article>
|
</article>
|
||||||
)
|
)
|
||||||
|
@ -21,7 +21,7 @@ export default function Simple({
|
|||||||
this data set, worth the entered amount of OCEAN will be created.
|
this data set, worth the entered amount of OCEAN will be created.
|
||||||
</FormHelp>
|
</FormHelp>
|
||||||
|
|
||||||
<form className={styles.form}>
|
<div className={styles.form}>
|
||||||
<Label htmlFor="ocean">Ocean Tokens</Label>
|
<Label htmlFor="ocean">Ocean Tokens</Label>
|
||||||
|
|
||||||
<InputElement
|
<InputElement
|
||||||
@ -33,7 +33,7 @@ export default function Simple({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<Conversion price={ocean} className={stylesIndex.conversion} />
|
<Conversion price={ocean} className={stylesIndex.conversion} />
|
||||||
</form>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
@ -50,9 +50,7 @@ const AssetList: React.FC<AssetListProps> = ({ queryResult }) => {
|
|||||||
'metadata'
|
'metadata'
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return <AssetTeaser ddo={ddo} metadata={attributes} key={ddo.id} />
|
||||||
<AssetTeaser did={ddo.id} metadata={attributes} key={ddo.id} />
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
<div className={styles.empty}>
|
<div className={styles.empty}>
|
||||||
|
Loading…
Reference in New Issue
Block a user