From 36cf37e718a51986f9b2e61166c4793554ed8583 Mon Sep 17 00:00:00 2001 From: Nelito Junior Date: Thu, 23 Jan 2025 16:32:31 -0300 Subject: [PATCH] delete unused components --- .../TxOperationsSimple/TxOperationSend.tsx | 106 ------------------ .../operations/TxOperationContract.tsx | 75 ------------- .../operations/TxOperationSwap.tsx | 59 ---------- .../operations/TxOperationTransfer.tsx | 96 ---------------- 4 files changed, 336 deletions(-) delete mode 100644 packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/TxOperationSend.tsx delete mode 100644 packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationContract.tsx delete mode 100644 packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationSwap.tsx delete mode 100644 packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationTransfer.tsx diff --git a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/TxOperationSend.tsx b/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/TxOperationSend.tsx deleted file mode 100644 index a89a941d37..0000000000 --- a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/TxOperationSend.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { cssObj } from '@fuel-ui/css'; -import { Avatar, Box, Icon, IconButton, Text } from '@fuel-ui/react'; -import { useAccounts } from '~/systems/Account'; -import { formatAmount, shortAddress } from '~/systems/Core'; -import type { SimplifiedOperation } from '../../../types'; -import { TxCategory } from '../../../types'; - -type TxOperationSendProps = { - operation: SimplifiedOperation; -}; - -export function TxOperationSend({ operation }: TxOperationSendProps) { - const { accounts } = useAccounts(); - const amount = operation.metadata?.totalAmount || operation.amount || '0'; - const operationCount = operation.metadata?.operationCount; - const isContractCall = operation.type === TxCategory.CONTRACTCALL; - - // Find if addresses match our accounts - const fromAccount = accounts?.find( - (acc) => acc.address.toLowerCase() === operation.from.toLowerCase() - ); - const toAccount = accounts?.find( - (acc) => acc.address.toLowerCase() === operation.to.toLowerCase() - ); - - return ( - - - - - - - - {fromAccount ? fromAccount.name : shortAddress(operation.from)} - - navigator.clipboard.writeText(operation.from)} - /> - - - {isContractCall && !toAccount && ( - - Calls contract (sending tokens) - - )} - - - - {formatAmount({ - amount, - options: { units: 9 }, - })}{' '} - {shortAddress(operation.assetId)} - - {operationCount && operationCount > 1 ? ( - - x{operationCount} - - ) : null} - - - - {toAccount ? toAccount.name : shortAddress(operation.to)} - - navigator.clipboard.writeText(operation.to)} - /> - - - - - ); -} - -const styles = { - line: cssObj({ - display: 'flex', - alignItems: 'flex-start', - gap: '$3', - }), - iconCol: cssObj({ - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - width: '24px', - flexShrink: 0, - }), - contentCol: cssObj({ - display: 'flex', - flex: 1, - }), -}; diff --git a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationContract.tsx b/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationContract.tsx deleted file mode 100644 index 0ca89bcacd..0000000000 --- a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationContract.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { cssObj } from '@fuel-ui/css'; -import { Box, Text } from '@fuel-ui/react'; -import type { SimplifiedOperation } from '../../../../types'; -import { TxAddressDisplay } from './TxAddressDisplay'; -import { TxAssetDisplay } from './TxAssetDisplay'; -import { TxOperationNesting } from './TxOperationNesting'; - -type TxOperationContractProps = { - operation: SimplifiedOperation; -}; - -export function TxOperationContract({ operation }: TxOperationContractProps) { - const metadata = operation.metadata; - const amount = metadata?.amount; - const assetId = metadata?.assetId; - const hasAsset = Boolean(amount && assetId); - const depth = metadata?.depth || 0; - - return ( - - - - - - Contract Call - - - - - {hasAsset && amount && assetId && ( - - - - )} - {metadata?.functionName && ( - Function: {metadata.functionName} - )} - - - ); -} - -const styles = { - root: cssObj({ - display: 'flex', - alignItems: 'flex-start', - gap: '$2', - padding: '$2', - backgroundColor: '$cardBg', - borderRadius: '$md', - width: '100%', - minWidth: 0, // Prevent flex items from overflowing - }), - contentCol: cssObj({ - display: 'flex', - flex: 1, - minWidth: 0, // Allow content to shrink if needed - }), - header: cssObj({ - display: 'flex', - alignItems: 'center', - gap: '$2', - }), - typeLabel: cssObj({ - color: '$gray8', - backgroundColor: '$gray3', - padding: '$1 $2', - borderRadius: '$md', - fontWeight: '$normal', - }), - functionName: cssObj({ - fontSize: '$sm', - color: '$gray8', - }), -}; diff --git a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationSwap.tsx b/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationSwap.tsx deleted file mode 100644 index 3bd6393588..0000000000 --- a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationSwap.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { cssObj } from '@fuel-ui/css'; -import { Box, Icon } from '@fuel-ui/react'; -import type { SimplifiedOperation } from '../../../../types'; -import { useEcosystemProject } from '../useEcosystemProject'; -import { isSwapMetadata } from '../utils'; -import { TxAddressDisplay } from './TxAddressDisplay'; -import { TxAssetDisplay } from './TxAssetDisplay'; - -type TxOperationSwapProps = { - operation: SimplifiedOperation; -}; - -export function TxOperationSwap({ operation }: TxOperationSwapProps) { - const { - name: projectName, - image: projectImage, - isLoading, - } = useEcosystemProject(operation.to); - - if (!isSwapMetadata(operation.metadata)) return null; - - return ( - <> - - - - - - - - - ); -} - -const styles = { - line: cssObj({ - display: 'flex', - alignItems: 'flex-start', - gap: '$3', - }), - iconCol: cssObj({ - display: 'flex', - alignItems: 'center', - justifyContent: 'center', - width: '24px', - flexShrink: 0, - }), -}; diff --git a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationTransfer.tsx b/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationTransfer.tsx deleted file mode 100644 index c49204a4e7..0000000000 --- a/packages/app/src/systems/Transaction/components/TxViewSimple/TxOperationsSimple/operations/TxOperationTransfer.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { cssObj } from '@fuel-ui/css'; -import { Box, Icon, Text } from '@fuel-ui/react'; -import { ReceiptType } from 'fuels'; -import type { SimplifiedOperation } from '../../../../types'; -import { TxAddressDisplay } from './TxAddressDisplay'; -import { TxAssetDisplay } from './TxAssetDisplay'; -import { TxOperationNesting } from './TxOperationNesting'; - -type TxOperationTransferProps = { - operation: SimplifiedOperation; -}; - -export function TxOperationTransfer({ operation }: TxOperationTransferProps) { - const depth = operation.metadata?.depth || 0; - const receiptType = operation.metadata?.receiptType; - - return ( - - - - - - Transfer - - {receiptType && ( - - {receiptType} - - )} - - {/* From address */} - - {/* Asset amount with arrow */} - - - - - - - {/* To address */} - - - - ); -} - -const styles = { - root: cssObj({ - display: 'flex', - alignItems: 'flex-start', - gap: '$2', - padding: '$3', - backgroundColor: '$cardBg', - borderRadius: '$md', - width: '100%', - minWidth: 0, // Prevent flex items from overflowing - }), - contentCol: cssObj({ - display: 'flex', - flex: 1, - minWidth: 0, // Allow content to shrink if needed - }), - header: cssObj({ - display: 'flex', - alignItems: 'center', - gap: '$2', - }), - typeLabel: cssObj({ - color: '$gray8', - backgroundColor: '$gray3', - padding: '$1 $2', - borderRadius: '$md', - fontWeight: '$normal', - }), - receiptLabel: cssObj({ - color: '$blue9', - backgroundColor: '$blue3', - padding: '$1 $2', - borderRadius: '$md', - fontWeight: '$normal', - }), - amountRow: cssObj({ - display: 'flex', - alignItems: 'flex-start', - gap: '$2', - marginLeft: '$2', - }), - arrow: cssObj({ - color: '$gray8', - marginTop: '$1', - }), -};