1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

refactor publish page content

This commit is contained in:
Bogdan Fazakas 2021-02-19 16:08:47 +02:00
parent 243283e434
commit 92547533a5
9 changed files with 242 additions and 240 deletions

View File

@ -0,0 +1,88 @@
{
"title": "Publish",
"data": [
{
"name": "name",
"label": "Title",
"placeholder": "e.g. Shapes of Desert Plants",
"help": "Enter a concise title.",
"required": true
},
{
"name": "description",
"label": "Description",
"help": "Add a thorough description with as much detail as possible. You can use [Markdown](https://daringfireball.net/projects/markdown/basics).",
"type": "textarea",
"required": true
},
{
"name": "files",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "Please provide a URL to your algorith file. This URL will be stored encrypted after publishing.",
"type": "files",
"required": true
},
{
"name": "dockerImage",
"label": "Docker Image",
"placeholder": "e.g. python3.7",
"help": "Please select a predefined image to run your algorithm.",
"type": "select",
"options": ["node:pre-defined", "python:pre-defined", "custom image"],
"required": true
},
{
"name": "image",
"label": "Image URL",
"placeholder": "e.g. node or https://hub.docker.com/_/node",
"disabled": true,
"help": "Provide the name of a docker image or the full url if you have it hosted in a 3rd party repo",
"required": false
},
{
"name": "version",
"label": "Version",
"placeholder": "e.g. 10",
"help": "Provide the version for your image.",
"disabled": true,
"required": false
},
{
"name": "entrypoint",
"label": "Entrypoint",
"placeholder": "e.g. python $ALGO",
"help": "Provide the entrypoint for your algorithm.",
"disabled": true,
"required": false
},
{
"name": "algorithmPrivacy",
"label": "Algorithm Privacy",
"type": "checkbox",
"options": ["Keep my algorithm private"],
"required": false
},
{
"name": "author",
"label": "Author",
"placeholder": "e.g. Jelly McJellyfish",
"help": "Give proper attribution for your algorith.",
"required": true
},
{
"name": "tags",
"label": "Tags",
"placeholder": "e.g. logistics, ai",
"help": "Separate tags with comma."
},
{
"name": "termsAndConditions",
"label": "Terms & Conditions",
"type": "terms",
"options": ["I agree to these Terms and Conditions"],
"required": true
}
],
"success": "Algorithm Published!"
}

View File

@ -0,0 +1,79 @@
{
"title": "Publish",
"data": [
{
"name": "name",
"label": "Title",
"placeholder": "e.g. Shapes of Desert Plants",
"help": "Enter a concise title.",
"required": true
},
{
"name": "description",
"label": "Description",
"help": "Add a thorough description with as much detail as possible. You can use [Markdown](https://daringfireball.net/projects/markdown/basics).",
"type": "textarea",
"required": true
},
{
"name": "files",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "Please provide a URL to your data set file. This URL will be stored encrypted after publishing.",
"type": "files",
"required": true
},
{
"name": "links",
"label": "Sample file",
"placeholder": "e.g. https://file.com/samplefile.json",
"help": "Please provide a URL to a sample of your data set file. This file should reveal the data structure of your data set, e.g. by including the header and one line of a CSV file. This file URL will be publicly available after publishing.",
"type": "files"
},
{
"name": "access",
"label": "Access Type",
"help": "Choose how you want your files to be accessible for the specified price.",
"type": "select",
"options": ["Download"],
"required": true
},
{
"name": "timeout",
"label": "Timeout",
"help": "Define how long buyers should be able to download the data set again after the initial purchase.",
"type": "select",
"options": ["Forever", "1 day", "1 week", "1 month", "1 year"],
"sortOptions": false,
"required": true
},
{
"name": "dataTokenOptions",
"label": "Datatoken Name & Symbol",
"type": "datatoken",
"help": "The datatoken for this data set will be created with this name & symbol.",
"required": true
},
{
"name": "author",
"label": "Author",
"placeholder": "e.g. Jelly McJellyfish",
"help": "Give proper attribution for your data set.",
"required": true
},
{
"name": "tags",
"label": "Tags",
"placeholder": "e.g. logistics, ai",
"help": "Separate tags with comma."
},
{
"name": "termsAndConditions",
"label": "Terms & Conditions",
"type": "terms",
"options": ["I agree to these Terms and Conditions"],
"required": true
}
],
"success": "Asset Created!"
}

