-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): add setup instructions modal (#12933)
Add setup instructions modal to protocolsetup modules screen.
- Loading branch information
Showing
9 changed files
with
136 additions
and
12 deletions.
There are no files selected for viewing
Binary file added
BIN
+458 Bytes
app/src/assets/images/on-device-display/setup_instructions_qr_code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
"comment_step": "Comment", | ||
"comment": "Comment", | ||
"complete_protocol_to_download": "Complete the protocol to download the run log", | ||
"contact_information": "Please contact [email protected] with relevant information for assistance with troubleshooting.", | ||
"contact_information": "Download the run logs from the Opentrons App and send it to [email protected] for assistance.", | ||
"current_step_pause_timer": "Timer", | ||
"current_step_pause": "Current Step - Paused by User", | ||
"current_step": "Current Step", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,9 @@ describe('RunFailedModal', () => { | |
getByText( | ||
'ProtocolEngineError [line 16]: ModuleNotAttachedError: No available' | ||
) | ||
getByText( | ||
'Download the run logs from the Opentrons App and send it to [email protected] for assistance.' | ||
) | ||
getByText('Close') | ||
}) | ||
|
||
|
68 changes: 68 additions & 0 deletions
68
app/src/organisms/ProtocolSetupModules/SetupInstructionsModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import * as React from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
|
||
import { | ||
ALIGN_STRETCH, | ||
BORDERS, | ||
COLORS, | ||
DIRECTION_COLUMN, | ||
DIRECTION_ROW, | ||
Flex, | ||
SPACING, | ||
TYPOGRAPHY, | ||
} from '@opentrons/components' | ||
import { StyledText } from '../../atoms/text' | ||
import { Modal } from '../../molecules/Modal' | ||
|
||
import type { ModalHeaderBaseProps } from '../../molecules/Modal/types' | ||
|
||
import imgSrc from '../../assets/images/on-device-display/setup_instructions_qr_code.png' | ||
|
||
const INSTRUCTIONS_URL = 'support.opentrons.com/s/modules' | ||
|
||
interface SetupInstructionsModalProps { | ||
setShowSetupInstructionsModal: (showSetupInstructionsModal: boolean) => void | ||
} | ||
export function SetupInstructionsModal({ | ||
setShowSetupInstructionsModal, | ||
}: SetupInstructionsModalProps): JSX.Element { | ||
const { i18n, t } = useTranslation('protocol_setup') | ||
const modalHeader: ModalHeaderBaseProps = { | ||
title: i18n.format(t('setup_instructions'), 'capitalize'), | ||
iconName: 'information', | ||
iconColor: COLORS.darkBlack100, | ||
hasExitIcon: true, | ||
} | ||
|
||
return ( | ||
<Modal | ||
header={modalHeader} | ||
onOutsideClick={() => setShowSetupInstructionsModal(false)} | ||
> | ||
<Flex | ||
flexDirection={DIRECTION_ROW} | ||
alignSelf={ALIGN_STRETCH} | ||
gridGap={SPACING.spacing40} | ||
> | ||
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing24}> | ||
<StyledText as="p">{t('setup_instructions_description')}</StyledText> | ||
<Flex | ||
backgroundColor={COLORS.light1} | ||
borderRadius={BORDERS.borderRadiusSize3} | ||
padding={`${SPACING.spacing16} ${SPACING.spacing24}`} | ||
> | ||
<StyledText as="p" fontWeight={TYPOGRAPHY.fontWeightSemiBold}> | ||
{INSTRUCTIONS_URL} | ||
</StyledText> | ||
</Flex> | ||
</Flex> | ||
<img | ||
src={imgSrc} | ||
alt="Setup Instructions QR Code" | ||
width="178px" | ||
height="178px" | ||
/> | ||
</Flex> | ||
</Modal> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
app/src/organisms/ProtocolSetupModules/__tests__/SetupInstructionsModal.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as React from 'react' | ||
|
||
import { renderWithProviders } from '@opentrons/components' | ||
|
||
import { i18n } from '../../../i18n' | ||
|
||
import { SetupInstructionsModal } from '../SetupInstructionsModal' | ||
|
||
const mockSetShowSetupInstructionsModal = jest.fn() | ||
const QR_CODE_IMAGE_FILE = 'setup_instructions_qr_code.png' | ||
|
||
const render = (props: React.ComponentProps<typeof SetupInstructionsModal>) => { | ||
return renderWithProviders(<SetupInstructionsModal {...props} />, { | ||
i18nInstance: i18n, | ||
}) | ||
} | ||
|
||
describe('SetupInstructionsModal', () => { | ||
let props: React.ComponentProps<typeof SetupInstructionsModal> | ||
|
||
beforeEach(() => { | ||
props = { | ||
setShowSetupInstructionsModal: mockSetShowSetupInstructionsModal, | ||
} | ||
}) | ||
|
||
it('should render text and image', () => { | ||
const [{ getByText, getByRole }] = render(props) | ||
getByText('Setup instructions') | ||
getByText( | ||
'For step-by-step instructions on setting up your module, consult the Quickstart Guide that came in its box or scan the QR code to visit the modules section of the Opentrons Help Center.' | ||
) | ||
getByText('support.opentrons.com/s/modules') | ||
expect(getByRole('img').getAttribute('src')).toEqual(QR_CODE_IMAGE_FILE) | ||
}) | ||
|
||
it('should call mock function when tapping close icon', () => { | ||
const [{ getByLabelText }] = render(props) | ||
getByLabelText('closeIcon').click() | ||
expect(mockSetShowSetupInstructionsModal).toHaveBeenCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters