From 9b5593499489b38d0ab8d46a8196e7b5e94b785d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 20 Oct 2020 17:29:48 +0200 Subject: [PATCH] refactor --- .../AssetContent/Pricing/FormPricing/Fees.tsx | 52 +++++++++++-------- src/components/pages/Publish/index.tsx | 11 ++-- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx b/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx index 1f0d386dd..820c8e654 100644 --- a/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx +++ b/src/components/organisms/AssetContent/Pricing/FormPricing/Fees.tsx @@ -5,6 +5,30 @@ import { useField } from 'formik' import Input from '../../../../atoms/Input' import Error from './Error' +const Default = ({ + title, + name, + tooltip +}: { + title: string + name: string + tooltip: string +}) => ( + + {title} + + + } + value="0.1" + name={name} + postfix="%" + readOnly + small + /> +) + export default function Fees({ tooltips }: { @@ -32,32 +56,16 @@ export default function Fees({ additionalComponent={} /> - - Community Fee - - - } - value="0.1" + - - Marketplace Fee - - - } - value="0.1" + diff --git a/src/components/pages/Publish/index.tsx b/src/components/pages/Publish/index.tsx index ab548ca4b..302b2071f 100644 --- a/src/components/pages/Publish/index.tsx +++ b/src/components/pages/Publish/index.tsx @@ -53,21 +53,18 @@ export default function PublishPage({ ) // Publish failed - if (publishError) { - setError(publishError) - Logger.error(publishError) + if (!ddo || publishError) { + setError(publishError || 'Publishing DDO failed.') + Logger.error(publishError || 'Publishing DDO failed.') return } - if (!ddo) return - // Publish succeeded setDdo(ddo) - resetForm() - setSuccess( '🎉 Successfully published. 🎉 Now create a price on your data set.' ) + resetForm() } catch (error) { setError(error.message) Logger.error(error.message)