5
content/pages/index.json Normal file
View File

@ -0,0 +1,5 @@
{
"title": "Publish",
"description": "Highlight the important features of your data set to make it more discoverable and catch the interest of data consumers.",
"warning": "Given the beta status, publishing on Ropsten or Rinkeby first is strongly recommended. Please familiarize yourself with [the market](https://oceanprotocol.com/technology/marketplaces), [the risks](https://blog.oceanprotocol.com/on-staking-on-data-in-ocean-market-3d8e09eb0a13), and the [Terms of Use](/terms)."
}

View File

@ -1,84 +0,0 @@
{
"title": "Publish",
"description": "Highlight the important features of your data set to make it more discoverable and catch the interest of data consumers.",
"warning": "Given the beta status, publishing on Ropsten or Rinkeby first is strongly recommended. Please familiarize yourself with [the market](https://oceanprotocol.com/technology/marketplaces), [the risks](https://blog.oceanprotocol.com/on-staking-on-data-in-ocean-market-3d8e09eb0a13), and the [Terms of Use](/terms).",
"form": {
"title": "Publish",
"data": [
{
"name": "name",
"label": "Title",
"placeholder": "e.g. Shapes of Desert Plants",
"help": "Enter a concise title.",
"required": true
},
{
"name": "description",
"label": "Description",
"help": "Add a thorough description with as much detail as possible. You can use [Markdown](https://daringfireball.net/projects/markdown/basics).",
"type": "textarea",
"required": true
},
{
"name": "files",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "Please provide a URL to your data set file. This URL will be stored encrypted after publishing.",
"type": "files",
"required": true
},
{
"name": "links",
"label": "Sample file",
"placeholder": "e.g. https://file.com/samplefile.json",
"help": "Please provide a URL to a sample of your data set file. This file should reveal the data structure of your data set, e.g. by including the header and one line of a CSV file. This file URL will be publicly available after publishing.",
"type": "files"
},
{
"name": "access",
"label": "Access Type",
"help": "Choose how you want your files to be accessible for the specified price.",
"type": "select",
"options": ["Download"],
"required": true
},
{
"name": "timeout",
"label": "Timeout",
"help": "Define how long buyers should be able to download the data set again after the initial purchase.",
"type": "select",
"options": ["Forever", "1 day", "1 week", "1 month", "1 year"],
"sortOptions": false,
"required": true
},
{
"name": "dataTokenOptions",
"label": "Datatoken Name & Symbol",
"type": "datatoken",
"help": "The datatoken for this data set will be created with this name & symbol.",
"required": true
},
{
"name": "author",
"label": "Author",
"placeholder": "e.g. Jelly McJellyfish",
"help": "Give proper attribution for your data set.",
"required": true
},
{
"name": "tags",
"label": "Tags",
"placeholder": "e.g. logistics, ai",
"help": "Separate tags with comma."
},
{
"name": "termsAndConditions",
"label": "Terms & Conditions",
"type": "terms",
"options": ["I agree to these Terms and Conditions"],
"required": true
}
],
"success": "Asset Created!"
}
}

View File

