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

refactor(app): are you sure you want to cancel modal on desktop app #15662

Merged
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f96860c
initial commit - replace return null
TamarZanzouri Jul 3, 2024
8a25aca
cancel run css styles WIP
TamarZanzouri Jul 10, 2024
cead17a
styling desktop
TamarZanzouri Jul 10, 2024
b32708e
Merge branch 'edge' into EXEC-553-desktop-wire-up-are-you-sure-you-wa…
TamarZanzouri Jul 10, 2024
8be5efd
adding styles for desktop
TamarZanzouri Jul 10, 2024
e4c8e71
refactor
TamarZanzouri Jul 11, 2024
00c5c09
added footer buttons
TamarZanzouri Jul 11, 2024
2a43e0a
reverted ODD changes only and use desktop component
TamarZanzouri Jul 11, 2024
3c595ed
show error details on desktop - not styled yet
TamarZanzouri Jul 11, 2024
07b1ffa
remove isOnDevice flag and fix styling wish media
TamarZanzouri Jul 12, 2024
0298020
fixed missing component
TamarZanzouri Jul 12, 2024
44c8645
manage tips - cancel run WIP
TamarZanzouri Jul 12, 2024
d9a7af7
Merge branch 'edge' into EXEC-553-desktop-wire-up-are-you-sure-you-wa…
TamarZanzouri Jul 15, 2024
af23b00
merge conflcts
TamarZanzouri Jul 15, 2024
e38fdfb
radioButton WIP
TamarZanzouri Jul 15, 2024
4ffac02
styling radio button
TamarZanzouri Jul 15, 2024
e3616e7
linting and style fixes
TamarZanzouri Jul 15, 2024
94cd119
Update app/src/organisms/ErrorRecoveryFlows/ErrorRecoveryWizard.tsx
TamarZanzouri Jul 15, 2024
02d1f21
removed unused component for desktop
TamarZanzouri Jul 15, 2024
59271ed
text style for button
TamarZanzouri Jul 15, 2024
87bb181
removed ErrorDetailsModal for desktop
TamarZanzouri Jul 15, 2024
0238154
pr feedback. moved styling into desktop styles
TamarZanzouri Jul 16, 2024
9a1ecbb
linting and more fixes
TamarZanzouri Jul 16, 2024
fe7b6f9
revert radio button changes and apply to radio group
TamarZanzouri Jul 16, 2024
7fb4f11
radio group
TamarZanzouri Jul 16, 2024
2b8eff0
Merge branch 'edge' into EXEC-553-desktop-wire-up-are-you-sure-you-wa…
TamarZanzouri Jul 18, 2024
b3df530
manage tips with ER radio group
TamarZanzouri Jul 18, 2024
5cdcaad
do not use isOnDevice for icon rendering
TamarZanzouri Jul 18, 2024
9b92a55
lint and style fixes
TamarZanzouri Jul 18, 2024
6fc1c47
fixed failing tests in manage tips
TamarZanzouri Jul 18, 2024
2b10847
linting
TamarZanzouri Jul 18, 2024
d47f4c3
linting and StyledText test fix
TamarZanzouri Jul 18, 2024
71bd2b7
Update app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/ManageTip…
TamarZanzouri Jul 18, 2024
e7d3c68
Update app/src/atoms/buttons/SmallButton.tsx
TamarZanzouri Jul 18, 2024
7460f00
Update app/src/molecules/InterventionModal/index.tsx
TamarZanzouri Jul 18, 2024
bdaa205
pr feedback and removed legacy styled text test
TamarZanzouri Jul 18, 2024
701ff6b
fixed icon styling
TamarZanzouri Jul 19, 2024
8a41e83
css fixes for radio buttons
TamarZanzouri Jul 19, 2024
89fe1ae
reverted changes to LegacyStyledText
TamarZanzouri Jul 19, 2024
a4fff54
removed cast
TamarZanzouri Jul 19, 2024
3ba481a
reverted changes to LegacyStyledText
TamarZanzouri Jul 19, 2024
0915b98
fixed linting issue
TamarZanzouri Jul 19, 2024
0fa5ba9
formatting
TamarZanzouri Jul 19, 2024
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
35 changes: 18 additions & 17 deletions app/src/atoms/buttons/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Flex,
RESPONSIVENESS,
SPACING,
LegacyStyledText,
StyledText,
TYPOGRAPHY,
} from '@opentrons/components'

