From 311c6b8496369cc8ddb6c77f8ea274de1807d4df Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 9 Nov 2023 15:48:53 +0300 Subject: [PATCH 1/4] Removing network selector --- src/components/TabsFile/index.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/components/TabsFile/index.tsx b/src/components/TabsFile/index.tsx index f766bdd..672c979 100644 --- a/src/components/TabsFile/index.tsx +++ b/src/components/TabsFile/index.tsx @@ -468,22 +468,6 @@ export default function TabsFile({ return ( -
- {availableNetworks && availableNetworks?.length > 0 && ( - item.chainId === chain?.id.toString() - )?.acceptedTokens - } - handleChangeNetwork={handleChangeNetwork} - handleChangePayment={handleChangePayment} - /> - )} -
-
{items?.length > 0 && From b7f319a6776fd850aeceac8e5226b4bd5624c23a Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 9 Nov 2023 15:59:32 +0300 Subject: [PATCH 2/4] SOrting storage options alphabetically --- src/components/UploaderConnection/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/UploaderConnection/index.tsx b/src/components/UploaderConnection/index.tsx index 9e4a8c0..77566ff 100644 --- a/src/components/UploaderConnection/index.tsx +++ b/src/components/UploaderConnection/index.tsx @@ -22,7 +22,12 @@ const UploaderConnection = ({ // Fetch storage info from Uploader endpoint const getStorageInfo = async () => { try { - const storageInfo = await client.getStorageInfo() + let storageInfo = await client.getStorageInfo() + storageInfo = storageInfo.sort((a, b) => { + if (a.type < b.type) { + return -1 + } else return 1 + }) return storageInfo } catch (error) { console.log(error) From aeb273ed83e4856c0c83c393e22be3fcbe9d0141 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 9 Nov 2023 16:02:02 +0300 Subject: [PATCH 3/4] Removing unused network selctor constants --- src/components/TabsFile/index.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/TabsFile/index.tsx b/src/components/TabsFile/index.tsx index 672c979..b07e3b2 100644 --- a/src/components/TabsFile/index.tsx +++ b/src/components/TabsFile/index.tsx @@ -13,7 +13,6 @@ import { GetQuoteResult, GetStatusResult } from '@oceanprotocol/uploader' -import Networks from '../Networks' import { formatEther } from '@ethersproject/units' import HistoryList from '../HistoryList' import { addEllipsesToText } from '../../@utils/textFormat' @@ -44,7 +43,6 @@ export default function TabsFile({ const { address, isConnected } = useAccount() const [isNetworkSupported, setIsNetworkSupported] = useState(false) - const [availableNetworks, setAvailableNetworks] = useState([]) const [paymentSelected, setPaymentSelected] = useState('') const [selectedNetwork, setSelectedNetwork] = useState(chain?.id || 0) @@ -143,7 +141,6 @@ export default function TabsFile({ (item: any) => parseInt(item.chainId) ) // TODO: fix any type - setAvailableNetworks(availableNetworksByService as any) const isNetworkSupported = availableNetworksByService?.includes(chain?.id || 0) || false setIsNetworkSupported(isNetworkSupported) From 9cf855796e8b435c0199724e5e17a6f6c97650a3 Mon Sep 17 00:00:00 2001 From: Jamie Hewitt Date: Thu, 9 Nov 2023 16:16:13 +0300 Subject: [PATCH 4/4] Removing unused code related to the network switcher --- src/@utils/linkAsset.ts | 29 ++++++++++++++++------------- src/components/TabsFile/index.tsx | 27 --------------------------- 2 files changed, 16 insertions(+), 40 deletions(-) diff --git a/src/@utils/linkAsset.ts b/src/@utils/linkAsset.ts index ee78b3c..e71bf17 100644 --- a/src/@utils/linkAsset.ts +++ b/src/@utils/linkAsset.ts @@ -1,14 +1,17 @@ export function getLink(provider: string, item: string) { - let link; - switch (provider) { - case 'filecoin': - link = `https://gateway.ipfs.io/ipfs/${item}` - break; - case 'arweave': - link = `https://arweave.net/${item}` - break; - default: - break; - } - window.open(link, "_blank"); -} \ No newline at end of file + let link + switch (provider) { + case 'filecoin': + link = `https://gateway.ipfs.io/ipfs/${item}` + break + case 'ipfs': + link = `https://gateway.pinata.cloud/ipfs/${item}` + break + case 'arweave': + link = `https://arweave.net/${item}` + break + default: + break + } + window.open(link, '_blank') +} diff --git a/src/components/TabsFile/index.tsx b/src/components/TabsFile/index.tsx index b07e3b2..f38270d 100644 --- a/src/components/TabsFile/index.tsx +++ b/src/components/TabsFile/index.tsx @@ -5,7 +5,6 @@ import Tooltip from '../Tooltip' import styles from './index.module.css' import FileUploadSingle from '../FileUploadSingle' import { useAccount, useNetwork, useContractRead } from 'wagmi' -import { switchNetwork } from '@wagmi/core' import Button from '../Button' import { GetLinkResult, @@ -164,32 +163,6 @@ export default function TabsFile({ }, 3000) }, [errorUpload]) - const switchNetworks = async (chainId: number) => { - try { - const network = await switchNetwork({ chainId }) - return network - } catch (error) { - console.log(error) - throw new Error('Error switching network') - } - } - - const handleChangeNetwork = async (event: any) => { - event.preventDefault() - await switchNetworks(parseInt(event.target.value)) - .then(() => { - setSelectedNetwork(parseInt(event.target.value)) - }) - .catch((error) => { - setSelectedNetwork(selectedNetwork) - console.log(error) - }) - } - - const handleChangePayment = (event: { target: { value: any } }) => { - setPaymentSelected(event.target.value) - } - const getQuote = async ({ type, duration,