Skip to content

Commit

Permalink
publish feedback tweaks, make content switching based on price type work
Browse files Browse the repository at this point in the history
  • Loading branch information
kremalicious committed Jan 12, 2022
1 parent 25920b7 commit 181dce9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion content/publish/feedback.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"1": {
"name": "Create Tokens & Pricing",
"description": "The Data NFT representing your asset, the Datatokens defining access to it, and the pricing schema are all created in one transaction.",
"description": "The Data NFT representing your asset, the Datatokens defining access to it, and the pricing schema are all created in a single transaction.",
"status": "pending",
"txCount": 1
},
Expand Down
18 changes: 18 additions & 0 deletions src/components/Publish/Steps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ export function Steps({
setFieldValue('feedback', feedback)
}, [feedback, setFieldValue])

// auto-switch some feedback content based on pricing type
useEffect(() => {
setFieldValue('feedback', {
...feedback,
'1': {
...feedback['1'],
txCount: values.pricing.type === 'dynamic' ? 2 : 1,
description:
values.pricing.type === 'dynamic'
? feedback['1'].description.replace(
'a single transaction',
'a single transaction, after an initial approve transaction'
)
: feedback['1'].description
}
})
}, [values.pricing.type, setFieldValue])

const { component } = wizardSteps.filter(
(stepContent) => stepContent.step === values.user.stepCurrent
)[0]
Expand Down
9 changes: 4 additions & 5 deletions src/components/Publish/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { ReactElement, useState, useRef } from 'react'
import React, { ReactElement, useState, useRef, useEffect } from 'react'
import { Form, Formik } from 'formik'
import { initialPublishFeedback, initialValues } from './_constants'
import { useAccountPurgatory } from '@hooks/useAccountPurgatory'
Expand Down Expand Up @@ -65,8 +65,7 @@ export default function PublishPage({
...prevState,
'1': {
...prevState['1'],
status: 'active',
txCount: values.pricing.type === 'dynamic' ? 2 : 1
status: 'active'
}
}))

Expand Down Expand Up @@ -119,7 +118,7 @@ export default function PublishPage({
...prevState,
'2': {
...prevState['2'],
status: _datatokenAddress && _erc721Address ? 'active' : 'error'
status: 'active'
}
}))

Expand Down Expand Up @@ -178,7 +177,7 @@ export default function PublishPage({
...prevState,
'3': {
...prevState['3'],
status: _ddo && _encryptedDdo ? 'active' : 'error'
status: 'active'
}
}))

Expand Down

0 comments on commit 181dce9

Please sign in to comment.