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

data structure change

This commit is contained in:
Matthias Kretschmann 2021-11-19 13:47:58 +00:00
parent d3810168aa
commit 713de2eb94
Signed by: m
GPG Key ID: 606EEEF3C479A91F
7 changed files with 24 additions and 16 deletions

View File

@ -10,7 +10,6 @@ export function renderStaticWaves(): string {
const svg = d3.create('svg')
const width = 1000
const height = 250
console.log(height)
const x = d3.scaleLinear().range([0, width])
const angles = d3.range(Math.random(), 4 * Math.PI, Math.PI / 20)

View File

@ -21,21 +21,23 @@ export default function Actions({
function handleNext(e: FormEvent) {
e.preventDefault()
setFieldValue('stepCurrent', values.stepCurrent + 1)
setFieldValue('stepCurrent', values.user.stepCurrent + 1)
scrollToRef.current.scrollIntoView()
}
function handlePrevious(e: FormEvent) {
e.preventDefault()
setFieldValue('stepCurrent', values.stepCurrent - 1)
setFieldValue('stepCurrent', values.user.stepCurrent - 1)
scrollToRef.current.scrollIntoView()
}
return (
<footer className={styles.actions}>
{values.stepCurrent > 1 && <Button onClick={handlePrevious}>Back</Button>}
{values.user.stepCurrent > 1 && (
<Button onClick={handlePrevious}>Back</Button>
)}
{values.stepCurrent < wizardSteps.length ? (
{values.user.stepCurrent < wizardSteps.length ? (
<Button style="primary" onClick={handleNext}>
Continue
</Button>

View File

@ -20,7 +20,9 @@ export default function Navigation(): ReactElement {
key={step.title}
onClick={() => handleStepClick(step.step)}
// TODO: add success class
className={values.stepCurrent === step.step ? styles.current : null}
className={
values.user.stepCurrent === step.step ? styles.current : null
}
>
{step.title}
</li>

View File

@ -11,12 +11,12 @@ export function Steps(): ReactElement {
useEffect(() => {
if (!chainId || !accountId) return
setFieldValue('chainId', chainId)
setFieldValue('accountId', accountId)
setFieldValue('user.chainId', chainId)
setFieldValue('user.accountId', accountId)
}, [chainId, accountId, setFieldValue])
const { component } = wizardSteps.filter(
(stepContent) => stepContent.step === values.stepCurrent
(stepContent) => stepContent.step === values.user.stepCurrent
)[0]
return component

View File

@ -32,9 +32,11 @@ export const wizardSteps: StepContent[] = [
]
export const initialValues: FormPublishData = {
stepCurrent: 1,
chainId: 1,
accountId: '',
user: {
stepCurrent: 1,
chainId: 1,
accountId: ''
},
metadata: {
nft: { name: '', symbol: '', description: '', image: '' },
type: 'dataset',

View File

@ -12,9 +12,11 @@ export interface FormPublishService {
}
export interface FormPublishData {
stepCurrent: number
accountId: string
chainId: number
user: {
stepCurrent: number
accountId: string
chainId: number
}
metadata: {
nft: NftOptions
type: 'Dataset' | 'Algorithm' | string

View File

@ -30,7 +30,8 @@ export async function transformPublishFormToDdo(
datatokenAddress: string,
nftAddress: string
): Promise<DDO> {
const { chainId, accountId, metadata, services } = values
const { metadata, services } = values
const { chainId, accountId } = values.user
const did = sha256(`${nftAddress}${chainId}`)
const currentTime = dateToStringNoMS(new Date())
const {