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 17 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
46 changes: 26 additions & 20 deletions app/src/atoms/buttons/RadioButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,29 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
const isLarge = radioButtonType === 'large'

const SettingButton = styled.input`
display: none;
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
display: none;
}
`

const AVAILABLE_BUTTON_STYLE = css`
background: ${COLORS.blue35};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
background: ${COLORS.blue35};

&:active {
background-color: ${COLORS.blue40};
&:active {
background-color: ${COLORS.blue40};
}
}
`

const SELECTED_BUTTON_STYLE = css`
background: ${COLORS.blue50};
color: ${COLORS.white};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
background: ${COLORS.blue50};
color: ${COLORS.white};

&:active {
background-color: ${COLORS.blue60};
&:active {
background-color: ${COLORS.blue60};
}
}
`

Expand All @@ -65,16 +71,19 @@ 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%;
padding: ${SPACING.spacing4};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
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 @@ -90,11 +99,8 @@ export function RadioButton(props: RadioButtonProps): JSX.Element {
/>
<SettingButtonLabel role="label" htmlFor={buttonLabel}>
<LegacyStyledText
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this has to be a StyledText, not a LegacyStyledText. StyledText is the one that supports oddStyle and desktopStyle, while LegacyStyledText - which we don't want to use anymore - supports as

fontSize={isLarge ? TYPOGRAPHY.fontSize28 : TYPOGRAPHY.fontSize22}
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
lineHeight={
isLarge ? TYPOGRAPHY.lineHeight36 : TYPOGRAPHY.lineHeight28
}
oddStyle={isLarge ? 'level4HeaderRegular' : 'bodyTextRegular'}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
desktopStyle="bodyDefaultRegular"
>
{buttonLabel}
</LegacyStyledText>
Expand Down
13 changes: 11 additions & 2 deletions app/src/atoms/buttons/SmallButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as React from 'react'
import { useSelector } from 'react-redux'

TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
import { css } from 'styled-components'
import {
ALIGN_CENTER,
Expand All @@ -15,6 +17,7 @@ import {
} from '@opentrons/components'
import { ODD_FOCUS_VISIBLE } from './constants'
import type { IconName, StyleProps } from '@opentrons/components'
import { getIsOnDevice } from '../../redux/config'

export type SmallButtonTypes =
| 'alert'
Expand Down Expand Up @@ -50,6 +53,8 @@ export function SmallButton(props: SmallButtonProps): JSX.Element {
...buttonProps
} = props

const isOnDevice = useSelector(getIsOnDevice)

const SMALL_BUTTON_PROPS_BY_TYPE: Record<
SmallButtonTypes,
{
Expand Down Expand Up @@ -148,6 +153,8 @@ export function SmallButton(props: SmallButtonProps): JSX.Element {
}
`

const TEXT_SIZE = isOnDevice ? '1.375rem' : '0.875rem'
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved

return (
<Btn
css={SMALL_BUTTON_STYLE}
Expand Down Expand Up @@ -181,8 +188,10 @@ export function SmallButton(props: SmallButtonProps): JSX.Element {
) : null}

<LegacyStyledText
fontSize="1.375rem"
lineHeight={TYPOGRAPHY.lineHeight28}
fontSize={TEXT_SIZE}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
lineHeight={
isOnDevice ? TYPOGRAPHY.lineHeight28 : TYPOGRAPHY.lineHeight20
}
fontWeight={TYPOGRAPHY.fontWeightSemiBold}
>
{buttonText}
Expand Down
21 changes: 17 additions & 4 deletions app/src/molecules/InterventionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export function InterventionModal({
const isOnDevice = useSelector(getIsOnDevice)
const modalStyle = isOnDevice ? MODAL_ODD_STYLE : MODAL_DESKTOP_STYLE
const headerStyle = isOnDevice ? BASE_HEADER_STYLE : DESKTOP_HEADER_STYLE
const titleSpacing = isOnDevice ? SPACING.spacing12 : SPACING.spacing4

return (
<Flex {...WRAPPER_STYLE}>
Expand All @@ -154,14 +155,26 @@ export function InterventionModal({
{...headerStyle}
backgroundColor={headerColor}
justifyContent={headerJustifyContent}
onClick={iconHeadingOnClick}
>
{titleHeading}
<Flex alignItems={ALIGN_CENTER} gridGap={SPACING.spacing12}>
<Flex
alignItems={ALIGN_CENTER}
gridGap={titleSpacing}
onClick={iconHeadingOnClick}
>
{iconName != null ? (
<Icon name={iconName} size={SPACING.spacing32} />
isOnDevice ? (
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
<Icon name={iconName} size={SPACING.spacing32} />
) : (
<Icon
width={16}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
height={16}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
name={iconName}
size={SPACING.spacing32}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
/>
)
) : null}
{iconHeading != null ? iconHeading : null}
{iconHeading ?? null}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
</Flex>
</Flex>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export function ErrorRecoveryComponent(
const titleText = props.hasLaunchedRecovery
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
? t('recovery_mode')
: t('cancel_run')
return <LegacyStyledText as="h4Bold">{titleText}</LegacyStyledText>
// change this to default typography
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
return <LegacyStyledText as={'h4Bold'}>{titleText}</LegacyStyledText>
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
}

const buildIconHeading = (): JSX.Element => (
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 @@ -9,10 +10,12 @@ import {
Icon,
SPACING,
LegacyStyledText,
RESPONSIVENESS,
} from '@opentrons/components'

import { RECOVERY_MAP } from '../constants'
import { RecoveryFooterButtons, RecoveryContentWrapper } from '../shared'

import { SelectRecoveryOption } from './SelectRecoveryOption'

import type { RecoveryContentProps } from '../types'
Expand Down Expand Up @@ -65,11 +68,11 @@ 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}
/>
Expand Down Expand Up @@ -140,3 +143,19 @@ export function useOnCancelRun({

return { showBtnLoadingState, handleCancelRunClick }
}

const FLEX_WIDTH = css`
width: 666px;
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
@media (${RESPONSIVENESS.touchscreenMediaQuerySpecs}) {
width: 848px;
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
}
`

const ICON_SIZE = css`
width: 2.5rem;
height: 2.5rem;
@media (${RESPONSIVENESS.touchscreenMediaQuerySpecs}) {
width: 3.75rem;
height: 3.75rem;
}
`
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function ErrorDetailsModal(
if (props.isOnDevice) {
return <ErrorDetailsModalODD {...props} />
} else {
return null
return <ErrorDetailsModalDesktop {...props} />
}
}

Expand Down Expand Up @@ -102,6 +102,53 @@ export function ErrorDetailsModalODD(
)
}

export function ErrorDetailsModalDesktop(
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
props: ErrorDetailsModalProps
): JSX.Element {
const { failedCommand, toggleModal, isOnDevice } = props
const errorKind = getErrorKind(failedCommand)
const errorName = useErrorName(errorKind)

const getIsOverpressureErrorKind = (): boolean => {
switch (errorKind) {
case ERROR_KINDS.OVERPRESSURE_PREPARE_TO_ASPIRATE:
case ERROR_KINDS.OVERPRESSURE_WHILE_ASPIRATING:
case ERROR_KINDS.OVERPRESSURE_WHILE_DISPENSING:
return true
default:
return false
}
}

const modalHeader: ModalHeaderBaseProps = {
title: errorName,
hasExitIcon: true,
}

return createPortal(
<Modal
header={modalHeader}
onOutsideClick={toggleModal}
// gridGap={SPACING.spacing32}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
>
<Flex gridGap={SPACING.spacing24} flexDirection={DIRECTION_COLUMN}>
{getIsOverpressureErrorKind() ? (
<OverpressureBanner isOnDevice={isOnDevice} />
) : null}
<Flex
gridGap={SPACING.spacing16}
backgroundColor={COLORS.grey35}
borderRadius={BORDERS.borderRadius8}
padding={`${SPACING.spacing16} ${SPACING.spacing20}`}
>
<StepInfo {...props} textStyle="label" />
</Flex>
</Flex>
</Modal>,
getTopPortalEl()
)
}

export function OverpressureBanner(props: {
isOnDevice: boolean
}): JSX.Element | null {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,23 @@ export function RecoveryContentWrapper({
)
}

export function RecoverySingleColumnContentDesktop({
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
children,
...styleProps
}: SingleColumnContentWrapperProps): JSX.Element {
return (
<Flex
padding={SPACING.spacing32}
gridGap={SPACING.spacing24}
flexDirection={DIRECTION_COLUMN}
justifyContent={JUSTIFY_SPACE_BETWEEN}
{...styleProps}
>
{children}
</Flex>
)
}

const STYLE = css`
gap: ${SPACING.spacing24};
width: 100%;
Expand Down
22 changes: 19 additions & 3 deletions components/src/atoms/StyledText/LegacyStyledText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const styleMap: { [tag: string]: FlattenSimpleInterpolation } = {
}
`,
h4: css`
${TYPOGRAPHY.level4DesktopHeaderRegular}
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
${TYPOGRAPHY.level4HeaderRegular};
}
Expand Down Expand Up @@ -58,7 +59,12 @@ const styleMap: { [tag: string]: FlattenSimpleInterpolation } = {
${TYPOGRAPHY.level3HeaderSemiBold}
}
`,
h4SemiBold: TYPOGRAPHY.level4HeaderSemiBold,
h4SemiBold: css`
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
${TYPOGRAPHY.level4HeaderDesktopSemiBold}
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
${TYPOGRAPHY.level4HeaderSemiBold},
}
`,
h6SemiBold: TYPOGRAPHY.h6SemiBold,
pSemiBold: css`
${TYPOGRAPHY.pSemiBold}
Expand All @@ -74,8 +80,18 @@ const styleMap: { [tag: string]: FlattenSimpleInterpolation } = {
}
`,
h2Bold: TYPOGRAPHY.level2HeaderBold,
h3Bold: TYPOGRAPHY.level3HeaderBold,
h4Bold: TYPOGRAPHY.level4HeaderBold,
h3Bold: css`
${TYPOGRAPHY.levelDesktop3HeaderBold}
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
${TYPOGRAPHY.level3HeaderBold}
}
`,
h4Bold: css`
${TYPOGRAPHY.level4DesketopHeaderBold}
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
TamarZanzouri marked this conversation as resolved.
Show resolved Hide resolved
${TYPOGRAPHY.level4HeaderBold}
}
`,
pBold: TYPOGRAPHY.bodyTextBold,
labelBold: TYPOGRAPHY.smallBodyTextBold,
}
Expand Down
Loading
Loading