Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: redesign Load Safe #1405

Merged
merged 15 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions cypress/e2e/smoke/load_safe.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,20 @@ describe('Load existing Safe', () => {

it('should allow choosing the network where the Safe exists', () => {
// Click the network selector inside the Stepper content
cy.contains('Select network on which the Safe was created:').contains('span', 'Polygon').click()
cy.get('[data-testid=load-safe-form]').contains('Polygon').click()

// Selects Goerli
cy.get('ul li')
.contains(/^G(ö|oe)rli$/)
.click()
cy.contains('Select network on which the Safe was created:').contains('span', /^G(ö|oe)rli$/)

cy.contains('Continue').click()
cy.contains('span', /^G(ö|oe)rli$/)
})

it('should accept name the Safe', () => {
// alias the address input label
cy.get('input[name="address"]').parent().prev('label').as('addressLabel')

// Name input should have a placeholder ending in 'rinkeby-safe'
// Name input should have a placeholder ending in 'goerli-safe'
cy.get('input[name="name"]')
.should('have.attr', 'placeholder')
.should('match', /g(ö|oe)rli-safe/)
Expand Down Expand Up @@ -77,7 +75,7 @@ describe('Load existing Safe', () => {
const [, address] = SAFE_QR_CODE_ADDRESS.split(':')
cy.get('input[name="address"]').should('have.value', address)

cy.contains('Continue').click()
cy.contains('Next').click()
})

// TODO: register the goerli ENS for the Safe owner when possible
Expand All @@ -92,7 +90,7 @@ describe('Load existing Safe', () => {
it('should set custom name in the first owner', () => {
// Sets a custom name for the first owner
cy.get('input[name="owners.0.name"]').type('Test Owner Name').should('have.value', 'Test Owner Name')
cy.contains('Continue').click()
cy.contains('Next').click()
})

it('should have Safe and owner names in the Review step', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/NetworkSelector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NetworkSelector = (): ReactElement => {

trackEvent({ ...OVERVIEW_EVENTS.SWITCH_NETWORK, label: selectedChainId })

const shouldKeepPath = [AppRoutes.load, AppRoutes.open, AppRoutes.newSafe.create].includes(router.pathname)
const shouldKeepPath = [AppRoutes.newSafe.create, AppRoutes.newSafe.load].includes(router.pathname)

const newRoute = {
pathname: shouldKeepPath ? router.pathname : '/',
Expand Down
10 changes: 9 additions & 1 deletion src/components/common/PageLayout/SideDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ const isNewSafeRoute = (pathname: string): boolean => {
return pathname === AppRoutes.newSafe.create
}

const isLoadSafeRoute = (pathname: string): boolean => {
return pathname === AppRoutes.newSafe.load
}

const isAppShareRoute = (pathname: string): boolean => {
return pathname === AppRoutes.share.safeApp
}
Expand All @@ -36,7 +40,11 @@ const SideDrawer = ({ isOpen, onToggle }: SideDrawerProps): ReactElement => {

useEffect(() => {
const closeSidebar =
isSmallScreen || isSafeAppRoute(pathname, query) || isAppShareRoute(pathname) || isNewSafeRoute(pathname)
isSmallScreen ||
isSafeAppRoute(pathname, query) ||
isAppShareRoute(pathname) ||
isNewSafeRoute(pathname) ||
isLoadSafeRoute(pathname)
onToggle(!closeSidebar)
}, [isSmallScreen, onToggle, pathname, query])

Expand Down
57 changes: 0 additions & 57 deletions src/components/load-safe/index.tsx

This file was deleted.

96 changes: 0 additions & 96 deletions src/components/load-safe/steps/SafeOwnersStep.tsx

This file was deleted.

Loading