diff --git a/content/site.json b/content/site.json index d3e5f861a..925aa7235 100644 --- a/content/site.json +++ b/content/site.json @@ -1,9 +1,8 @@ { "siteTitle": "Ocean Market", "siteTagline": "A marketplace to find, publish and trade data sets in the Ocean Network.", - "siteUrl": "https://market.oceanprotocol.com", - "siteIcon": "node_modules/@oceanprotocol/art/logo/favicon-white.png", - "siteImage": "../src/@images/share.png", + "siteUrl": "https://v4.market.oceanprotocol.com", + "siteImage": "/share.png", "copyright": "All Rights Reserved. Powered by [Ocean Protocol](https://oceanprotocol.com)", "menu": [ { diff --git a/package-lock.json b/package-lock.json index 9efb9cb38..41bb41a3c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26715,6 +26715,7 @@ "cross-fetch": "^3.1.5", "crypto-js": "^4.1.1", "decimal.js": "^10.3.1", + "web3": "^1.7.1", "web3-core": "^1.7.1", "web3-eth-contract": "^1.7.1" } @@ -26817,6 +26818,7 @@ "integrity": "sha512-5vwpq6kbvwkQwKqAoOU3L72GZ3Ta8RRrewKj9OJRolx28KLJJ8Dg9Rf7obRwt5jQA9bkYd8gqzMTrI7H3xLfaw==", "dev": true, "requires": { + "@oclif/config": "^1.15.1", "@oclif/errors": "^1.3.3", "@oclif/parser": "^3.8.3", "@oclif/plugin-help": "^3", diff --git a/public/android-chrome-192x192.png b/public/android-chrome-192x192.png new file mode 100644 index 000000000..7a46b1252 Binary files /dev/null and b/public/android-chrome-192x192.png differ diff --git a/public/android-chrome-512x512.png b/public/android-chrome-512x512.png new file mode 100644 index 000000000..5911728ab Binary files /dev/null and b/public/android-chrome-512x512.png differ diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 000000000..30048f0bf Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 000000000..dc1711c0e Binary files /dev/null and b/public/favicon.ico differ diff --git a/public/icon.svg b/public/icon.svg new file mode 100644 index 000000000..b5bcefe32 --- /dev/null +++ b/public/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/@images/share.png b/public/share.png similarity index 100% rename from src/@images/share.png rename to public/share.png diff --git a/public/site.webmanifest b/public/site.webmanifest new file mode 100644 index 000000000..19e8c3f45 --- /dev/null +++ b/public/site.webmanifest @@ -0,0 +1,14 @@ +{ + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/src/@hooks/useSiteMetadata/types.ts b/src/@hooks/useSiteMetadata/types.ts index fce4f1141..1159b4eb3 100644 --- a/src/@hooks/useSiteMetadata/types.ts +++ b/src/@hooks/useSiteMetadata/types.ts @@ -2,7 +2,6 @@ export interface UseSiteMetadata { siteTitle: string siteTagline: string siteUrl: string - siteIcon: string siteImage: string copyright: string menu: { diff --git a/src/@utils/SvgWaves.ts b/src/@utils/SvgWaves.ts index 217ddbeb5..1a2db1ec5 100644 --- a/src/@utils/SvgWaves.ts +++ b/src/@utils/SvgWaves.ts @@ -4,6 +4,7 @@ import { randomIntFromInterval } from './numbers' export interface WaveProperties { width?: number height?: number + viewBox?: string color?: string fill?: boolean layerCount?: number @@ -53,6 +54,7 @@ export class SvgWaves { return { width: 99, height: 99, + viewBox: '0 0 99 99', color: WaveColors.Pink, fill: true, layerCount: 4, @@ -107,8 +109,7 @@ export class SvgWaves { generateSvg(): Element { const svg = document.createElementNS(SvgWaves.xmlns, 'svg') - svg.setAttribute('width', this.properties.width.toString()) - svg.setAttribute('height', this.properties.height.toString()) + svg.setAttribute('viewBox', this.properties.viewBox.toString()) svg.setAttribute('fill', this.properties.fill ? undefined : 'transparent') svg.setAttribute('xmlns', SvgWaves.xmlns) diff --git a/src/@utils/feedback.ts b/src/@utils/feedback.ts index 902697ce5..5324f3325 100644 --- a/src/@utils/feedback.ts +++ b/src/@utils/feedback.ts @@ -11,13 +11,6 @@ export function getOrderFeedback( } } -export function getCollectTokensFeedback( - baseTokenSymbol: string, - baseTokenBalance: string -) { - return `Collecting ${baseTokenBalance} ${baseTokenSymbol} from asset ` -} - export function getComputeFeedback( baseTokenSymbol?: string, datatokenSymbol?: string, diff --git a/src/components/@shared/ButtonBuy/index.tsx b/src/components/@shared/ButtonBuy/index.tsx index 4c737fed9..f86a4419a 100644 --- a/src/components/@shared/ButtonBuy/index.tsx +++ b/src/components/@shared/ButtonBuy/index.tsx @@ -4,7 +4,7 @@ import styles from './index.module.css' import Loader from '../atoms/Loader' interface ButtonBuyProps { - action: 'download' | 'compute' | 'collect' + action: 'download' | 'compute' disabled: boolean hasPreviousOrder: boolean hasDatatoken: boolean @@ -148,8 +148,6 @@ export default function ButtonBuy({ ? 'Start Compute Job' : priceType === 'free' && algorithmPriceType === 'free' ? 'Order Compute Job' - : action === 'collect' - ? `Collect ${dtBalance} ${dtSymbol}` : `Buy Compute Job` return ( diff --git a/src/components/Publish/Pricing/Error.tsx b/src/components/@shared/FormInput/Error.tsx similarity index 100% rename from src/components/Publish/Pricing/Error.tsx rename to src/components/@shared/FormInput/Error.tsx diff --git a/src/components/@shared/Page/Seo.tsx b/src/components/@shared/Page/Seo.tsx index 7194cad14..11cb3f402 100644 --- a/src/components/@shared/Page/Seo.tsx +++ b/src/components/@shared/Page/Seo.tsx @@ -17,24 +17,35 @@ export default function Seo({ // Remove trailing slash from all URLs const canonical = `${siteUrl}${uri}`.replace(/\/$/, '') + const pageTitle = title + ? `${title} - ${siteTitle}` + : `${siteTitle} — ${siteTagline}` + return ( - {`${siteTitle} — ${siteTagline}`} + {pageTitle} - {isBrowser && - window.location && - window.location.hostname !== 'oceanprotocol.com' && ( - - )} + {isBrowser && window?.location?.hostname !== 'oceanprotocol.com' && ( + + )} + + + + + - + diff --git a/src/components/Asset/AssetActions/Download.module.css b/src/components/Asset/AssetActions/Download.module.css index 4efc7f192..d6dc45629 100644 --- a/src/components/Asset/AssetActions/Download.module.css +++ b/src/components/Asset/AssetActions/Download.module.css @@ -16,10 +16,3 @@ width: 100%; margin-top: calc(var(--spacer)); } - -.collect { - width: 100%; - justify-content: center; - text-align: center; - margin-top: calc(var(--spacer) / 2); -} diff --git a/src/components/Asset/AssetActions/Download.tsx b/src/components/Asset/AssetActions/Download.tsx index 31dfefcff..67c48b511 100644 --- a/src/components/Asset/AssetActions/Download.tsx +++ b/src/components/Asset/AssetActions/Download.tsx @@ -7,37 +7,16 @@ import ButtonBuy from '@shared/ButtonBuy' import { secondsToString } from '@utils/ddo' import AlgorithmDatasetsListForCompute from './Compute/AlgorithmDatasetsListForCompute' import styles from './Download.module.css' -import { - FileMetadata, - LoggerInstance, - ZERO_ADDRESS, - FixedRateExchange -} from '@oceanprotocol/lib' +import { FileMetadata, LoggerInstance, ZERO_ADDRESS } from '@oceanprotocol/lib' import { order } from '@utils/order' import { AssetExtended } from 'src/@types/AssetExtended' import { buyDtFromPool } from '@utils/pool' import { downloadFile } from '@utils/provider' -import { getCollectTokensFeedback, getOrderFeedback } from '@utils/feedback' +import { getOrderFeedback } from '@utils/feedback' import { getOrderPriceAndFees } from '@utils/accessDetailsAndPricing' import { OrderPriceAndFees } from 'src/@types/Price' import { toast } from 'react-toastify' -import { gql, OperationResult } from 'urql' -import { fetchData, getQueryContext } from '@utils/subgraph' -import { getOceanConfig } from '@utils/ocean' -import { FixedRateExchanges } from 'src/@types/subgraph/FixedRateExchanges' -const FixedRateExchangesQuery = gql` - query FixedRateExchanges($user: String, $exchangeId: String) { - fixedRateExchanges(where: { owner: $user, exchangeId: $exchangeId }) { - id - owner { - id - } - exchangeId - baseTokenBalance - } - } -` export default function Download({ asset, file, @@ -61,9 +40,7 @@ export default function Download({ const [isLoading, setIsLoading] = useState(false) const [isOwned, setIsOwned] = useState(false) const [validOrderTx, setValidOrderTx] = useState('') - const [isCollectLoading, setIsCollectLoading] = useState(false) - const [baseTokenBalance, setBaseTokenBalance] = useState(0) - const [collectStatusText, setCollectStatusText] = useState('') + const [orderPriceAndFees, setOrderPriceAndFees] = useState() useEffect(() => { @@ -108,41 +85,19 @@ export default function Download({ isOwned ]) - useEffect(() => { - if (!accountId || asset.nft.owner !== accountId) return - const queryContext = getQueryContext(Number(asset.chainId)) - - async function getBaseTokenBalance() { - const variables = { - user: accountId.toLowerCase(), - exchangeId: asset?.accessDetails?.addressOrId - } - const result: OperationResult = await fetchData( - FixedRateExchangesQuery, - variables, - queryContext - ) - result?.data?.fixedRateExchanges[0]?.baseTokenBalance - ? setBaseTokenBalance( - parseInt(result?.data?.fixedRateExchanges[0]?.baseTokenBalance) - ) - : setBaseTokenBalance(0) - } - getBaseTokenBalance() - }, [accountId, asset?.accessDetails?.addressOrId, asset.chainId, asset.nft]) - async function handleOrderOrDownload() { setIsLoading(true) - if (isOwned) { - setStatusText( - getOrderFeedback( - asset.accessDetails?.baseToken?.symbol, - asset.accessDetails?.datatoken?.symbol - )[3] - ) - await downloadFile(web3, asset, accountId, validOrderTx) - } else { - try { + try { + if (isOwned) { + setStatusText( + getOrderFeedback( + asset.accessDetails?.baseToken?.symbol, + asset.accessDetails?.datatoken?.symbol + )[3] + ) + + await downloadFile(web3, asset, accountId, validOrderTx) + } else { if (!hasDatatoken && asset.accessDetails.type === 'dynamic') { setStatusText( getOrderFeedback( @@ -152,9 +107,7 @@ export default function Download({ ) const tx = await buyDtFromPool(asset.accessDetails, accountId, web3) if (!tx) { - toast.error('Failed to buy datatoken from pool!') - setIsLoading(false) - return + throw new Error() } } setStatusText( @@ -165,51 +118,19 @@ export default function Download({ ) const orderTx = await order(web3, asset, orderPriceAndFees, accountId) if (!orderTx) { - toast.error('Failed to buy datatoken from pool!') - setIsLoading(false) - return + throw new Error() } setIsOwned(true) setValidOrderTx(orderTx.transactionHash) - } catch (ex) { - LoggerInstance.log(ex.message) - setIsLoading(false) } - } - - setIsLoading(false) - } - - async function handleCollectTokens() { - setIsCollectLoading(true) - const config = getOceanConfig(asset?.chainId) - const fixed = new FixedRateExchange(web3, config.fixedRateExchangeAddress) - try { - setCollectStatusText( - getCollectTokensFeedback( - asset.accessDetails.baseToken?.symbol, - baseTokenBalance.toString() - ) - ) - - const tx = await fixed.collectBT( - accountId, - asset?.accessDetails?.addressOrId, - baseTokenBalance.toString() - ) - - if (!tx) { - setIsCollectLoading(false) - return - } - setBaseTokenBalance(0) - return tx } catch (error) { - LoggerInstance.log(error.message) - setIsCollectLoading(false) - } finally { - setIsCollectLoading(false) + LoggerInstance.error(error) + const message = isOwned + ? 'Failed to download file!' + : 'Failed to buy datatoken from pool!' + toast.error(message) } + setIsLoading(false) } const PurchaseButton = () => ( @@ -234,26 +155,6 @@ export default function Download({ /> ) - const CollectTokensButton = () => ( - - ) - return (