Expand Down Expand Up @@ -65,16 +65,17 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
// TODO: (ew, 2023-04-21): button is not tabbable, so focus state
// is not possible on ODD. It's testable in storybook but not in real life.
const SettingButtonLabel = styled.label`
border-radius: ${BORDERS.borderRadius16};
cursor: pointer;
padding: ${isLarge ? SPACING.spacing24 : SPACING.spacing20};
width: 100%;
border-radius: ${BORDERS.borderRadius16};
cursor: pointer;
padding: ${isLarge ? SPACING.spacing24 : SPACING.spacing20};
width: 100%;

${isSelected ? SELECTED_BUTTON_STYLE : AVAILABLE_BUTTON_STYLE}
${disabled && DISABLED_BUTTON_STYLE}
${isSelected ? SELECTED_BUTTON_STYLE : AVAILABLE_BUTTON_STYLE}
${disabled && DISABLED_BUTTON_STYLE}

@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
cursor: default;
cursor: default;
}
}
`

Expand All @@ -89,19 +90,19 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
value={buttonValue}
/>
<SettingButtonLabel role="label" htmlFor={buttonLabel}>
<LegacyStyledText
fontSize={isLarge ? TYPOGRAPHY.fontSize28 : TYPOGRAPHY.fontSize22}
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
lineHeight={
isLarge ? TYPOGRAPHY.lineHeight36 : TYPOGRAPHY.lineHeight28
}
<StyledText
oddStyle={isLarge ? 'level4HeaderRegular' : 'bodyTextRegular'}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
desktopStyle="bodyDefaultRegular"
>
{buttonLabel}
</LegacyStyledText>
</StyledText>
{subButtonLabel != null ? (
<LegacyStyledText as="h4" fontWeight={TYPOGRAPHY.fontWeightRegular}>
<StyledText
oddStyle="level4HeaderRegular"
fontWeight={TYPOGRAPHY.fontWeightRegular}
>
{subButtonLabel}
</LegacyStyledText>
</StyledText>
) : null}
</SettingButtonLabel>
</Flex>
Expand Down
11 changes: 5 additions & 6 deletions app/src/atoms/buttons/SmallButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
Icon,
JUSTIFY_CENTER,
SPACING,
LegacyStyledText,
StyledText,
TYPOGRAPHY,
} from '@opentrons/components'
import { ODD_FOCUS_VISIBLE } from './constants'
Expand Down Expand Up @@ -180,13 +180,12 @@ export function SmallButton(props: SmallButtonProps): JSX.Element {
</Flex>
) : null}

