mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
unify owner actions
This commit is contained in:
parent
dcfae1332c
commit
c8e6daa590
@ -1,19 +0,0 @@
|
|||||||
import { useAsset } from '@context/Asset'
|
|
||||||
import React from 'react'
|
|
||||||
import { useWeb3 } from '@context/Web3'
|
|
||||||
import { calicaUri } from '../../../../../app.config'
|
|
||||||
export default function CalicaIntegration() {
|
|
||||||
const { isOwner } = useAsset()
|
|
||||||
const { accountId } = useWeb3()
|
|
||||||
|
|
||||||
return isOwner ? (
|
|
||||||
<a
|
|
||||||
href={`${calicaUri}/${accountId}`}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
title="Use Calica for revenue split"
|
|
||||||
>
|
|
||||||
Use Calica for revenue split
|
|
||||||
</a>
|
|
||||||
) : null
|
|
||||||
}
|
|
@ -6,11 +6,11 @@
|
|||||||
.info {
|
.info {
|
||||||
display: flex;
|
display: flex;
|
||||||
width: auto;
|
width: auto;
|
||||||
padding: 0 calc(var(--spacer) / 2) 0 calc(var(--spacer) * 1.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.filewrapper {
|
.filewrapper {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
margin-right: calc(var(--spacer) / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
.feedback {
|
.feedback {
|
||||||
|
@ -3,3 +3,7 @@
|
|||||||
max-width: 35rem;
|
max-width: 35rem;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.actionsSecondary {
|
||||||
|
margin-top: calc(var(--spacer) / 2);
|
||||||
|
}
|
||||||
|
@ -15,7 +15,7 @@ import { useFormikContext } from 'formik'
|
|||||||
import { FormPublishData } from '@components/Publish/_types'
|
import { FormPublishData } from '@components/Publish/_types'
|
||||||
import { getTokenBalanceFromSymbol } from '@utils/web3'
|
import { getTokenBalanceFromSymbol } from '@utils/web3'
|
||||||
import AssetStats from './AssetStats'
|
import AssetStats from './AssetStats'
|
||||||
import Calica from './Calica'
|
import Calica from '../OwnerActions'
|
||||||
|
|
||||||
export default function AssetActions({
|
export default function AssetActions({
|
||||||
asset
|
asset
|
||||||
@ -133,32 +133,24 @@ export default function AssetActions({
|
|||||||
}, [balance, accountId, asset?.accessDetails, dtBalance])
|
}, [balance, accountId, asset?.accessDetails, dtBalance])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className={styles.actions}>
|
||||||
<div className={styles.actions}>
|
{isCompute ? (
|
||||||
{isCompute ? (
|
<Compute
|
||||||
<Compute
|
asset={asset}
|
||||||
asset={asset}
|
dtBalance={dtBalance}
|
||||||
dtBalance={dtBalance}
|
file={fileMetadata}
|
||||||
file={fileMetadata}
|
fileIsLoading={fileIsLoading}
|
||||||
fileIsLoading={fileIsLoading}
|
/>
|
||||||
/>
|
) : (
|
||||||
) : (
|
<Download
|
||||||
<Download
|
asset={asset}
|
||||||
asset={asset}
|
dtBalance={dtBalance}
|
||||||
dtBalance={dtBalance}
|
isBalanceSufficient={isBalanceSufficient}
|
||||||
isBalanceSufficient={isBalanceSufficient}
|
file={fileMetadata}
|
||||||
file={fileMetadata}
|
fileIsLoading={fileIsLoading}
|
||||||
fileIsLoading={fileIsLoading}
|
/>
|
||||||
/>
|
)}
|
||||||
)}
|
<AssetStats />
|
||||||
<AssetStats />
|
</div>
|
||||||
</div>
|
|
||||||
<Calica />
|
|
||||||
<Web3Feedback
|
|
||||||
networkId={asset?.chainId}
|
|
||||||
accountId={accountId}
|
|
||||||
isAssetNetwork={isAssetNetwork}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -30,12 +30,3 @@
|
|||||||
margin-top: var(--spacer);
|
margin-top: var(--spacer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ownerActions {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: var(--spacer);
|
|
||||||
margin-bottom: calc(var(--spacer) * 1.5);
|
|
||||||
padding: calc(var(--spacer) / 3) var(--spacer);
|
|
||||||
border-top: 1px solid var(--border-color);
|
|
||||||
border-bottom: 1px solid var(--border-color);
|
|
||||||
}
|
|
||||||
|
@ -14,16 +14,19 @@ import styles from './index.module.css'
|
|||||||
import NetworkName from '@shared/NetworkName'
|
import NetworkName from '@shared/NetworkName'
|
||||||
import content from '../../../../content/purgatory.json'
|
import content from '../../../../content/purgatory.json'
|
||||||
import Web3 from 'web3'
|
import Web3 from 'web3'
|
||||||
import Button from '@shared/atoms/Button'
|
|
||||||
import RelatedAssets from '../RelatedAssets'
|
import RelatedAssets from '../RelatedAssets'
|
||||||
|
import OwnerActions from '../OwnerActions'
|
||||||
|
import Web3Feedback from '@components/@shared/Web3Feedback'
|
||||||
|
import { useWeb3 } from '@context/Web3'
|
||||||
|
|
||||||
export default function AssetContent({
|
export default function AssetContent({
|
||||||
asset
|
asset
|
||||||
}: {
|
}: {
|
||||||
asset: AssetExtended
|
asset: AssetExtended
|
||||||
}): ReactElement {
|
}): ReactElement {
|
||||||
const { isInPurgatory, purgatoryData, isOwner, isAssetNetwork } = useAsset()
|
const { isInPurgatory, purgatoryData, isAssetNetwork } = useAsset()
|
||||||
const { debug } = useUserPreferences()
|
const { debug } = useUserPreferences()
|
||||||
|
const { accountId } = useWeb3()
|
||||||
const [receipts, setReceipts] = useState([])
|
const [receipts, setReceipts] = useState([])
|
||||||
const [nftPublisher, setNftPublisher] = useState<string>()
|
const [nftPublisher, setNftPublisher] = useState<string>()
|
||||||
|
|
||||||
@ -72,13 +75,12 @@ export default function AssetContent({
|
|||||||
|
|
||||||
<div className={styles.actions}>
|
<div className={styles.actions}>
|
||||||
<AssetActions asset={asset} />
|
<AssetActions asset={asset} />
|
||||||
{isOwner && isAssetNetwork && (
|
<OwnerActions />
|
||||||
<div className={styles.ownerActions}>
|
<Web3Feedback
|
||||||
<Button style="text" size="small" to={`/asset/${asset?.id}/edit`}>
|
networkId={asset?.chainId}
|
||||||
Edit Asset
|
accountId={accountId}
|
||||||
</Button>
|
isAssetNetwork={isAssetNetwork}
|
||||||
</div>
|
/>
|
||||||
)}
|
|
||||||
<RelatedAssets />
|
<RelatedAssets />
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
|
9
src/components/Asset/OwnerActions/index.module.css
Normal file
9
src/components/Asset/OwnerActions/index.module.css
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.ownerActions {
|
||||||
|
text-align: center;
|
||||||
|
margin-top: var(--spacer);
|
||||||
|
margin-bottom: calc(var(--spacer) * 1.5);
|
||||||
|
padding: calc(var(--spacer) / 3) var(--spacer);
|
||||||
|
border-top: 1px solid var(--border-color);
|
||||||
|
border-bottom: 1px solid var(--border-color);
|
||||||
|
color: var(--color-secondary);
|
||||||
|
}
|
30
src/components/Asset/OwnerActions/index.tsx
Normal file
30
src/components/Asset/OwnerActions/index.tsx
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { useAsset } from '@context/Asset'
|
||||||
|
import React from 'react'
|
||||||
|
import { useWeb3 } from '@context/Web3'
|
||||||
|
import { calicaUri } from '../../../../app.config'
|
||||||
|
import Button from '@components/@shared/atoms/Button'
|
||||||
|
import styles from './index.module.css'
|
||||||
|
|
||||||
|
export default function OwnerActions() {
|
||||||
|
const { asset, isOwner } = useAsset()
|
||||||
|
const { accountId } = useWeb3()
|
||||||
|
|
||||||
|
return isOwner ? (
|
||||||
|
<div className={styles.ownerActions}>
|
||||||
|
<Button style="text" size="small" to={`/asset/${asset?.id}/edit`}>
|
||||||
|
Edit Asset
|
||||||
|
</Button>{' '}
|
||||||
|
|{' '}
|
||||||
|
<Button
|
||||||
|
style="text"
|
||||||
|
size="small"
|
||||||
|
href={`${calicaUri}/${accountId}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
title="Use Calica for splitting revenue between multiple accounts."
|
||||||
|
>
|
||||||
|
Split Revenue
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
) : null
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user