@ -1,93 +0,0 @@
{
"title": "Publish",
"description": "Highlight the important features of your algorith to make it more discoverable and catch the interest of data consumers.",
"warning": "Given the beta status, publishing on Ropsten or Rinkeby first is strongly recommended. Please familiarize yourself with [the market](https://oceanprotocol.com/technology/marketplaces), [the risks](https://blog.oceanprotocol.com/on-staking-on-data-in-ocean-market-3d8e09eb0a13), and the [Terms of Use](/terms).",
"form": {
"title": "Publish",
"data": [
{
"name": "name",
"label": "Title",
"placeholder": "e.g. Shapes of Desert Plants",
"help": "Enter a concise title.",
"required": true
},
{
"name": "description",
"label": "Description",
"help": "Add a thorough description with as much detail as possible. You can use [Markdown](https://daringfireball.net/projects/markdown/basics).",
"type": "textarea",
"required": true
},
{
"name": "files",
"label": "File",
"placeholder": "e.g. https://file.com/file.json",
"help": "Please provide a URL to your algorith file. This URL will be stored encrypted after publishing.",
"type": "files",
"required": true
},
{
"name": "dockerImage",
"label": "Docker Image",
"placeholder": "e.g. python3.7",
"help": "Please select a predefined image to run your algorithm.",
"type": "select",
"options": ["node:pre-defined", "python:pre-defined", "custom image"],
"required": true
},
{
"name": "image",
"label": "Image URL",
"placeholder": "e.g. node or https://hub.docker.com/_/node",
"disabled": true,
"help": "Provide the name of a docker image or the full url if you have it hosted in a 3rd party repo",
"required": false
},
{
"name": "version",
"label": "Version",
"placeholder": "e.g. 10",
"help": "Provide the version for your image.",
"disabled": true,
"required": false
},
{
"name": "entrypoint",
"label": "Entrypoint",
"placeholder": "e.g. python $ALGO",
"help": "Provide the entrypoint for your algorithm.",
"disabled": true,
"required": false
},
{
"name": "algorithmPrivacy",
"label": "Algorithm Privacy",
"type": "checkbox",
"options": ["Keep my algorithm private"],
"required": false
},
{
"name": "author",
"label": "Author",
"placeholder": "e.g. Jelly McJellyfish",
"help": "Give proper attribution for your algorith.",
"required": true
},
{
"name": "tags",
"label": "Tags",
"placeholder": "e.g. logistics, ai",
"help": "Separate tags with comma."
},
{
"name": "termsAndConditions",
"label": "Terms & Conditions",
"type": "terms",
"options": ["I agree to these Terms and Conditions"],
"required": true
}
],
"success": "Algorithm Published!"
}
}

View File

