Skip to content

Commit

Permalink
Merge pull request #322 from aura-nw/fix/remove-unused-package
Browse files Browse the repository at this point in the history
Fix/remove unused package
  • Loading branch information
hoangndm3139 authored Sep 15, 2023
2 parents 842c24b + aad5683 commit 80ac3e8
Show file tree
Hide file tree
Showing 31 changed files with 12 additions and 2,754 deletions.
62 changes: 0 additions & 62 deletions src/logic/collectibles/utils/index.ts

This file was deleted.

100 changes: 12 additions & 88 deletions src/routes/safe/components/Balances/SendModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import { Loader } from '@aura/safe-react-components'
import { makeStyles } from '@material-ui/core/styles'
import { Suspense, useEffect, useState, lazy } from 'react'
import { Suspense, lazy, useEffect, useState } from 'react'

import Modal from 'src/components/Modal'
import { CollectibleTx } from './screens/ReviewCollectible'
import { ReviewCustomTxProps } from './screens/ContractInteraction/ReviewCustomTx'
import { CustomTxProps } from './screens/ContractInteraction/SendCustomTx'
import { ReviewTxProp } from './screens/ReviewSendFundsTx'
import { NFTToken } from 'src/logic/collectibles/sources/collectibles.d'
import { SendCollectibleTxInfo } from './screens/SendCollectible'
import { ReviewTxProp } from './screens/ReviewSendFundsTx'

const ChooseTxType = lazy(() => import('./screens/ChooseTxType'))

const SendFunds = lazy(() => import('./screens/SendFunds'))

const SendCollectible = lazy(() => import('./screens/SendCollectible'))

const ReviewCollectible = lazy(() => import('./screens/ReviewCollectible'))

const ReviewSendFundsTx = lazy(() => import('./screens/ReviewSendFundsTx'))

const ContractInteractionReview: any = lazy(() => import('./screens/ContractInteraction/Review'))

const SendCustomTx = lazy(() => import('./screens/ContractInteraction/SendCustomTx'))

const ReviewCustomTx = lazy(() => import('./screens/ContractInteraction/ReviewCustomTx'))

