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

tx link tweaks, output tx count beforehand

This commit is contained in:
Matthias Kretschmann 2022-01-12 15:20:18 +00:00
parent b139346b35
commit 5f50379f63
7 changed files with 60 additions and 24 deletions

View File

@ -55,16 +55,6 @@
margin-bottom: 0; margin-bottom: 0;
} }
.txHash {
display: inline-block;
margin-left: calc(var(--spacer) / 2);
margin-top: calc(var(--spacer) / 2);
font-size: var(--font-size-small);
font-family: var(--font-family-base);
font-weight: var(--font-weight-base);
color: var(--color-primary);
}
@keyframes loader { @keyframes loader {
to { to {
transform: rotate(360deg); transform: rotate(360deg);

View File

@ -1,8 +1,8 @@
import ExplorerLink from '@shared/ExplorerLink'
import { useFormikContext } from 'formik' import { useFormikContext } from 'formik'
import React, { ReactElement } from 'react' import React, { ReactElement } from 'react'
import { FormPublishData } from '../_types' import { FormPublishData } from '../_types'
import styles from './Feedback.module.css' import styles from './Feedback.module.css'
import TransactionCount from './TransactionCount'
export function Feedback(): ReactElement { export function Feedback(): ReactElement {
const { values } = useFormikContext<FormPublishData>() const { values } = useFormikContext<FormPublishData>()
@ -10,15 +10,13 @@ export function Feedback(): ReactElement {
const items = Object.entries(values.feedback).map(([key, value], index) => ( const items = Object.entries(values.feedback).map(([key, value], index) => (
<li key={index} className={styles[value.status]}> <li key={index} className={styles[value.status]}>
<h3 className={styles.title}> <h3 className={styles.title}>
{value.name}{' '} {value.name}
{value.txHash && ( {value.txCount > 0 && (
<ExplorerLink <TransactionCount
networkId={values.user.chainId} txCount={value.txCount}
path={`/tx/${value.txHash}`} chainId={values.user.chainId}
className={styles.txHash} txHash={value.txHash}
> />
View Transaction
</ExplorerLink>
)} )}
</h3> </h3>
<p className={styles.description}>{value.description}</p> <p className={styles.description}>{value.description}</p>

View File

@ -0,0 +1,16 @@
.txHash {
display: inline-block;
margin-left: calc(var(--spacer) / 2);
margin-top: calc(var(--spacer) / 2);
font-size: var(--font-size-small);
font-family: var(--font-family-base);
font-weight: var(--font-weight-base);
color: var(--color-secondary);
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
padding: calc(var(--spacer) / 12) calc(var(--spacer) / 4);
}
a.txHash {
color: var(--color-primary);
}

View File

@ -0,0 +1,27 @@
import ExplorerLink from '@shared/ExplorerLink'
import React from 'react'
import styles from './TransactionCount.module.css'
export default function TransactionCount({
txCount,
chainId,
txHash
}: {
txCount: number
chainId: number
txHash: string
}) {
return txHash ? (
<ExplorerLink
networkId={chainId}
path={`/tx/${txHash}`}
className={styles.txHash}
>
View Transaction
</ExplorerLink>
) : (
<span className={styles.txHash}>
{txCount} Transaction{txCount > 1 ? 's' : ''}
</span>
)
}

View File

@ -126,18 +126,21 @@ export const initialPublishFeedback: PublishFeedback = {
name: 'Create Tokens & Pricing', name: 'Create Tokens & Pricing',
description: description:
'The Data NFT representing your asset, the Datatokens defining access to it, and the pricing schema are all created in one transaction.', 'The Data NFT representing your asset, the Datatokens defining access to it, and the pricing schema are all created in one transaction.',
status: 'pending' status: 'pending',
txCount: 1
}, },
2: { 2: {
name: 'Construct & Encrypt DDO', name: 'Construct & Encrypt DDO',
description: description:
'The file URLs are encrypted, and the whole DDO is encrypted too.', 'The file URLs are encrypted, and the whole DDO is encrypted too.',
status: 'pending' status: 'pending',
txCount: 0
}, },
3: { 3: {
name: 'Publish DDO', name: 'Publish DDO',
description: description:
'The encrypted DDO is stored on-chain as part of the Data NFT. Indexers like Aquarius can decrypt the DDO for displaying purposes, but the file URLs can only be decrypted by exchanging the respective datatokens for this asset.', 'The encrypted DDO is stored on-chain as part of the Data NFT. Indexers like Aquarius can decrypt the DDO for displaying purposes, but the file URLs can only be decrypted by exchanging the respective datatokens for this asset.',
status: 'pending' status: 'pending',
txCount: 1
} }
} }

View File

@ -57,6 +57,7 @@ export interface PublishFeedback {
name: string name: string
description: string description: string
status: 'success' | 'error' | 'pending' | 'active' status: 'success' | 'error' | 'pending' | 'active'
txCount: number
message?: string message?: string
txHash?: string txHash?: string
} }

View File

@ -64,7 +64,8 @@ export default function PublishPage({
...prevState, ...prevState,
1: { 1: {
...prevState[1], ...prevState[1],
status: 'active' status: 'active',
txCount: values.pricing.type === 'dynamic' ? 2 : 1
} }
})) }))