Skip to content

Commit

Permalink
fix(app): get back unboxingFlow path update function (#16411) (#16428)
Browse files Browse the repository at this point in the history
## Cherry-pick 4bca02a #16411 

- [ ] Reviewer please validate that I resolved the conflicts correctly
as edge has the import pathing updates.

Co-authored-by: koji <koji.kanao@opentrons.com>
  • Loading branch information
y3rsh and koji authored Oct 7, 2024
1 parent 528326f commit d1de808
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/pages/ODD/RobotDashboard/WelcomeModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect } from 'react'
import { useTranslation } from 'react-i18next'
import { useDispatch } from 'react-redux'

import {
COLORS,
Expand All @@ -14,10 +15,12 @@ import { useCreateLiveCommandMutation } from '@opentrons/react-api-client'

import { SmallButton } from '/app/atoms/buttons'
import { OddModal } from '/app/molecules/OddModal'
import { updateConfigValue } from '/app/redux/config'

import welcomeModalImage from '/app/assets/images/on-device-display/welcome_dashboard_modal.png'

import type { SetStatusBarCreateCommand } from '@opentrons/shared-data'
import type { Dispatch } from '/app/redux/types'

interface WelcomeModalProps {
setShowWelcomeModal: (showWelcomeModal: boolean) => void
Expand All @@ -27,6 +30,7 @@ export function WelcomeModal({
setShowWelcomeModal,
}: WelcomeModalProps): JSX.Element {
const { t } = useTranslation(['device_details', 'shared'])
const dispatch = useDispatch<Dispatch>()

const { createLiveCommand } = useCreateLiveCommandMutation()
const animationCommand: SetStatusBarCreateCommand = {
Expand All @@ -44,6 +48,12 @@ export function WelcomeModal({
}

const handleCloseModal = (): void => {
dispatch(
updateConfigValue(
'onDeviceDisplaySettings.unfinishedUnboxingFlowRoute',
null
)
)
setShowWelcomeModal(false)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useCreateLiveCommandMutation } from '@opentrons/react-api-client'

import { renderWithProviders } from '/app/__testing-utils__'
import { i18n } from '/app/i18n'
import { updateConfigValue } from '/app/redux/config'
import { WelcomeModal } from '../WelcomeModal'

import type { SetStatusBarCreateCommand } from '@opentrons/shared-data'
Expand Down Expand Up @@ -61,6 +62,10 @@ describe('WelcomeModal', () => {
it('should call a mock function when tapping next button', () => {
render(props)
fireEvent.click(screen.getByText('Next'))
expect(vi.mocked(updateConfigValue)).toHaveBeenCalledWith(
'onDeviceDisplaySettings.unfinishedUnboxingFlowRoute',
null
)
expect(props.setShowWelcomeModal).toHaveBeenCalled()
})
})

0 comments on commit d1de808

Please sign in to comment.