const useStyles = makeStyles({
loaderStyle: {
height: '500px',
Expand All @@ -36,6 +22,16 @@ const useStyles = makeStyles({
},
})

type SendCollectibleTxInfo = {
assetAddress: string
assetName: string
nftTokenId: string
recipientAddress?: string
recipientName?: string
amount?: number
gasLimit?: number
}

type TxType =
| 'chooseTxType'
| 'sendFunds'
Expand Down Expand Up @@ -73,13 +69,11 @@ const SendModal = ({
const classes = useStyles()
const [activeScreen, setActiveScreen] = useState<TxType>(activeScreenType || 'chooseTxType')
const [tx, setTx] = useState<unknown>({})
const [isABI, setIsABI] = useState(true)

const [recipient, setRecipient] = useState<string | undefined>(recipientAddress)

useEffect(() => {
setActiveScreen(activeScreenType || 'chooseTxType')
setIsABI(true)
setTx({})
setRecipient(recipientAddress)
}, [activeScreenType, isOpen, recipientAddress])
Expand All @@ -89,25 +83,6 @@ const SendModal = ({
setTx(txInfo)
}

const handleContractInteractionCreation = (contractInteractionInfo: any, submit: boolean): void => {
setTx(contractInteractionInfo)
if (submit) setActiveScreen('contractInteractionReview')
}

const handleCustomTxCreation = (customTxInfo: any, submit: boolean): void => {
setTx(customTxInfo)
if (submit) setActiveScreen('reviewCustomTx')
}

const handleSendCollectible = (txInfo) => {
setActiveScreen('reviewCollectible')
setTx(txInfo)
}

const handleSwitchMethod = (): void => {
setIsABI(!isABI)
}

const handleOnPrev = (screen: TxType) => {
setRecipient((tx as ReviewTxProp).recipientAddress)
setActiveScreen(screen)
Expand Down Expand Up @@ -157,57 +132,6 @@ const SendModal = ({
tx={tx as ReviewTxProp}
/>
)}

{/* {activeScreen === 'contractInteraction' && isABI && (
<ContractInteraction
contractAddress={recipient}
initialValues={tx as ContractInteractionTx}
isABI={isABI}
onClose={onClose}
onNext={handleContractInteractionCreation}
switchMethod={handleSwitchMethod}
/>
)} */}

{activeScreen === 'contractInteractionReview' && isABI && tx && (
<ContractInteractionReview onClose={onClose} onPrev={() => handleOnPrev('contractInteraction')} tx={tx} />
)}

{activeScreen === 'contractInteraction' && !isABI && (
<SendCustomTx
initialValues={tx as CustomTxProps}
isABI={isABI}
onClose={onClose}
onNext={handleCustomTxCreation}
switchMethod={handleSwitchMethod}
/>
)}

{activeScreen === 'reviewCustomTx' && (
<ReviewCustomTx
onClose={onClose}
onPrev={() => handleOnPrev('contractInteraction')}
tx={tx as ReviewCustomTxProps}
/>
)}

{activeScreen === 'sendCollectible' && (
<SendCollectible
initialValues={tx}
onClose={onClose}
onNext={handleSendCollectible}
recipientAddress={recipient}
selectedToken={selectedToken as NFTToken | undefined}
/>
)}

{activeScreen === 'reviewCollectible' && (
<ReviewCollectible
onClose={onClose}
onPrev={() => handleOnPrev('sendCollectible')}
tx={tx as CollectibleTx}
/>
)}
</Suspense>
</Modal>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,6 @@ const ChooseTxType = ({
setActiveScreen,
}: ChooseTxTypeProps): React.ReactElement => {
const classes = useStyles()
// const featuresEnabled = useSelector(currentSafeFeaturesEnabled)
// const erc721Enabled = featuresEnabled?.includes(FEATURES.ERC721)
// const contractInteractionEnabled = featuresEnabled?.includes(FEATURES.CONTRACT_INTERACTION)
// const [disableContractInteraction, setDisableContractInteraction] = React.useState(!!recipientAddress)

// React.useEffect(() => {
// let isCurrent = true
// const isContract = async () => {
// if (recipientAddress && isCurrent) {
// setDisableContractInteraction(!!(await mustBeEthereumContractAddress(recipientAddress)))
// }
// }

// isContract()

// return () => {
// isCurrent = false
// }
// }, [recipientAddress])

return (
<>
Expand Down Expand Up @@ -77,60 +58,11 @@ const ChooseTxType = ({
)}
<Row align="center">
<Col className={classes.buttonColumn} layout="column" middle="xs">
{/* <Button
className={classes.firstButton}
color="primary"
minHeight={52}
minWidth={240}
onClick={() => setActiveScreen('sendFunds')}
variant="contained"
testId="modal-send-funds-btn"
>
<Img alt="Send funds" className={classNames(classes.leftIcon, classes.iconSmall)} src={Token} />
Send funds
</Button> */}

<StyledBorder>
<StyledButtonBorder iconSize="sm" size="lg" type="button" onClick={() => setActiveScreen('sendFunds')}>
<StyledButtonLabel size="xl"> Send funds </StyledButtonLabel>
</StyledButtonBorder>
</StyledBorder>
{/* {erc721Enabled && (
<Button
className={classes.firstButton}
color="primary"
minHeight={52}
minWidth={240}
onClick={() => setActiveScreen('sendCollectible')}
variant="contained"
testId="modal-send-collectible-btn"
>
<Img
alt="Send collectible"
className={classNames(classes.leftIcon, classes.iconSmall)}
src={Collectible}
/>
Send collectible
</Button>
)}
{contractInteractionEnabled && (
<Button
color="primary"
disabled={disableContractInteraction}
minHeight={52}
minWidth={240}
onClick={() => setActiveScreen('contractInteraction')}
variant="outlined"
testId="modal-contract-interaction-btn"
>
<Img
alt="Contract Interaction"
className={classNames(classes.leftIcon, classes.iconSmall)}
src={ContractInteractionIcon}
/>
Contract interaction
</Button>
)} */}
</Col>
</Row>
</>
Expand Down

This file was deleted.

Loading

0 comments on commit 80ac3e8

Please sign in to comment.