From 181dce9ba57a2d3631b58dc410b29cae9b9e6421 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 12 Jan 2022 19:24:49 +0000 Subject: [PATCH] publish feedback tweaks, make content switching based on price type work --- content/publish/feedback.json | 2 +- src/components/Publish/Steps.tsx | 18 ++++++++++++++++++ src/components/Publish/index.tsx | 9 ++++----- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/content/publish/feedback.json b/content/publish/feedback.json index c0c5a7475..94353f17c 100644 --- a/content/publish/feedback.json +++ b/content/publish/feedback.json @@ -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 }, diff --git a/src/components/Publish/Steps.tsx b/src/components/Publish/Steps.tsx index 6829df03b..b325b430f 100644 --- a/src/components/Publish/Steps.tsx +++ b/src/components/Publish/Steps.tsx @@ -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] diff --git a/src/components/Publish/index.tsx b/src/components/Publish/index.tsx index 2ce808e30..79e8a13cf 100644 --- a/src/components/Publish/index.tsx +++ b/src/components/Publish/index.tsx @@ -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' @@ -65,8 +65,7 @@ export default function PublishPage({ ...prevState, '1': { ...prevState['1'], - status: 'active', - txCount: values.pricing.type === 'dynamic' ? 2 : 1 + status: 'active' } })) @@ -119,7 +118,7 @@ export default function PublishPage({ ...prevState, '2': { ...prevState['2'], - status: _datatokenAddress && _erc721Address ? 'active' : 'error' + status: 'active' } })) @@ -178,7 +177,7 @@ export default function PublishPage({ ...prevState, '3': { ...prevState['3'], - status: _ddo && _encryptedDdo ? 'active' : 'error' + status: 'active' } }))