mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
data structure cleanup, initial values
This commit is contained in:
parent
24a7bdbd81
commit
d72d798b06
3
src/@types/MetaData.d.ts
vendored
3
src/@types/MetaData.d.ts
vendored
@ -5,12 +5,9 @@ import {
|
|||||||
ServiceMetadata
|
ServiceMetadata
|
||||||
} from '@oceanprotocol/lib'
|
} from '@oceanprotocol/lib'
|
||||||
|
|
||||||
export declare type AccessType = 'Download' | 'Compute'
|
|
||||||
|
|
||||||
export interface AdditionalInformationMarket extends AdditionalInformation {
|
export interface AdditionalInformationMarket extends AdditionalInformation {
|
||||||
links?: File[]
|
links?: File[]
|
||||||
termsAndConditions: boolean
|
termsAndConditions: boolean
|
||||||
access: AccessType | string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface MetadataMarket extends Metadata {
|
export interface MetadataMarket extends Metadata {
|
||||||
|
@ -36,7 +36,7 @@ export default function FilesInput(props: InputProps): ReactElement {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{typeof field.value === 'object' ? (
|
{field && typeof field.value === 'object' ? (
|
||||||
<FileInfo file={field.value[0]} removeItem={removeItem} />
|
<FileInfo file={field.value[0]} removeItem={removeItem} />
|
||||||
) : (
|
) : (
|
||||||
<FileInput
|
<FileInput
|
||||||
|
@ -16,11 +16,9 @@ export default function PublishForm({
|
|||||||
const { ocean, account } = useOcean()
|
const { ocean, account } = useOcean()
|
||||||
const { publishStepText, isLoading } = usePublish()
|
const { publishStepText, isLoading } = usePublish()
|
||||||
const {
|
const {
|
||||||
values,
|
|
||||||
status,
|
status,
|
||||||
setStatus,
|
setStatus,
|
||||||
isValid,
|
isValid,
|
||||||
touched,
|
|
||||||
setErrors,
|
setErrors,
|
||||||
setTouched,
|
setTouched,
|
||||||
resetForm,
|
resetForm,
|
||||||
|
@ -16,8 +16,7 @@ export function transformPublishFormToMetadata(
|
|||||||
tags,
|
tags,
|
||||||
links,
|
links,
|
||||||
termsAndConditions,
|
termsAndConditions,
|
||||||
files,
|
files
|
||||||
access
|
|
||||||
} = data
|
} = data
|
||||||
|
|
||||||
const metadata: MetadataMarket = {
|
const metadata: MetadataMarket = {
|
||||||
@ -38,8 +37,7 @@ export function transformPublishFormToMetadata(
|
|||||||
// links: {
|
// links: {
|
||||||
// url: links
|
// url: links
|
||||||
// },
|
// },
|
||||||
termsAndConditions,
|
termsAndConditions
|
||||||
access: access || 'Download'
|
|
||||||
},
|
},
|
||||||
curation: AssetModel.curation
|
curation: AssetModel.curation
|
||||||
}
|
}
|
||||||
|
@ -5,21 +5,20 @@ const AssetModel: MetadataMarket = {
|
|||||||
// https://github.com/oceanprotocol/OEPs/tree/master/8
|
// https://github.com/oceanprotocol/OEPs/tree/master/8
|
||||||
main: {
|
main: {
|
||||||
type: 'dataset',
|
type: 'dataset',
|
||||||
name: '',
|
name: undefined,
|
||||||
dateCreated: '',
|
dateCreated: undefined,
|
||||||
author: '',
|
author: undefined,
|
||||||
license: '',
|
license: undefined,
|
||||||
files: []
|
files: []
|
||||||
},
|
},
|
||||||
additionalInformation: {
|
additionalInformation: {
|
||||||
description: '',
|
description: undefined,
|
||||||
copyrightHolder: '',
|
copyrightHolder: undefined,
|
||||||
tags: [],
|
tags: undefined,
|
||||||
links: [],
|
links: undefined,
|
||||||
|
|
||||||
// custom items
|
// custom items
|
||||||
termsAndConditions: false,
|
termsAndConditions: false
|
||||||
access: 'Download'
|
|
||||||
},
|
},
|
||||||
curation: {
|
curation: {
|
||||||
rating: 0,
|
rating: 0,
|
||||||
|
@ -25,18 +25,18 @@ export const validationSchema = Yup.object().shape<MetadataPublishForm>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
export const initialValues: MetadataPublishForm = {
|
export const initialValues: MetadataPublishForm = {
|
||||||
name: '',
|
name: undefined,
|
||||||
author: '',
|
author: undefined,
|
||||||
price: {
|
price: {
|
||||||
cost: 1,
|
cost: 1,
|
||||||
tokensToMint: 1
|
tokensToMint: 1
|
||||||
},
|
},
|
||||||
files: '',
|
files: undefined,
|
||||||
description: '',
|
description: undefined,
|
||||||
license: '',
|
license: undefined,
|
||||||
access: '',
|
access: undefined,
|
||||||
termsAndConditions: false,
|
termsAndConditions: false,
|
||||||
copyrightHolder: '',
|
copyrightHolder: undefined,
|
||||||
tags: '',
|
tags: undefined,
|
||||||
links: ''
|
links: undefined
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user