diff --git a/src/components/pages/Publish/Preview.tsx b/src/components/pages/Publish/Preview.tsx
index 212f8370a..f89e9e80a 100644
--- a/src/components/pages/Publish/Preview.tsx
+++ b/src/components/pages/Publish/Preview.tsx
@@ -38,6 +38,7 @@ export default function Preview({
key.includes('tags') ||
key.includes('files') ||
key.includes('termsAndConditions') ||
+ key.includes('price') ||
value === undefined ||
value === ''
)
diff --git a/src/components/pages/Publish/PublishForm.tsx b/src/components/pages/Publish/PublishForm.tsx
index 96a3180da..2c5d2c329 100644
--- a/src/components/pages/Publish/PublishForm.tsx
+++ b/src/components/pages/Publish/PublishForm.tsx
@@ -19,7 +19,6 @@ export default function PublishForm({
status,
setStatus,
isValid,
- touched,
setErrors,
setTouched,
resetForm,
@@ -42,7 +41,6 @@ export default function PublishForm({
{content.data.map((field: FormFieldProps) => (
))}
-
{isLoading ? (
) : (
diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx
index 669e1a03c..eac998386 100644
--- a/src/components/pages/Publish/index.tsx
+++ b/src/components/pages/Publish/index.tsx
@@ -7,7 +7,7 @@ import styles from './index.module.css'
import PublishForm from './PublishForm'
import Web3Feedback from '../../molecules/Wallet/Feedback'
import { FormContent } from '../../../@types/Form'
-import { initialValues, validationSchema } from './validation'
+import { initialValues, validationSchema } from '../../../models/FormPublish'
import { MetadataPublishForm } from '../../../@types/Metadata'
import { transformPublishFormToMetadata } from './utils'
import Preview from './Preview'
@@ -28,20 +28,20 @@ export default function PublishPage({
`)
const metadata = transformPublishFormToMetadata(values)
- const tokensToMint = '4' // how to know this?
+ const { cost, tokensToMint } = values.price
const serviceType = values.access === 'Download' ? 'access' : 'compute'
console.log(`
Transformed metadata values:
----------------------
${JSON.stringify(metadata, null, 2)}
- Cost: 1
+ Cost: ${cost}
Tokens to mint: ${tokensToMint}
`)
try {
- const ddo = await publish(metadata as any, tokensToMint, [
- { serviceType, cost: '1' }
+ const ddo = await publish(metadata as any, tokensToMint.toString(), [
+ { serviceType, cost: cost.toString() }
])
if (publishError) {
@@ -82,6 +82,26 @@ export default function PublishPage({
+
+
+
Collected Form Values
+
+ {JSON.stringify(values, null, 2)}
+
+
+
+
+
Transformed Values
+
+
+ {JSON.stringify(
+ transformPublishFormToMetadata(values),
+ null,
+ 2
+ )}
+
+
+
>
)}
diff --git a/src/components/pages/Publish/utils.ts b/src/components/pages/Publish/utils.ts
index 02649893a..5edad4ca4 100644
--- a/src/components/pages/Publish/utils.ts
+++ b/src/components/pages/Publish/utils.ts
@@ -16,8 +16,7 @@ export function transformPublishFormToMetadata(
tags,
links,
termsAndConditions,
- files,
- access
+ files
} = data
const metadata: MetadataMarket = {
@@ -38,8 +37,7 @@ export function transformPublishFormToMetadata(
// links: {
// url: links
// },
- termsAndConditions,
- access: access || 'Download'
+ termsAndConditions
},
curation: AssetModel.curation
}
diff --git a/src/global/_code.css b/src/global/_code.css
index af5a0467c..bfe882ed9 100644
--- a/src/global/_code.css
+++ b/src/global/_code.css
@@ -1,7 +1,7 @@
code {
font-family: var(--font-family-monospace);
font-size: var(--font-size-small);
- color: var(--brand-grey-light);
+ color: var(--brand-grey);
text-shadow: none;
}
@@ -14,13 +14,22 @@ code {
pre {
display: block;
margin: calc(var(--spacer) / 2) 0;
- padding: 0;
- border: 1px solid var(--brand-grey-dark);
+ padding: calc(var(--spacer) / 2);
+ background-color: var(--brand-grey-dimmed) !important;
border-radius: var(--border-radius);
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+ max-height: 800px;
+ width: 100%;
+ position: relative;
}
pre code {
- padding: calc(var(--spacer) / 2);
+ padding: 0;
+ white-space: pre;
display: block;
- white-space: pre-wrap;
+ overflow-wrap: normal;
+ word-wrap: normal;
+ word-break: normal;
+ width: 100%;
}
diff --git a/src/global/styles.css b/src/global/styles.css
index a63445413..b372381f2 100644
--- a/src/global/styles.css
+++ b/src/global/styles.css
@@ -132,6 +132,28 @@ fieldset {
margin: 0;
}
+table {
+ width: 100%;
+ border-collapse: collapse;
+ display: block;
+ overflow: auto;
+ -webkit-overflow-scrolling: touch;
+}
+
+table th,
+table td {
+ border: 0;
+ margin: 0;
+ padding: calc(var(--spacer) / 2);
+ border-bottom: 1px solid var(--brand-grey-lighter);
+ text-align: left;
+ font-size: 90%;
+}
+
+table th {
+ font-weight: var(--font-weight-bold);
+}
+
@import '_code.css';
@import '_toast.css';
@import '_web3modal.css';
diff --git a/src/images/logo.svg b/src/images/logo.svg
new file mode 100644
index 000000000..c5099c095
--- /dev/null
+++ b/src/images/logo.svg
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/models/Asset.ts b/src/models/Asset.ts
index 998c65f36..ce1478ee5 100644
--- a/src/models/Asset.ts
+++ b/src/models/Asset.ts
@@ -5,21 +5,20 @@ const AssetModel: MetadataMarket = {
// https://github.com/oceanprotocol/OEPs/tree/master/8
main: {
type: 'dataset',
- name: '',
- dateCreated: '',
- author: '',
- license: '',
+ name: undefined,
+ dateCreated: undefined,
+ author: undefined,
+ license: undefined,
files: []
},
additionalInformation: {
- description: '',
- copyrightHolder: '',
- tags: [],
- links: [],
+ description: undefined,
+ copyrightHolder: undefined,
+ tags: undefined,
+ links: undefined,
// custom items
- termsAndConditions: false,
- access: 'Download'
+ termsAndConditions: false
},
curation: {
rating: 0,
diff --git a/src/components/pages/Publish/validation.ts b/src/models/FormPublish.ts
similarity index 64%
rename from src/components/pages/Publish/validation.ts
rename to src/models/FormPublish.ts
index 6e629adec..d4cfc3a9f 100644
--- a/src/components/pages/Publish/validation.ts
+++ b/src/models/FormPublish.ts
@@ -1,4 +1,4 @@
-import { MetadataPublishForm } from '../../../@types/Metadata'
+import { MetadataPublishForm } from '../@types/Metadata'
import { File as FileMetadata } from '@oceanprotocol/lib'
import * as Yup from 'yup'
@@ -6,7 +6,10 @@ export const validationSchema = Yup.object().shape
({
// ---- required fields ----
name: Yup.string().required('Required'),
author: Yup.string().required('Required'),
- cost: Yup.string().required('Required'),
+ price: Yup.object().shape({
+ cost: Yup.number().required('Required'),
+ tokensToMint: Yup.number().required('Required')
+ }),
files: Yup.array().required('Required').nullable(),
description: Yup.string().required('Required'),
license: Yup.string().required('Required'),
@@ -22,15 +25,18 @@ export const validationSchema = Yup.object().shape({
})
export const initialValues: MetadataPublishForm = {
- name: '',
- author: '',
- cost: '',
- files: '',
- description: '',
- license: '',
- access: '',
+ name: undefined,
+ author: undefined,
+ price: {
+ cost: 1,
+ tokensToMint: 1
+ },
+ files: undefined,
+ description: undefined,
+ license: undefined,
+ access: undefined,
termsAndConditions: false,
- copyrightHolder: '',
- tags: '',
- links: ''
+ copyrightHolder: undefined,
+ tags: undefined,
+ links: undefined
}
diff --git a/src/pages/publish.tsx b/src/pages/publish.tsx
index 0ed58d5af..b8ffd4736 100644
--- a/src/pages/publish.tsx
+++ b/src/pages/publish.tsx
@@ -32,7 +32,6 @@ export const contentQuery = graphql`
type
required
options
- min
}
success
}