<LegacyStyledText
fontSize="1.375rem"
lineHeight={TYPOGRAPHY.lineHeight28}
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
<StyledText
oddStyle="bodyTextSemiBold"
desktopStyle="bodyDefaultSemiBold"
>
{buttonText}
</LegacyStyledText>
</StyledText>
{iconPlacement === 'endIcon' && iconName != null ? (
<Flex
aria-label={
Expand Down
18 changes: 15 additions & 3 deletions app/src/molecules/InterventionModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { useSelector } from 'react-redux'
import { css } from 'styled-components'

import {
ALIGN_CENTER,
Expand All @@ -15,6 +16,7 @@ import {
POSITION_STICKY,
SPACING,
DIRECTION_COLUMN,
RESPONSIVENESS,
} from '@opentrons/components'

import { getIsOnDevice } from '../../redux/config'
Expand Down Expand Up @@ -157,12 +159,11 @@ export function InterventionModal({
{...headerStyle}
backgroundColor={headerColor}
justifyContent={headerJustifyContent}
onClick={iconHeadingOnClick}
>
{titleHeading}
<Flex alignItems={ALIGN_CENTER} gridGap={SPACING.spacing12}>
<Flex alignItems={ALIGN_CENTER} onClick={iconHeadingOnClick}>
{iconName != null ? (
<Icon name={iconName} size={SPACING.spacing32} />
<Icon name={iconName} css={ICON_STYLE} />
) : null}
{iconHeading != null ? iconHeading : null}
</Flex>
Expand All @@ -173,3 +174,14 @@ export function InterventionModal({
</Flex>
)
}

const ICON_STYLE = css`
width: ${SPACING.spacing16}
height: ${SPACING.spacing16}
margin: ${SPACING.spacing4};
@media (${RESPONSIVENESS.touchscreenMediaQuerySpecs}) {
width: ${SPACING.spacing32}
height: ${SPACING.spacing32}
margin: ${SPACING.spacing12};
}
`
15 changes: 11 additions & 4 deletions app/src/organisms/ErrorRecoveryFlows/ErrorRecoveryWizard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'

import { LegacyStyledText } from '@opentrons/components'
import { StyledText } from '@opentrons/components'

import { RecoveryError } from './RecoveryError'
import { RecoveryDoorOpen } from './RecoveryDoorOpen'
Expand Down Expand Up @@ -90,13 +90,20 @@ export function ErrorRecoveryComponent(

const buildTitleHeading = (): JSX.Element => {
const titleText = hasLaunchedRecovery ? t('recovery_mode') : t('cancel_run')
return <LegacyStyledText as="h4Bold">{titleText}</LegacyStyledText>
return (
<StyledText
oddStyle="level4HeaderBold"
desktopStyle="headingSmallRegular"
>
{titleText}
</StyledText>
)
}

const buildIconHeading = (): JSX.Element => (
<LegacyStyledText as="pSemiBold">
<StyledText oddStyle="bodyTextSemiBold" desktopStyle="bodyDefaultSemiBold">
{t('view_error_details')}
</LegacyStyledText>
</StyledText>
)

// TODO(jh, 07-16-24): Revisit making RecoveryDoorOpen a route.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { css } from 'styled-components'

import {
ALIGN_CENTER,
Expand All @@ -8,7 +9,8 @@ import {
Flex,
Icon,
SPACING,
LegacyStyledText,
StyledText,
RESPONSIVENESS,
} from '@opentrons/components'

import { RECOVERY_MAP } from '../constants'
Expand Down Expand Up @@ -68,24 +70,25 @@ function CancelRunConfirmation({
alignItems={ALIGN_CENTER}
gridGap={SPACING.spacing24}
height="100%"
width="848px"
css={FLEX_WIDTH}
>
<Icon
name="ot-alert"
size="3.75rem"
css={ICON_SIZE}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
marginTop={SPACING.spacing24}
color={COLORS.red50}
/>
<LegacyStyledText as="h3Bold">
<StyledText oddStyle="level3HeaderBold" desktopStyle="headingSmallBold">
{t('are_you_sure_you_want_to_cancel')}
</LegacyStyledText>
<LegacyStyledText
as="h4"
</StyledText>
<StyledText
oddStyle="level4HeaderRegular"
desktopStyle="bodyDefaultRegular"
color={COLORS.grey60}
textAlign={ALIGN_CENTER}
>
{t('if_tips_are_attached')}
</LegacyStyledText>
</StyledText>
</Flex>
<RecoveryFooterButtons
primaryBtnOnClick={handleCancelRunClick}
Expand Down Expand Up @@ -143,3 +146,19 @@ export function useOnCancelRun({

return { showBtnLoadingState, handleCancelRunClick }
}

const FLEX_WIDTH = css`
width: 41.625rem;
@media (${RESPONSIVENESS.touchscreenMediaQuerySpecs}) {
width: 53rem;
}
`

const ICON_SIZE = css`
width: ${SPACING.spacing40}
height: ${SPACING.spacing40}
@media (${RESPONSIVENESS.touchscreenMediaQuerySpecs}) {
width: ${SPACING.spacing60}
height: ${SPACING.spacing60}
}
`
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import head from 'lodash/head'
import { css } from 'styled-components'

import {
DIRECTION_COLUMN,
SPACING,
Flex,
LegacyStyledText,
StyledText,
} from '@opentrons/components'
import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data'

import { RadioButton } from '../../../atoms/buttons'
import { ODD_SECTION_TITLE_STYLE, RECOVERY_MAP } from '../constants'
import {
ODD_SECTION_TITLE_STYLE,
RECOVERY_MAP,
ODD_ONLY,
DESKTOP_ONLY,
} from '../constants'
import {
RecoveryFooterButtons,
RecoverySingleColumnContentWrapper,
RecoveryRadioGroup,
} from '../shared'
import { DropTipWizardFlows } from '../../DropTipWizardFlows'
import { DT_ROUTES } from '../../DropTipWizardFlows/constants'
Expand Down Expand Up @@ -91,10 +98,18 @@ export function BeginRemoval({

return (
<RecoverySingleColumnContentWrapper>
<LegacyStyledText css={ODD_SECTION_TITLE_STYLE} as="h4SemiBold">
<StyledText
css={ODD_SECTION_TITLE_STYLE}
oddStyle="level4HeaderSemiBold"
desktopStyle="headingSmallSemiBold"
>
{t('you_may_want_to_remove', { mount })}
</LegacyStyledText>
<Flex flexDirection={DIRECTION_COLUMN} gridGap={SPACING.spacing4}>
</StyledText>
<Flex
flexDirection={DIRECTION_COLUMN}
gridGap={SPACING.spacing4}
css={ODD_ONLY}
>
<RadioButton
buttonLabel={t('begin_removal')}
buttonValue={t('begin_removal')}
Expand All @@ -112,6 +127,39 @@ export function BeginRemoval({
isSelected={selected === 'skip'}
/>
</Flex>
<Flex
flexDirection={DIRECTION_COLUMN}
gridGap={SPACING.spacing4}
css={DESKTOP_ONLY}
>
<RecoveryRadioGroup
css={css`
padding: ${SPACING.spacing4};
`}
value={selected}
onChange={e => {
setSelected(e.currentTarget.value as RemovalOptions)
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
}}
options={[
{
value: t('begin_removal'),
children: (
<StyledText desktopStyle="bodyDefaultRegular">
{t('begin_removal')}
</StyledText>
),
},
{
value: t('skip'),
children: (
<StyledText desktopStyle="bodyDefaultRegular">
{t('skip')}
</StyledText>
),
},
]}
/>
</Flex>
<RecoveryFooterButtons primaryBtnOnClick={primaryOnClick} />
</RecoverySingleColumnContentWrapper>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ describe('ManageTips', () => {
screen.getByText(
'You may want to remove the tips from the left pipette before using it again in a protocol'
)
screen.getByText('Begin removal')
screen.getByText('Skip')
screen.queryAllByText('Begin removal')
screen.queryAllByText('Skip')
expect(screen.getAllByText('Continue').length).toBe(2)
})

it('routes correctly when continuing on BeginRemoval', () => {
render(props)

const beginRemovalBtn = screen.getByText('Begin removal')
const skipBtn = screen.getByText('Skip')
const beginRemovalBtn = screen.queryAllByText('Begin removal')[0]
const skipBtn = screen.queryAllByText('Skip')[0]

fireEvent.click(beginRemovalBtn)
clickButtonLabeled('Continue')
Expand All @@ -124,7 +124,7 @@ describe('ManageTips', () => {
}
render(props)

const skipBtn = screen.getByText('Skip')
const skipBtn = screen.queryAllByText('Skip')[0]

fireEvent.click(skipBtn)
clickButtonLabeled('Continue')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,7 @@ type ErrorDetailsModalProps = ErrorRecoveryFlowsProps &
robotType: RobotType
}

export function ErrorDetailsModal(
props: ErrorDetailsModalProps
): JSX.Element | null {
if (props.isOnDevice) {
return <ErrorDetailsModalODD {...props} />
} else {
return null
}
}

// For ODD use only.
export function ErrorDetailsModalODD(
props: ErrorDetailsModalProps
): JSX.Element {
export function ErrorDetailsModal(props: ErrorDetailsModalProps): JSX.Element {
const { failedCommand, toggleModal, isOnDevice } = props
const errorKind = getErrorKind(failedCommand)
const errorName = useErrorName(errorKind)
Expand Down
Loading
Loading