Skip to content

refactor(components): refactor Helix components #17995

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

Open
wants to merge 12 commits into
base: edge
Choose a base branch
from
71 changes: 0 additions & 71 deletions app/src/atoms/structure/Line.stories.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions app/src/atoms/structure/Line.tsx

This file was deleted.

52 changes: 0 additions & 52 deletions app/src/atoms/structure/__tests__/Line.test.tsx

This file was deleted.

1 change: 0 additions & 1 deletion app/src/atoms/structure/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './Divider'
export * from './Line'
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import {
COLORS,
DIRECTION_COLUMN,
DIRECTION_ROW,
Divider,
Flex,
FLEX_MAX_CONTENT,
Icon,
@@ -23,7 +24,6 @@ import {
parseAllRequiredModuleModels,
} from '@opentrons/shared-data'

import { Line } from '/app/atoms/structure'
import { InfoMessage } from '/app/molecules/InfoMessage'
import { useLPCFlows } from '/app/organisms/LabwarePositionCheck'
import { useIsFlex, useRobot } from '/app/redux-resources/robots'
@@ -399,7 +399,7 @@ export function ProtocolRunSetup({
</SetupStep>
)}
{index !== orderedSteps.length - 1 ? (
<Line marginTop={SPACING.spacing24} />
<Divider marginTop={SPACING.spacing24} marginBottom={0} />
) : null}
</Flex>
)
16 changes: 8 additions & 8 deletions app/src/organisms/Desktop/RobotSettingsCalibration/index.tsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { useDispatch, useSelector } from 'react-redux'

import {
AlertModal,
Divider,
LegacyStyledText,
SPACING,
SpinnerModalPage,
@@ -18,7 +19,6 @@ import {
} from '@opentrons/react-api-client'

import { getTopPortalEl } from '/app/App/portal'
import { Line } from '/app/atoms/structure'
import { useIsFlex, useRobot } from '/app/redux-resources/robots'
import { CONNECTABLE } from '/app/redux/discovery'
import * as RobotApi from '/app/redux/robot-api'
@@ -327,20 +327,20 @@ export function RobotSettingsCalibration({
<CalibrationDataDownload
{...{ robotName, setShowHowCalibrationWorksModal }}
/>
<Line marginTop={SPACING.spacing24} />
<Divider marginTop={SPACING.spacing24} marginBottom={0} />
<RobotSettingsPipetteOffsetCalibration
formattedPipetteOffsetCalibrations={
formattedPipetteOffsetCalibrations
}
robotName={robotName}
updateRobotStatus={updateRobotStatus}
/>
<Line />
<Divider marginY={0} />
<RobotSettingsGripperCalibration
gripper={attachedGripper}
robotName={robotName}
/>
<Line />
<Divider marginY={0} />
<RobotSettingsModuleCalibration
attachedModules={attachedModules}
updateRobotStatus={updateRobotStatus}
@@ -356,30 +356,30 @@ export function RobotSettingsCalibration({
{...{ robotName, setShowHowCalibrationWorksModal }}
/>
<RobotSettingsDeckCalibration robotName={robotName} />
<Line />
<Divider marginY={0} />
<RobotSettingsPipetteOffsetCalibration
formattedPipetteOffsetCalibrations={
formattedPipetteOffsetCalibrations
}
robotName={robotName}
updateRobotStatus={updateRobotStatus}
/>
<Line />
<Divider marginY={0} />
<RobotSettingsTipLengthCalibration
formattedPipetteOffsetCalibrations={
formattedPipetteOffsetCalibrations
}
robotName={robotName}
updateRobotStatus={updateRobotStatus}
/>
<Line />
<Divider marginY={0} />
<CalibrationHealthCheck
buttonDisabledReason={buttonDisabledReason}
dispatchRequests={dispatchRequests}
isPending={isPending}
robotName={robotName}
/>
<Line marginBottom={SPACING.spacing24} />
<Divider marginBottom={SPACING.spacing24} />
<CalibrationDataDownload
robotName={robotName}
setShowHowCalibrationWorksModal={setShowHowCalibrationWorksModal}
4 changes: 2 additions & 2 deletions app/src/pages/Desktop/AppSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -8,13 +8,13 @@ import {
Box,
COLORS,
DIRECTION_ROW,
Divider,
Flex,
LegacyStyledText,
SPACING,
TYPOGRAPHY,
} from '@opentrons/components'

import { Line } from '/app/atoms/structure'
import { NavTab } from '/app/molecules/NavTab'
import { FeatureFlags } from '/app/organisms/Desktop/AppSettings/FeatureFlags'
import * as Config from '/app/redux/config'
@@ -78,7 +78,7 @@ export function AppSettings(): JSX.Element {
)}
</Flex>
</Box>
<Line />
<Divider marginY="0" />
{appSettingsContent}
</Box>
</Flex>
7 changes: 3 additions & 4 deletions app/src/pages/Desktop/Devices/RobotSettings/index.tsx
Original file line number Diff line number Diff line change
@@ -9,15 +9,14 @@ import {
Box,
COLORS,
DIRECTION_COLUMN,
Divider,
Flex,
LegacyStyledText,
SIZE_6,
SPACING,
TYPOGRAPHY,
} from '@opentrons/components'
import { ApiHostProvider } from '@opentrons/react-api-client'

import { Line } from '/app/atoms/structure'
import { NavTab } from '/app/molecules/NavTab'
import { ReachableBanner } from '/app/organisms/Desktop/Devices/ReachableBanner'
import { RobotSettingsAdvanced } from '/app/organisms/Desktop/Devices/RobotSettings/RobotSettingsAdvanced'
@@ -100,7 +99,7 @@ export function RobotSettings(): JSX.Element | null {
)

return (
<Box minWidth={SIZE_6} height="max-content" padding={SPACING.spacing16}>
<Box minWidth="32rem" height="max-content" padding={SPACING.spacing16}>
<Flex
backgroundColor={COLORS.white}
borderRadius={BORDERS.borderRadius8}
@@ -152,7 +151,7 @@ export function RobotSettings(): JSX.Element | null {
) : null}
</Flex>
</Box>
<Line />
<Divider marginY="0" />
<Box padding={`${SPACING.spacing24} ${SPACING.spacing16}`}>
<ApiHostProvider
hostname={robot?.ip ?? null}
97 changes: 53 additions & 44 deletions components/src/atoms/Chip/index.tsx
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
import { RESPONSIVENESS, SPACING, TYPOGRAPHY } from '../../ui-style-constants'
import { LegacyStyledText } from '../StyledText'

import type { FlattenSimpleInterpolation } from 'styled-components'
import type { IconName } from '../../icons'
import type { StyleProps } from '../../primitives'

@@ -92,48 +93,7 @@
const icon = iconName ?? CHIP_PROPS_BY_TYPE[type].iconName ?? 'ot-alert'
const iconColor = CHIP_PROPS_BY_TYPE[type].iconColor

const MEDIUM_CONTAINER_STYLE = css`
padding: ${SPACING.spacing2} ${background === false ? 0 : SPACING.spacing8};
grid-gap: ${SPACING.spacing4};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
padding: ${SPACING.spacing8}
${background === false ? 0 : SPACING.spacing16};
grid-gap: ${SPACING.spacing8};
}
`

const SMALL_CONTAINER_STYLE = css`
padding: ${SPACING.spacing4} ${background === false ? 0 : SPACING.spacing6};
grid-gap: ${SPACING.spacing4};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
padding: ${SPACING.spacing4}
${background === false ? 0 : SPACING.spacing8};
grid-gap: ${SPACING.spacing4};
}
`

const smallSize = iconName === 'connection-status' ? '0.5rem' : '0.75rem'
const ICON_STYLE = css`
width: ${chipSize === 'medium' ? '1rem' : smallSize};
height: ${chipSize === 'medium' ? '1rem' : smallSize};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
width: ${chipSize === 'medium' ? '1.5rem' : '1.25rem'};
height: ${chipSize === 'medium' ? '1.5rem' : '1.25rem'};
}
`

const TEXT_STYLE = css`
${chipSize === 'medium' ? WEB_MEDIUM_TEXT_STYLE : WEB_SMALL_TEXT_STYLE}
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
${chipSize === 'medium'
? TYPOGRAPHY.bodyTextSemiBold
: TYPOGRAPHY.smallBodyTextSemiBold}
}
`

return (
<Flex
@@ -143,7 +103,9 @@
flexDirection={DIRECTION_ROW}
height={FLEX_MAX_CONTENT}
css={
chipSize === 'medium' ? MEDIUM_CONTAINER_STYLE : SMALL_CONTAINER_STYLE
chipSize === 'medium'
? MEDIUM_CONTAINER_STYLE(background)
: SMALL_CONTAINER_STYLE(background)
}
data-testid={`Chip_${type}`}
{...styleProps}
@@ -153,7 +115,7 @@
name={icon}
color={iconColor}
aria-label={`icon_${text}`}
css={ICON_STYLE}
css={ICON_STYLE(chipSize, smallSize)}
>
{pulseIcon ? (
<animate
@@ -168,7 +130,7 @@
</Icon>
) : null}
<LegacyStyledText
css={TEXT_STYLE}
css={TEXT_STYLE(chipSize)}

Check warning on line 133 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L133

Added line #L133 was not covered by tests
color={CHIP_PROPS_BY_TYPE[type].textColor}
>
{text}
@@ -187,3 +149,50 @@
line-height: ${TYPOGRAPHY.lineHeight16};
font-weight: ${TYPOGRAPHY.fontWeightSemiBold};
`

const ICON_STYLE = (
chipSize: ChipSize,
smallSize: string
): FlattenSimpleInterpolation => css`
width: ${chipSize === 'medium' ? '1rem' : smallSize};

Check warning on line 157 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L155-L157

Added lines #L155 - L157 were not covered by tests
height: ${chipSize === 'medium' ? '1rem' : smallSize};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {

Check warning on line 160 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L160

Added line #L160 was not covered by tests
width: ${chipSize === 'medium' ? '1.5rem' : '1.25rem'};
height: ${chipSize === 'medium' ? '1.5rem' : '1.25rem'};
}
`

const TEXT_STYLE = (chipSize: ChipSize): FlattenSimpleInterpolation => css`
${chipSize === 'medium' ? WEB_MEDIUM_TEXT_STYLE : WEB_SMALL_TEXT_STYLE}

Check warning on line 167 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L167

Added line #L167 was not covered by tests
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
${chipSize === 'medium'
? TYPOGRAPHY.bodyTextSemiBold
: TYPOGRAPHY.smallBodyTextSemiBold}

Check warning on line 172 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L172

Added line #L172 was not covered by tests
}
`

const MEDIUM_CONTAINER_STYLE = (
background?: boolean
): FlattenSimpleInterpolation => css`
padding: ${SPACING.spacing2} ${background === false ? 0 : SPACING.spacing8};
grid-gap: ${SPACING.spacing4};

Check warning on line 180 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L178-L180

Added lines #L178 - L180 were not covered by tests
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
padding: ${SPACING.spacing8} ${background === false ? 0 : SPACING.spacing16};
grid-gap: ${SPACING.spacing8};

Check warning on line 184 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L182-L184

Added lines #L182 - L184 were not covered by tests
}
`

const SMALL_CONTAINER_STYLE = (
background?: boolean
): FlattenSimpleInterpolation => css`
padding: ${SPACING.spacing4} ${background === false ? 0 : SPACING.spacing6};
grid-gap: ${SPACING.spacing4};

Check warning on line 192 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L189-L192

Added lines #L189 - L192 were not covered by tests
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
padding: ${SPACING.spacing4} ${background === false ? 0 : SPACING.spacing8};
grid-gap: ${SPACING.spacing4};

Check warning on line 196 in components/src/atoms/Chip/index.tsx

Codecov / codecov/patch

components/src/atoms/Chip/index.tsx#L194-L196

Added lines #L194 - L196 were not covered by tests
}
`
93 changes: 54 additions & 39 deletions components/src/atoms/ListButton/index.tsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import { Flex } from '../../primitives'
import { CURSOR_DEFAULT, CURSOR_POINTER } from '../../styles'
import { RESPONSIVENESS, SPACING } from '../../ui-style-constants'

import type { FlattenSimpleInterpolation } from 'styled-components'
import type { ReactNode } from 'react'
import type { StyleProps } from '../../primitives'

@@ -13,14 +14,19 @@ export * from './ListButtonChildren/index'
type ListButtonType = 'noActive' | 'connected' | 'notConnected' | 'onColor'

interface ListButtonProps extends StyleProps {
/** ListButton type */
type: ListButtonType
/** ListButton content */
children: ReactNode
/** ListButton disabled state */
disabled?: boolean
/** ListButton onClick event */
onClick?: () => void
/** optional data-testid value for Cypress testing */
testId?: string
}

const DESKTOP_LISTBUTTON_PROPS_BY_TYPE: Record<
const DESKTOP_LIST_BUTTON_PROPS_BY_TYPE: Record<
ListButtonType,
{ backgroundColor: string; hoverBackgroundColor: string }
> = {
@@ -42,7 +48,7 @@ const DESKTOP_LISTBUTTON_PROPS_BY_TYPE: Record<
},
}

const ODD_LISTBUTTON_PROPS_BY_TYPE: Record<
const ODD_LIST_BUTTON_PROPS_BY_TYPE: Record<
ListButtonType,
{ backgroundColor: string; hoverBackgroundColor: string }
> = {
@@ -75,44 +81,11 @@ export function ListButton(props: ListButtonProps): JSX.Element {
children,
disabled = false,
onClick,
testId, // optional data-testid value for Cypress testing
testId,
...styleProps
} = props
const desktopListButtonProps = DESKTOP_LISTBUTTON_PROPS_BY_TYPE[type]
const oddListButtonProps = ODD_LISTBUTTON_PROPS_BY_TYPE[type]

const LIST_BUTTON_STYLE = css`
cursor: ${disabled ? CURSOR_DEFAULT : CURSOR_POINTER};
background-color: ${disabled
? COLORS.grey20
: desktopListButtonProps.backgroundColor};
padding: ${styleProps.padding ??
`${SPACING.spacing20} ${SPACING.spacing24}`};
border-radius: ${BORDERS.borderRadius8};
&:hover {
background-color: ${disabled
? COLORS.grey20
: desktopListButtonProps.hoverBackgroundColor};
}
&:focus-visible {
outline: 2px solid ${COLORS.blue50};
outline-offset: 0.125rem;
}
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
background-color: ${disabled
? COLORS.grey35
: oddListButtonProps.backgroundColor};
&:hover {
background-color: ${disabled
? COLORS.grey35
: oddListButtonProps.hoverBackgroundColor};
}
}
`
const desktopListButtonProps = DESKTOP_LIST_BUTTON_PROPS_BY_TYPE[type]
const oddListButtonProps = ODD_LIST_BUTTON_PROPS_BY_TYPE[type]

return (
<Flex
@@ -121,7 +94,12 @@ export function ListButton(props: ListButtonProps): JSX.Element {
onClick?.()
e.stopPropagation()
}}
css={LIST_BUTTON_STYLE}
css={LIST_BUTTON_STYLE(
disabled,
styleProps,
desktopListButtonProps,
oddListButtonProps
)}
tabIndex={0}
max-width="26.875rem"
{...styleProps}
@@ -130,3 +108,40 @@ export function ListButton(props: ListButtonProps): JSX.Element {
</Flex>
)
}

const LIST_BUTTON_STYLE = (
disabled: boolean,
styleProps: StyleProps,
desktopListButtonProps: Record<string, string>,
oddListButtonProps: Record<string, string>
): FlattenSimpleInterpolation => css`
cursor: ${disabled ? CURSOR_DEFAULT : CURSOR_POINTER};
background-color: ${disabled
? COLORS.grey20
: desktopListButtonProps.backgroundColor};
padding: ${styleProps.padding ?? `${SPACING.spacing20} ${SPACING.spacing24}`};
border-radius: ${BORDERS.borderRadius8};
&:hover {
background-color: ${disabled
? COLORS.grey20
: desktopListButtonProps.hoverBackgroundColor};
}
&:focus-visible {
outline: 2px solid ${COLORS.blue50};
outline-offset: 0.125rem;
}
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
background-color: ${disabled
? COLORS.grey35
: oddListButtonProps.backgroundColor};
&:hover {
background-color: ${disabled
? COLORS.grey35
: oddListButtonProps.hoverBackgroundColor};
}
}
`
Original file line number Diff line number Diff line change
@@ -66,21 +66,19 @@ export function ListItemCustomize(props: ListItemCustomizeProps): JSX.Element {
{tag != null ? <Tag {...tag} /> : null}
</Flex>
{onClick != null && linkText != null ? (
<Link
role="button"
onClick={onClick}
css={css`
width: 10%;
text-decoration: ${TYPOGRAPHY.textDecorationUnderline};
color: ${COLORS.grey60};
&:hover {
color: ${COLORS.grey40};
}
`}
>
<Link role="button" onClick={onClick} css={LINK_STYLE}>
<StyledText desktopStyle="bodyDefaultRegular">{linkText}</StyledText>
</Link>
) : null}
</Flex>
)
}

const LINK_STYLE = css`
width: 10%;
text-decoration: ${TYPOGRAPHY.textDecorationUnderline};
color: ${COLORS.grey60};
&:hover {
color: ${COLORS.grey40};
}
`
Original file line number Diff line number Diff line change
@@ -9,9 +9,13 @@ import {
import { SPACING } from '../../../ui-style-constants'

interface ListItemDescriptorProps {
/** ListItemDescriptor size type */
type: 'default' | 'large'
/** ListItemDescriptor description */
description: JSX.Element
/** ListItemDescriptor content */
content: JSX.Element
/** ListItemDescriptor flex direction */
changeFlexDirection?: boolean
}

45 changes: 45 additions & 0 deletions components/src/atoms/StepMeter/__tests__/StepMeter.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { screen } from '@testing-library/react'
import { beforeEach, describe, expect, it } from 'vitest'

import { StepMeter } from '../'
import { COLORS } from '../../../helix-design-system'
import { renderWithProviders } from '../../../testing/utils'

import type { ComponentProps } from 'react'

const renderer = (props: ComponentProps<typeof StepMeter>) => {
return renderWithProviders(<StepMeter {...props} />)
}

describe('StepMeter', () => {
let props: ComponentProps<typeof StepMeter>

beforeEach(() => {
props = {
totalSteps: 10,
currentStep: 5,
}
})

it('should render StepMeterContainer', () => {
renderer(props)

const stepMeterContainer = screen.getByTestId(
'StepMeter_StepMeterContainer'
)
expect(stepMeterContainer).toHaveStyle({
height: '0.25rem',
backgroundColor: COLORS.grey30,
})
})
it('should render StepMeterBar 50%', () => {
renderer(props)

const stepMeterBar = screen.getByTestId('StepMeter_StepMeterBar')
expect(stepMeterBar).toHaveStyle({
width: '50%',
height: '100%',
backgroundColor: COLORS.blue50,
})
})
})
52 changes: 30 additions & 22 deletions components/src/atoms/StepMeter/index.tsx
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@
import { POSITION_ABSOLUTE, POSITION_RELATIVE } from '../../styles'
import { RESPONSIVENESS, SPACING } from '../../ui-style-constants'

import type { FlattenSimpleInterpolation } from 'styled-components'
import type { StyleProps } from '../../primitives'

interface StepMeterProps extends StyleProps {
@@ -22,33 +23,40 @@
: (progress / totalSteps) * 100
}%`

