Skip to content

Commit 711c6b4

Browse files
authored
refactor(protocol-designer): clean up navigation redux selectors and … (#17781)
…reducers
1 parent 4090938 commit 711c6b4

File tree

6 files changed

+15
-19
lines changed

6 files changed

+15
-19
lines changed

protocol-designer/cypress/e2e/urlNavigation.cy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ describe('URL Navigation', () => {
66
it('createNew', () => {
77
cy.visit('#/createNew')
88
// directly navigating sends you back to the home page
9-
cy.verifyHomePage()
9+
cy.verifyOnboardingPage()
1010
})
1111
it('overview', () => {
1212
cy.visit('#/overview')

protocol-designer/cypress/support/commands.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'cypress-file-upload'
2+
import { SetupContent } from './SetupSteps'
23
declare global {
34
// eslint-disable-next-line @typescript-eslint/no-namespace
45
namespace Cypress {
@@ -34,6 +35,7 @@ declare global {
3435
mixaspirate: () => Cypress.Chainable<void>
3536
clickConfirm: () => Cypress.Chainable<void>
3637
verifyOverflowBtn: () => Cypress.Chainable<void>
38+
verifyOnboardingPage: () => Cypress.Chainable<void>
3739
}
3840
}
3941
}
@@ -109,6 +111,14 @@ Cypress.Commands.add('verifyCreateNewHeader', () => {
109111
verifyUniversal()
110112
})
111113

114+
// Onboarding page
115+
Cypress.Commands.add('verifyOnboardingPage', () => {
116+
verifyUniversal()
117+
cy.get(locators.privacyPolicy).should('exist').and('be.visible')
118+
cy.get(locators.eula).should('exist').and('be.visible')
119+
cy.contains(SetupContent.LetsGetStarted)
120+
})
121+
112122
// Home Page
113123
Cypress.Commands.add('verifyHomePage', () => {
114124
cy.contains(content.welcome)
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as actions from './actions'
22
import { rootReducer } from './reducers'
3-
import * as selectors from './selectors'
43
import type { RootState } from './reducers'
54

6-
export { actions, rootReducer, selectors }
5+
export { actions, rootReducer }
76
export type { RootState }

protocol-designer/src/navigation/reducers/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const newProtocolModal: Reducer<boolean, any> = handleActions(
1212
state,
1313
action: ToggleNewProtocolModalAction
1414
): boolean => action.payload,
15-
CREATE_NEW_PROTOCOL: () => false,
1615
},
1716
false
1817
)

protocol-designer/src/navigation/selectors.ts

Lines changed: 0 additions & 4 deletions
This file was deleted.

protocol-designer/src/pages/CreateNewProtocolWizard/index.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as Yup from 'yup'
2-
import { useEffect, useState } from 'react'
2+
import { useState } from 'react'
33
import reduce from 'lodash/reduce'
44
import omit from 'lodash/omit'
55
import uniq from 'lodash/uniq'
@@ -39,7 +39,6 @@ import {
3939
createDeckFixture,
4040
toggleIsGripperRequired,
4141
} from '../../step-forms/actions/additionalItems'
42-
import { getNewProtocolModal } from '../../navigation/selectors'
4342
import { SelectModules } from '../../components/organisms/SelectModules'
4443
import { SelectRobot } from './SelectRobot'
4544
import { SelectPipettes } from './SelectPipettes'
@@ -157,7 +156,6 @@ const validationSchema: any = Yup.object().shape({
157156

158157
export function CreateNewProtocolWizard(): JSX.Element | null {
159158
const navigate = useNavigate()
160-
const showWizard = useSelector(getNewProtocolModal)
161159
const [analyticsStartTime] = useState<Date>(new Date())
162160
const customLabware = useSelector(
163161
labwareDefSelectors.getCustomLabwareDefsByURI
@@ -167,12 +165,6 @@ export function CreateNewProtocolWizard(): JSX.Element | null {
167165

168166
const dispatch = useDispatch<ThunkDispatch<BaseState, any, any>>()
169167

170-
useEffect(() => {
171-
if (!showWizard) {
172-
navigate('/overview')
173-
}
174-
}, [showWizard])
175-
176168
const createProtocolFile = (values: WizardFormState): void => {
177169
navigate('/overview')
178170

@@ -382,7 +374,7 @@ export function CreateNewProtocolWizard(): JSX.Element | null {
382374
}
383375
}
384376

385-
return showWizard ? (
377+
return (
386378
<Box backgroundColor={COLORS.grey10} height="calc(100vh - 48px)">
387379
<CreateFileForm
388380
currentWizardStep={currentWizardStep}
@@ -393,7 +385,7 @@ export function CreateNewProtocolWizard(): JSX.Element | null {
393385
analyticsStartTime={analyticsStartTime}
394386
/>
395387
</Box>
396-
) : null
388+
)
397389
}
398390

399391
interface CreateFileFormProps {

0 commit comments

Comments
 (0)