Skip to content

Commit

Permalink
Refactor: remove QR scanner in address inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Jan 29, 2024
1 parent fa16a20 commit 47b0b8f
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 192 deletions.
7 changes: 0 additions & 7 deletions cypress/e2e/pages/load_safe.pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const addressInput = 'input[name="address"]'
const sideBarIcon = '[data-testid="ChevronRightIcon"]'
const sidebarCheckIcon = '[data-testid="CheckIcon"]'
const addressStepNextBtn = '[data-testid="load-safe-next-btn"]'
const qrCodeBtn = '[data-testid="address-qr-scan"]'
const typeFile = '[type="file"]'
const nextBtnStr = 'Next'
const addBtnStr = 'Add'
Expand Down Expand Up @@ -65,12 +64,6 @@ export function verifyNameLengthErrorMessage() {
cy.get(nameInput).parent().prev('label').contains(invalidAddressNameLengthErrorMsg)
}

export function scanQRCode(image) {
cy.get(qrCodeBtn).click()
cy.contains('Upload an image').click()
cy.get(typeFile).attachFile(image)
}

export function inputAddress(address) {
cy.get(addressInput).clear().type(address)
}
Expand Down
12 changes: 0 additions & 12 deletions cypress/e2e/smoke/load_safe.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,6 @@ describe('[SMOKE] Load Safe tests', () => {
safe.clickOnNextBtn()
})

it('[SMOKE] Verify a valid QR code is accepted', () => {
safe.scanQRCode(constants.VALID_QR_CODE_PATH)
safe.verifyAddressInputValue(constants.SEPOLIA_TEST_SAFE_6)
safe.verifyNextButtonStatus('be.enabled')
safe.clickOnNextBtn()
})

it('[SMOKE] Verify a non QR code is not accepted', () => {
safe.scanQRCode(constants.INVALID_QR_CODE_PATH)
safe.verifyQRCodeErrorMsg()
})

it('[SMOKE] Verify the custom Safe name is successfully loaded', () => {
safe.inputNameAndAddress(testSafeName, constants.SEPOLIA_TEST_SAFE_2)
safe.clickOnNextBtn()
Expand Down
5 changes: 0 additions & 5 deletions cypress/e2e/smoke/spending_limits.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ describe('[SMOKE] Spending limits tests', () => {
spendinglimit.verifyValidAddressShowsNoErrors()
})

it('Verify Fill by QR code with a valid address', () => {
safe.scanQRCode(constants.VALID_QR_CODE_PATH)
spendinglimit.checkBeneficiaryENS(constants.SEPOLIA_TEST_SAFE_6)
})

it('Verify Amount input cannot be 0', () => {
spendinglimit.enterSpendingLimitAmount('0')
spendinglimit.verifyNumberErrorValidation()
Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"react-gtm-module": "^2.0.11",
"react-hook-form": "7.41.1",
"react-papaparse": "^4.0.2",
"react-qr-reader": "2.2.1",
"react-redux": "^8.0.5",
"semver": "^7.5.2"
},
Expand All @@ -114,7 +113,6 @@
"@types/react": "18.2.28",
"@types/react-dom": "18.2.13",
"@types/react-gtm-module": "^2.0.1",
"@types/react-qr-reader": "^2.1.5",
"@types/semver": "^7.3.10",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@walletconnect/types": "^2.11.0",
Expand Down
3 changes: 0 additions & 3 deletions src/components/common/AddressInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useFormContext, useWatch, type Validate, get } from 'react-hook-form'
import { validatePrefixedAddress } from '@/utils/validation'
import { useCurrentChain } from '@/hooks/useChains'
import useNameResolver from './useNameResolver'
import ScanQRButton from '../ScanQRModal/ScanQRButton'
import { FEATURES, hasFeature } from '@/utils/chains'
import { cleanInputValue, parsePrefixedAddress } from '@/utils/addresses'
import useDebounce from '@/hooks/useDebounce'
Expand Down Expand Up @@ -97,8 +96,6 @@ const AddressInput = ({
</IconButton>
)}

<ScanQRButton onScan={setAddressValue} />

{onOpenListClick && (
<IconButton
onClick={onOpenListClick}
Expand Down
45 changes: 0 additions & 45 deletions src/components/common/ScanQRModal/ScanQRButton.tsx

This file was deleted.

101 changes: 0 additions & 101 deletions src/components/common/ScanQRModal/index.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions src/services/analytics/events/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ export const MODALS_EVENTS = {
action: 'Contract interaction',
category: MODALS_CATEGORY,
},
SCAN_QR: {
action: 'Scan QR',
category: MODALS_CATEGORY,
},
SCAN_QR_FINISHED: {
action: 'Scan QR finished',
category: MODALS_CATEGORY,
},
TX_DETAILS: {
action: 'Transaction details',
category: MODALS_CATEGORY,
Expand Down
11 changes: 2 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5447,13 +5447,6 @@
resolved "https://registry.yarnpkg.com/@types/react-gtm-module/-/react-gtm-module-2.0.1.tgz#b2c6cd14ec251d6ae7fa576edf1d43825908a378"
integrity sha512-T/DN9gAbCYk5wJ1nxf4pSwmXz4d1iVjM++OoG+mwMfz9STMAotGjSb65gJHOS5bPvl6vLSsJnuC+y/43OQrltg==

"@types/react-qr-reader@^2.1.5":
version "2.1.5"
resolved "https://registry.yarnpkg.com/@types/react-qr-reader/-/react-qr-reader-2.1.5.tgz#933351729b01f61ab7700fec3ed3f78737ed08a1"
integrity sha512-a21g42lQkBKr87zS0idEkTsnVB/UObQol9RcB7YTkLokz3bwwDVJqnXaOliITIAfZtQAYpsPAj08Mb9G2U8K4A==
dependencies:
"@types/react" "*"

"@types/react-transition-group@^4.4.10", "@types/react-transition-group@^4.4.5":
version "4.4.10"
resolved "https://registry.yarnpkg.com/@types/react-transition-group/-/react-transition-group-4.4.10.tgz#6ee71127bdab1f18f11ad8fb3322c6da27c327ac"
Expand Down Expand Up @@ -5697,7 +5690,7 @@
events "^3.3.0"
isomorphic-unfetch "^3.1.0"

"@walletconnect/[email protected]", "@walletconnect/core@^2.10.1", "@walletconnect/core@^2.11.0":
"@walletconnect/[email protected]", "@walletconnect/core@^2.10.1":
version "2.11.0"
resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.11.0.tgz#3a4e301077b2f858fd916b7a20b5b984d1afce63"
integrity sha512-2Tjp5BCevI7dbmqo/OrCjX4tqgMqwJNQLlQAlphqPfvwlF9+tIu6pGcVbSN3U9zyXzWIZCeleqEaWUeSeET4Ew==
Expand Down Expand Up @@ -13562,7 +13555,7 @@ react-papaparse@^4.0.2:
"@types/papaparse" "^5.3.9"
papaparse "^5.4.1"

react-qr-reader@2.2.1, react-qr-reader@^2.2.1:
react-qr-reader@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/react-qr-reader/-/react-qr-reader-2.2.1.tgz#dc89046d1c1a1da837a683dd970de5926817d55b"
integrity sha512-EL5JEj53u2yAOgtpAKAVBzD/SiKWn0Bl7AZy6ZrSf1lub7xHwtaXe6XSx36Wbhl1VMGmvmrwYMRwO1aSCT2fwA==
Expand Down

0 comments on commit 47b0b8f

Please sign in to comment.