const StepMeterContainer = css`
position: ${styleProps.position ? styleProps.position : POSITION_RELATIVE};
height: ${SPACING.spacing4};
background-color: ${COLORS.grey30};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
height: ${SPACING.spacing12};
}
`
const StepMeterBar = css`
position: ${POSITION_ABSOLUTE};
top: 0;
height: 100%;
background-color: ${COLORS.blue50};
width: ${percentComplete};
webkit-transition: width 0.5s ease-in-out;
moz-transition: width 0.5s ease-in-out;
o-transition: width 0.5s ease-in-out;
transition: width 0.5s ease-in-out;
`

return (
<Box
data-testid="StepMeter_StepMeterContainer"
css={StepMeterContainer}
css={StepMeterContainer(styleProps)}

Check warning on line 29 in components/src/atoms/StepMeter/index.tsx

Codecov / codecov/patch

components/src/atoms/StepMeter/index.tsx#L29

Added line #L29 was not covered by tests
{...styleProps}
>
<Box data-testid="StepMeter_StepMeterBar" css={StepMeterBar} />
<Box
data-testid="StepMeter_StepMeterBar"
css={StepMeterBar(percentComplete)}
/>

Check warning on line 35 in components/src/atoms/StepMeter/index.tsx

Codecov / codecov/patch

components/src/atoms/StepMeter/index.tsx#L32-L35

Added lines #L32 - L35 were not covered by tests
</Box>
)
}