@ -1,4 +1,5 @@
import React, { ReactElement, useEffect, FormEvent, ChangeEvent } from 'react' import React, { ReactElement, useEffect, FormEvent, ChangeEvent } from 'react'
import { useStaticQuery, graphql } from 'gatsby'
import styles from './FormPublish.module.css' import styles from './FormPublish.module.css'
import { useOcean } from '@oceanprotocol/react' import { useOcean } from '@oceanprotocol/react'
import { useFormikContext, Field, Form, FormikContextType } from 'formik' import { useFormikContext, Field, Form, FormikContextType } from 'formik'
@ -7,11 +8,37 @@ import Button from '../../atoms/Button'
import { FormContent, FormFieldProps } from '../../../@types/Form' import { FormContent, FormFieldProps } from '../../../@types/Form'
import { AlgorithmPublishForm } from '../../../@types/MetaData' import { AlgorithmPublishForm } from '../../../@types/MetaData'
export default function FormPublish({ const query = graphql`
content query {
}: { content: allFile(
content: FormContent filter: { relativePath: { eq: "pages/form-algorithm.json" } }
}): ReactElement { ) {
edges {
node {
childPagesJson {
title
data {
name
placeholder
label
help
type
required
disabled
sortOptions
options
}
warning
}
}
}
}
}
`
export default function FormPublish({}: {}): ReactElement {
const data = useStaticQuery(query)
const content: FormContent = data.content.edges[0].node.childPagesJson
const { ocean, account } = useOcean() const { ocean, account } = useOcean()
const { const {
status, status,

View File

@ -1,4 +1,5 @@
import React, { ReactElement, useEffect, FormEvent, ChangeEvent } from 'react' import React, { ReactElement, useEffect, FormEvent, ChangeEvent } from 'react'
import { useStaticQuery, graphql } from 'gatsby'
import styles from './FormPublish.module.css' import styles from './FormPublish.module.css'
import { useOcean } from '@oceanprotocol/react' import { useOcean } from '@oceanprotocol/react'
import { useFormikContext, Field, Form, FormikContextType } from 'formik' import { useFormikContext, Field, Form, FormikContextType } from 'formik'
@ -7,11 +8,37 @@ import Button from '../../atoms/Button'
import { FormContent, FormFieldProps } from '../../../@types/Form' import { FormContent, FormFieldProps } from '../../../@types/Form'
import { MetadataPublishForm } from '../../../@types/MetaData' import { MetadataPublishForm } from '../../../@types/MetaData'
export default function FormPublish({ const query = graphql`
content query {
}: { content: allFile(
content: FormContent filter: { relativePath: { eq: "pages/form-dataset.json" } }
}): ReactElement { ) {
edges {
node {
childPagesJson {
title
data {
name
placeholder
label
help
type
required
disabled
sortOptions
options
}
warning
}
}
}
}
}
`
export default function FormPublish({}: {}): ReactElement {
const data = useStaticQuery(query)
const content: FormContent = data.content.edges[0].node.childPagesJson
const { ocean, account } = useOcean() const { ocean, account } = useOcean()
const { const {
status, status,

View File

@ -37,11 +37,9 @@ import Button from '../../atoms/Button'
const formName = 'ocean-publish-form' const formName = 'ocean-publish-form'
export default function PublishPage({ export default function PublishPage({
content, content
contentAlgoPublish
}: { }: {
content: { warning: string; form: FormContent } content: { warning: string }
contentAlgoPublish: { warning: string; form: FormContent }
}): ReactElement { }): ReactElement {
const { debug } = useUserPreferences() const { debug } = useUserPreferences()
const { publish, publishError, isLoading, publishStepText } = usePublish() const { publish, publishError, isLoading, publishStepText } = usePublish()
@ -184,9 +182,9 @@ export default function PublishPage({
/> />
<article className={styles.grid}> <article className={styles.grid}>
{publishType === TypeOfPublish.dataset ? ( {publishType === TypeOfPublish.dataset ? (
<FormPublish content={content.form} /> <FormPublish />
) : ( ) : (
<FormAlgoPublish content={contentAlgoPublish.form} /> <FormAlgoPublish />
)} )}
<aside> <aside>

View File

@ -5,69 +5,24 @@ import { graphql, PageProps } from 'gatsby'
export default function PageGatsbyPublish(props: PageProps): ReactElement { export default function PageGatsbyPublish(props: PageProps): ReactElement {
const content = (props.data as any).content.edges[0].node.childPagesJson const content = (props.data as any).content.edges[0].node.childPagesJson
const contentAlgoPublish = (props.data as any).contentAlgoPublish.edges[0]
.node.childPagesJson
const { title, description } = content const { title, description } = content
return ( return (
<Page title={title} description={description} uri={props.uri}> <Page title={title} description={description} uri={props.uri}>
<PagePublish content={content} contentAlgoPublish={contentAlgoPublish} /> <PagePublish content={content} />
</Page> </Page>
) )
} }
export const contentQuery = graphql` export const contentQuery = graphql`
query PublishPageQuery { query PublishPageQuery {
content: allFile(filter: { relativePath: { eq: "pages/publish.json" } }) { content: allFile(filter: { relativePath: { eq: "pages/index.json" } }) {
edges { edges {
node { node {
childPagesJson { childPagesJson {
title title
description description
warning warning
form {
title
data {
name
placeholder
label
help
type
required
disabled
sortOptions
options
}
success
}
}
}
}
}
contentAlgoPublish: allFile(
filter: { relativePath: { eq: "pages/publishAlgo.json" } }
) {
edges {
node {
childPagesJson {
title
description
warning
form {
title
data {
name
placeholder
label
help
type
required
disabled
sortOptions
options
}
success
}
} }
} }
} }