-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): warning modal if steps aren't complete
Add a warning modal for steps that have not yet been completed when you proceed to run.
- Loading branch information
Showing
6 changed files
with
163 additions
and
14 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
app/src/organisms/Devices/ProtocolRun/ConfirmMissingStepsModal.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,67 @@ | ||
import * as React from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { | ||
ALIGN_CENTER, | ||
DIRECTION_COLUMN, | ||
DIRECTION_ROW, | ||
Flex, | ||
JUSTIFY_FLEX_END, | ||
Link, | ||
Check failure on line 9 in app/src/organisms/Devices/ProtocolRun/ConfirmMissingStepsModal.tsx GitHub Actions / js checks
|
||
PrimaryButton, | ||
SecondaryButton, | ||
SPACING, | ||
LegacyStyledText, | ||
TEXT_ALIGN_CENTER, | ||
Check failure on line 14 in app/src/organisms/Devices/ProtocolRun/ConfirmMissingStepsModal.tsx GitHub Actions / js checks
|
||
TYPOGRAPHY, | ||
} from '@opentrons/components' | ||
import { LegacyModal } from '../../../molecules/LegacyModal' | ||
|
||
interface ConfirmMissingStepsModalProps { | ||
onCloseClick: () => void | ||
onConfirmClick: () => void | ||
missingSteps: string[] | ||
} | ||
export const ConfirmMissingStepsModal = ( | ||
props: ConfirmMissingStepsModalProps | ||
): JSX.Element | null => { | ||
const { missingSteps, onCloseClick, onConfirmClick } = props | ||
const { t, i18n } = useTranslation(['protocol_setup', 'shared']) | ||
|
||
const confirmAttached = (): void => { | ||
onConfirmClick() | ||
onCloseClick() | ||
} | ||
|
||
return ( | ||
<LegacyModal | ||
title={t('are_you_sure_you_want_to_proceed')} | ||
type="warning" | ||
onClose={onCloseClick} | ||
> | ||
<Flex flexDirection={DIRECTION_COLUMN} fontSize={TYPOGRAPHY.fontSizeP}> | ||
<LegacyStyledText paddingBottom={SPACING.spacing4}> | ||
{t('you_havent_confirmed', { | ||
missingSteps: new Intl.ListFormat('en', { | ||
style: 'short', | ||
type: 'conjunction', | ||
}).format(missingSteps.map(step => t(step))), | ||
})} | ||
</LegacyStyledText> | ||
</Flex> | ||
<Flex | ||
flexDirection={DIRECTION_ROW} | ||
paddingTop={SPACING.spacing32} | ||
justifyContent={JUSTIFY_FLEX_END} | ||
alignItems={ALIGN_CENTER} | ||
gap={SPACING.spacing8} | ||
> | ||
<SecondaryButton onClick={onCloseClick}> | ||
{i18n.format(t('shared:go_back'), 'capitalize')} | ||
</SecondaryButton> | ||
<PrimaryButton onClick={confirmAttached}> | ||
{t('start_run')} | ||
</PrimaryButton> | ||
</Flex> | ||
</LegacyModal> | ||
) | ||
} |
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
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
Oops, something went wrong.