const StepMeterContainer = (
styleProps: StyleProps
): FlattenSimpleInterpolation => css`
position: ${styleProps.position ? styleProps.position : POSITION_RELATIVE};
height: ${SPACING.spacing4};
background-color: ${COLORS.grey30};
@media ${RESPONSIVENESS.touchscreenMediaQuerySpecs} {
height: ${SPACING.spacing12};

Check warning on line 47 in components/src/atoms/StepMeter/index.tsx

Codecov / codecov/patch

components/src/atoms/StepMeter/index.tsx#L41-L47

Added lines #L41 - L47 were not covered by tests
}
`
const StepMeterBar = (
percentComplete: string
): FlattenSimpleInterpolation => css`
position: ${POSITION_ABSOLUTE};

Check warning on line 53 in components/src/atoms/StepMeter/index.tsx

Codecov / codecov/patch

components/src/atoms/StepMeter/index.tsx#L51-L53

Added lines #L51 - L53 were not covered by tests
top: 0;
height: 100%;
background-color: ${COLORS.blue50};
width: ${percentComplete};

Check warning on line 57 in components/src/atoms/StepMeter/index.tsx

Codecov / codecov/patch

components/src/atoms/StepMeter/index.tsx#L55-L57

Added lines #L55 - L57 were not covered by tests
webkit-transition: width 0.5s ease-in-out;
moz-transition: width 0.5s ease-in-out;
o-transition: width 0.5s ease-in-out;
transition: width 0.5s ease-in-out;
`

