From a3721502f5a1a07362bfd8c98dfd135a36deeb1a Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 2 Sep 2020 12:22:48 +0200 Subject: [PATCH 1/7] add sample file during publish --- content/pages/publish.json | 9 ++++++++- src/components/atoms/Button.tsx | 2 ++ src/components/pages/Publish/Preview.tsx | 14 ++++++++++++++ src/components/pages/Publish/PublishForm.tsx | 3 +-- src/components/pages/Publish/index.tsx | 13 ------------- 5 files changed, 25 insertions(+), 16 deletions(-) diff --git a/content/pages/publish.json b/content/pages/publish.json index 59ea6e2e7..58487ac67 100644 --- a/content/pages/publish.json +++ b/content/pages/publish.json @@ -20,12 +20,19 @@ }, { "name": "files", - "label": "Files", + "label": "File", "placeholder": "e.g. https://file.com/file.json", "help": "Please provide a URL to your data set file.", "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.", + "type": "files" + }, { "name": "access", "label": "Access Type", diff --git a/src/components/atoms/Button.tsx b/src/components/atoms/Button.tsx index 7e3769742..6327e46f1 100644 --- a/src/components/atoms/Button.tsx +++ b/src/components/atoms/Button.tsx @@ -17,6 +17,8 @@ interface ButtonProps { style?: 'primary' | 'ghost' | 'text' type?: 'submit' download?: boolean + target?: string + rel?: string } export default function Button({ diff --git a/src/components/pages/Publish/Preview.tsx b/src/components/pages/Publish/Preview.tsx index 00789ebbb..79655a7c1 100644 --- a/src/components/pages/Publish/Preview.tsx +++ b/src/components/pages/Publish/Preview.tsx @@ -6,6 +6,7 @@ import MetaItem from '../../organisms/AssetContent/MetaItem' import styles from './Preview.module.css' import File from '../../atoms/File' import { MetadataPublishForm } from '../../../@types/MetaData' +import Button from '../../atoms/Button' export default function Preview({ values @@ -25,6 +26,18 @@ export default function Preview({ small /> )} + {values.links && values.links.length && ( + + )} {values.tags && } @@ -37,6 +50,7 @@ export default function Preview({ key.includes('description') || key.includes('tags') || key.includes('files') || + key.includes('links') || key.includes('termsAndConditions') || key.includes('price') || value === undefined || diff --git a/src/components/pages/Publish/PublishForm.tsx b/src/components/pages/Publish/PublishForm.tsx index ac4ff747e..7b927adf2 100644 --- a/src/components/pages/Publish/PublishForm.tsx +++ b/src/components/pages/Publish/PublishForm.tsx @@ -1,6 +1,6 @@ import React, { ReactElement, useEffect, FormEvent } from 'react' import styles from './PublishForm.module.css' -import { useOcean, usePublish } from '@oceanprotocol/react' +import { useOcean } from '@oceanprotocol/react' import { useFormikContext, Form, Field } from 'formik' import Input from '../../atoms/Input' import Button from '../../atoms/Button' @@ -25,7 +25,6 @@ export default function PublishForm({ setErrors, setTouched, resetForm, - setValues, initialValues } = useFormikContext() const formName = 'ocean-publish-form' diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx index 187d28750..94c38ab6b 100644 --- a/src/components/pages/Publish/index.tsx +++ b/src/components/pages/Publish/index.tsx @@ -27,12 +27,6 @@ export default function PublishPage({ values: MetadataPublishForm, resetForm: () => void ): Promise { - // console.log(` - // Collected form values: - // ---------------------- - // ${JSON.stringify(values, null, 2)} - // `) - const metadata = transformPublishFormToMetadata(values) const { tokensToMint, @@ -42,13 +36,6 @@ export default function PublishPage({ } = values.price const serviceType = values.access === 'Download' ? 'access' : 'compute' - // console.log(` - // Transformed metadata values: - // ---------------------- - // ${JSON.stringify(metadata, null, 2)} - // Tokens to mint: ${tokensToMint} - // `) - try { // mpAddress and mpFee are not yet implemented in ocean js so are not uset const ddo = await publish( From 1972b1dca2d8c87d8484627d3dfb87a4a52af4d3 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 2 Sep 2020 12:31:20 +0200 Subject: [PATCH 2/7] sample output on asset details --- .../organisms/AssetContent/MetaSecondary.tsx | 22 ++++++++++--------- .../organisms/AssetContent/index.tsx | 2 +- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/components/organisms/AssetContent/MetaSecondary.tsx b/src/components/organisms/AssetContent/MetaSecondary.tsx index d7587f5db..aebd331b4 100644 --- a/src/components/organisms/AssetContent/MetaSecondary.tsx +++ b/src/components/organisms/AssetContent/MetaSecondary.tsx @@ -1,10 +1,9 @@ import React, { ReactElement } from 'react' -import shortid from 'shortid' -import { ListItem } from '../../atoms/Lists' import MetaItem from './MetaItem' import styles from './MetaSecondary.module.css' import { MetadataMarket } from '../../../@types/Metadata' import Tags from '../../atoms/Tags' +import Button from '../../atoms/Button' export default function MetaSecondary({ metadata @@ -15,18 +14,21 @@ export default function MetaSecondary({ return (