Skip to content

Commit

Permalink
fix: Only show ramp button if ramp app is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
usame-algan committed Nov 9, 2023
1 parent 7b59d09 commit a3acd2d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
4 changes: 3 additions & 1 deletion cypress/e2e/smoke/assets.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as constants from '../../support/constants'
import * as main from '../../e2e/pages/main.page'
import * as balances from '../pages/balances.pages'
import * as owner from '../pages/owners.pages'
import { SEPOLIA_TEST_SAFE_1, SEPOLIA_TEST_SAFE_3 } from '../../support/constants'

Check failure on line 5 in cypress/e2e/smoke/assets.cy.js

View workflow job for this annotation

GitHub Actions / ESLint Results

unused-imports/no-unused-imports-ts

'SEPOLIA_TEST_SAFE_1' is defined but never used.

Check failure on line 5 in cypress/e2e/smoke/assets.cy.js

View workflow job for this annotation

GitHub Actions / ESLint Results

unused-imports/no-unused-imports-ts

'SEPOLIA_TEST_SAFE_3' is defined but never used.

const ASSET_NAME_COLUMN = 0
const TOKEN_AMOUNT_COLUMN = 1
Expand Down Expand Up @@ -206,12 +207,13 @@ describe('Assets tests', () => {
balances.clickOnSendBtn(0)
})

it('Verify that the Send button shows when hovering a row [C56054]', () => {
it.skip('Verify that the Send button shows when hovering a row [C56054]', () => {
owner.clickOnWalletExpandMoreIcon()
owner.clickOnDisconnectBtn()
balances.selectTokenList(balances.tokenListOptions.allTokens)
balances.showSendBtn(0)
owner.verifyTooltiptext(owner.disconnectedUserErrorMsg)
// TODO: This safe has no assets which leads to the new view where the nonOwnerErrorMsg doesn't exist
cy.visit(constants.BALANCE_URL + constants.SEPOLIA_TEST_SAFE_4)
balances.selectTokenList(balances.tokenListOptions.allTokens)
balances.showSendBtn(0)
Expand Down
24 changes: 16 additions & 8 deletions src/components/balances/AssetsTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import EthHashInfo from '@/components/common/EthHashInfo'
import QRCode from '@/components/common/QRCode'
import { AppRoutes } from '@/config/routes'
import { useRemoteSafeApps } from '@/hooks/safe-apps/useRemoteSafeApps'
import { useCurrentChain } from '@/hooks/useChains'
import useSafeAddress from '@/hooks/useSafeAddress'
import { useAppSelector } from '@/store'
Expand Down Expand Up @@ -277,6 +278,9 @@ const NoAssets = () => {
const settings = useAppSelector(selectSettings)
const qrPrefix = settings.shortName.qr ? `${chain?.shortName}:` : ''
const qrCode = `${qrPrefix}${safeAddress}`
const [apps] = useRemoteSafeApps()

const rampSafeApp = apps?.find((app) => app.name === 'Ramp Network')

return (
<Paper>
Expand All @@ -296,14 +300,18 @@ const NoAssets = () => {
<Box bgcolor="background.main" p={2} borderRadius="6px" alignSelf="flex-start" fontSize="14px">
<EthHashInfo address={safeAddress} shortAddress={false} showCopyButton hasExplorer avatarSize={24} />
</Box>
<Box alignSelf="flex-start">
{/* TODO: Insert link for Ramp app */}
<Link href={{ pathname: AppRoutes.apps.index, query: router.query }} passHref>
<Button variant="contained" size="small" startIcon={<AddIcon />}>
Buy crypto
</Button>
</Link>
</Box>
{rampSafeApp && (
<Box alignSelf="flex-start">
<Link
href={{ pathname: AppRoutes.apps.index, query: { safe: router.query.safe, appUrl: rampSafeApp.url } }}
passHref
>
<Button variant="contained" size="small" startIcon={<AddIcon />}>
Buy crypto
</Button>
</Link>
</Box>
)}
</Grid>
</Grid>
</Paper>
Expand Down

0 comments on commit a3acd2d

Please sign in to comment.