Unchanged files with check annotations Beta

const handleError = (problem: Error): void => {
// if we error out, delete the temp dir to clean up
log.error(`Aborting fetchToFile: ${problem.name}: ${problem.message}`)
remove(destination).then(() => {

Check warning on line 102 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 102 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
reject(error)
})
}
source: string
): Promise<Response> {
return new Promise<Response>((resolve, reject) => {
createReadStream(source, reject).then(readStream =>

Check warning on line 131 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 131 in app-shell-odd/src/http.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
new Promise<Response>(resolve => {
const body = new FormData()
body.append(name, readStream)
dns.setDefaultResultOrder('ipv4first')
setUserDataPath()
systemd.sendStatus('starting app')

Check warning on line 43 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 43 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
const config = getConfig()
const log = createLogger('main')
overrides: getOverrides(),
})
systemd.setRemoteDevToolsEnabled(config.devtools)

Check warning on line 53 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 53 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
// hold on to references so they don't get garbage collected
let mainWindow: BrowserWindow | null | undefined
path.join(app.getPath('userData'), `_CONFIG_TO_BE_DELETED_ON_REBOOT`)
)
}
systemd.sendStatus('loading app')

Check warning on line 99 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 99 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
process.on('uncaughtException', error => log.error('Uncaught: ', { error }))
process.on('unhandledRejection', reason =>
log.error('Uncaught Promise rejection: ', { reason })
ipcMain.once('dispatch', () => {
log.info('First dispatch, showing')
systemd.sendStatus('started')

Check warning on line 158 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 158 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
systemd.ready()

Check warning on line 159 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator

Check warning on line 159 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator
try {
const stopWatching = watchForMassStorage(dispatch)
ipcMain.once('quit', stopWatching)
}
// TODO: This is where we render the main window for the first time. See ui.ts
// in the createUI function for more.
if (!!!mainWindow) {

Check warning on line 175 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Unexpected nullable object value in conditional. An explicit null check is required

Check warning on line 175 in app-shell-odd/src/main.ts

GitHub Actions / js checks

Unexpected nullable object value in conditional. An explicit null check is required
log.error('mainWindow went away before show')
} else {
waitForRobotServerAndShowMainWindow(dispatch, mainWindow)
resolve(client)
},
// A connection error event will close the connection without a retry.
error: (error: Error | string) => {

Check warning on line 40 in app-shell-odd/src/notifications/connect.ts

GitHub Actions / js checks

Promise-returning function provided to property where a void return was expected

Check warning on line 40 in app-shell-odd/src/notifications/connect.ts

GitHub Actions / js checks

Promise-returning function provided to property where a void return was expected
removePromiseListeners()
const clientEndPromise = new Promise((resolve, reject) =>
client.end(true, {}, () => {
}
export function establishListeners(): void {
const client = connectionStore.client as mqtt.MqttClient

Check warning on line 69 in app-shell-odd/src/notifications/connect.ts

GitHub Actions / js checks

Use a ! assertion to more succinctly remove null and undefined from the type

Check warning on line 69 in app-shell-odd/src/notifications/connect.ts

GitHub Actions / js checks

Use a ! assertion to more succinctly remove null and undefined from the type
const { ip, robotName } = connectionStore
client.on(