Skip to content

Commit 668938c

Browse files
committed
refactor(mono): update ci failures
1 parent 74df6d7 commit 668938c

File tree

64 files changed

+1240
-922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1240
-922
lines changed

app-shell-odd/src/system-update/from-usb/scan-device.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ import type { FileDetails } from './scan-zip'
77

88
const log = createLogger('system-udpate/from-usb/scan-device')
99

10-
const higherVersion = (a: FileDetails | null, b: FileDetails): FileDetails =>
11-
a == null ? b : Semver.gt(a.version, b.version) ? a : b
10+
const higherVersion = (a: FileDetails | null, b: FileDetails): FileDetails => {
11+
if (a == null) {
12+
return b
13+
}
14+
if (Semver.gt(a.version, b.version)) {
15+
return a
16+
}
17+
return b
18+
}
1219

1320
const mostRecentUpdateOf = (candidates: FileDetails[]): FileDetails | null =>
1421
candidates.reduce<FileDetails | null>(

app/scripts/visualizeReduxConnections.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ assert(process.argv.length === 3, USAGE)
3535
if (m) {
3636
const reduxDep = m[1]
3737
const key = dir.match(new RegExp(`${searchDirPath}([^/]*)/?`))[1]
38-
const value = map[key]
39-
? map[key].includes(reduxDep)
40-
? map[key]
41-
: [...map[key], reduxDep]
42-
: [reduxDep]
38+
const getValue = () => {
39+
if (!map[key]) {
40+
return [reduxDep]
41+
}
42+
if (map[key].includes(reduxDep)) {
43+
return map[key]
44+
}
45+
return [...map[key], reduxDep]
46+
}
47+
const value = getValue()
4348
map = { ...map, [key]: value }
4449
}
4550
}

app/src/atoms/buttons/TouchControlButton.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ const getFocusBorderColor = (
5454
return COLORS.white
5555
}
5656

57+
const getTextColor = (isActive: boolean, isOnDevice: boolean): string => {
58+
if (isActive && !isOnDevice) {
59+
return COLORS.blue50
60+
}
61+
if (isOnDevice && isActive) {
62+
return COLORS.white
63+
}
64+
return COLORS.black90
65+
}
66+
5767
const StyledTouchButton = styled(Btn)<{
5868
isActive: boolean
5969
isOnDevice: boolean
@@ -115,13 +125,7 @@ export function TouchControlButton(props: TouchControlProps): JSX.Element {
115125
<StyledText
116126
oddStyle="bodyTextSemiBold"
117127
desktopStyle="bodyDefaultSemiBold"
118-
color={
119-
isActive && !isOnDevice
120-
? COLORS.blue50
121-
: isOnDevice && isActive
122-
? COLORS.white
123-
: COLORS.black90
124-
}
128+
color={getTextColor(isActive, isOnDevice)}
125129
>
126130
{title}
127131
</StyledText>

app/src/molecules/Command/Command.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,18 @@ export type CommandProps = SkeletonCommandProps | NonSkeletonCommandProps
5050
export function Command(props: CommandProps): JSX.Element {
5151
// This uses the dynamic function variant to work with storybook
5252
const isOnDevice = RESPONSIVENESS.isTouchscreenDynamic()
53-
return props.state === 'loading' ? (
54-
<Skeleton width="100%" height={SKELETON_HEIGHT} backgroundSize="47rem" />
55-
) : props.aligned === 'left' ? (
56-
<LeftAlignedCommand {...props} isOnDevice={isOnDevice} />
57-
) : (
58-
<CenteredCommand {...props} isOnDevice={isOnDevice} />
59-
)
53+
54+
if (props.state === 'loading') {
55+
return (
56+
<Skeleton width="100%" height={SKELETON_HEIGHT} backgroundSize="47rem" />
57+
)
58+
}
59+
60+
if (props.aligned === 'left') {
61+
return <LeftAlignedCommand {...props} isOnDevice={isOnDevice} />
62+
}
63+
64+
return <CenteredCommand {...props} isOnDevice={isOnDevice} />
6065
}
6166

6267
const ICON_SIZE_ODD = SPACING.spacing32

app/src/molecules/DeckInfoLabelTextTag/DeckInfoLabelTextTag.stories.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,15 @@ const Template: Story<DeckInfoLabelTextTagStoryProps> = args => {
4040
<RobotInfoLabel
4141
key={`deck-label-${i}`}
4242
highlight={i === 1}
43-
iconName={
44-
i === 0 ? 'stacked' : i === 1 ? 'ot-heater-shaker' : 'ot-absorbance'
45-
}
43+
iconName={(() => {
44+
if (i === 0) {
45+
return 'stacked'
46+
}
47+
if (i === 1) {
48+
return 'ot-heater-shaker'
49+
}
50+
return 'ot-absorbance'
51+
})()}
4652
/>
4753
)
4854
}

app/src/molecules/GenericWizardTile/index.tsx

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -134,38 +134,37 @@ export function GenericWizardTile(props: GenericWizardTileProps): JSX.Element {
134134
/>
135135
) : null}
136136
{getHelp != null ? <NeedHelpLink href={getHelp} /> : null}
137-
{proceed != null && proceedButton == null ? (
138-
isOnDevice ? (
139-
<>
140-
<SmallButton
141-
disabled={proceedIsDisabled}
142-
buttonText={proceedButtonText}
143-
onClick={proceed}
144-
{...targetProps}
145-
/>
146-
{disableProceedReason != null && (
147-
<Tooltip tooltipProps={tooltipProps}>
148-
{disableProceedReason}
149-
</Tooltip>
150-
)}
151-
</>
152-
) : (
153-
<>
154-
<PrimaryButton
155-
disabled={proceedIsDisabled}
156-
css={CAPITALIZE_FIRST_LETTER_STYLE}
157-
onClick={proceed}
158-
{...targetProps}
159-
>
160-
{proceedButtonText}
161-
</PrimaryButton>
162-
{disableProceedReason != null && (
163-
<Tooltip tooltipProps={tooltipProps}>
164-
{disableProceedReason}
165-
</Tooltip>
166-
)}
167-
</>
168-
)
137+
{proceed != null && proceedButton == null && isOnDevice ? (
138+
<>
139+
<SmallButton
140+
disabled={proceedIsDisabled}
141+
buttonText={proceedButtonText}
142+
onClick={proceed}
143+
{...targetProps}
144+
/>
145+
{disableProceedReason != null && (
146+
<Tooltip tooltipProps={tooltipProps}>
147+
{disableProceedReason}
148+
</Tooltip>
149+
)}
150+
</>
151+
) : null}
152+
{proceed != null && proceedButton == null && !isOnDevice ? (
153+
<>
154+
<PrimaryButton
155+
disabled={proceedIsDisabled}
156+
css={CAPITALIZE_FIRST_LETTER_STYLE}
157+
onClick={proceed}
158+
{...targetProps}
159+
>
160+
{proceedButtonText}
161+
</PrimaryButton>
162+
{disableProceedReason != null && (
163+
<Tooltip tooltipProps={tooltipProps}>
164+
{disableProceedReason}
165+
</Tooltip>
166+
)}
167+
</>
169168
) : null}
170169
{proceed == null && proceedButton != null ? proceedButton : null}
171170
</Flex>

app/src/molecules/MultiDeckLabelTagBtns/MultiDeckLabelTagBtns.stories.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,15 @@ const Template: Story<MultiDeckLabelTagBtnsStoryProps> = args => {
7171
<RobotInfoLabel
7272
key={`deck-label-${i}`}
7373
highlight={i === 1}
74-
iconName={
75-
i === 0 ? 'stacked' : i === 1 ? 'ot-heater-shaker' : 'ot-absorbance'
76-
}
74+
iconName={(() => {
75+
if (i === 0) {
76+
return 'stacked'
77+
}
78+
if (i === 1) {
79+
return 'ot-heater-shaker'
80+
}
81+
return 'ot-absorbance'
82+
})()}
7783
/>
7884
)
7985
}

app/src/molecules/TaskList/index.tsx

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,34 @@ export type * from './types'
2828

2929
const TASK_CONNECTOR_STYLE = `1px solid ${COLORS.grey40}`
3030

31+
const getSubTaskBackgroundColor = (
32+
isTaskListComplete: boolean,
33+
isPastSubTask: boolean,
34+
isSubTaskComplete: boolean | undefined
35+
): string => {
36+
if (isTaskListComplete || isPastSubTask) {
37+
return COLORS.blue50
38+
}
39+
if (isSubTaskComplete === true) {
40+
return COLORS.grey40
41+
}
42+
return 'initial'
43+
}
44+
45+
const getSubTaskConnectorColor = (
46+
isFinalSubTaskOfTaskList: boolean,
47+
isTaskListComplete: boolean,
48+
isPastSubTask: boolean
49+
): string => {
50+
if (isFinalSubTaskOfTaskList) {
51+
return COLORS.transparent
52+
}
53+
if (isTaskListComplete || isPastSubTask) {
54+
return COLORS.blue50
55+
}
56+
return COLORS.grey40
57+
}
58+
3159
interface ProgressTrackerItemProps {
3260
activeIndex: [number, number] | null
3361
subTasks: SubTaskProps[]
@@ -143,14 +171,11 @@ function ProgressTrackerItem({
143171
alignItems={ALIGN_CENTER}
144172
justifyContent={JUSTIFY_CENTER}
145173
// fill in circle for past or completed subtasks
146-
backgroundColor={
147-
// is in the past or list is complete
148-
isTaskListComplete || isPastSubTask
149-
? COLORS.blue50
150-
: subTask.isComplete === true
151-
? COLORS.grey40
152-
: 'initial'
153-
}
174+
backgroundColor={getSubTaskBackgroundColor(
175+
isTaskListComplete,
176+
isPastSubTask,
177+
subTask.isComplete
178+
)}
154179
border={TASK_CONNECTOR_STYLE}
155180
borderColor={isFutureSubTask ? COLORS.grey40 : COLORS.blue50}
156181
borderWidth={SPACING.spacing2}
@@ -164,14 +189,11 @@ function ProgressTrackerItem({
164189
<Flex
165190
flex="1"
166191
borderLeft={TASK_CONNECTOR_STYLE}
167-
borderColor={
168-
// do not show the subtask connector if it's the final subtask of the task list
169-
isFinalSubTaskOfTaskList
170-
? COLORS.transparent
171-
: isTaskListComplete || isPastSubTask
172-
? COLORS.blue50
173-
: COLORS.grey40
174-
}
192+
borderColor={getSubTaskConnectorColor(
193+
isFinalSubTaskOfTaskList,
194+
isTaskListComplete,
195+
isPastSubTask
196+
)}
175197
marginTop={`-${SPACING.spacing8}`}
176198
marginBottom={
177199
// extend connector for last subtask
@@ -431,7 +453,8 @@ function Task({
431453
name={isTaskOpen ? 'chevron-up' : 'chevron-down'}
432454
height="15px"
433455
/>
434-
) : (isTaskListComplete || isPastTask) && cta != null ? (
456+
) : null}
457+
{!hasSubTasks && (isTaskListComplete || isPastTask) && cta != null ? (
435458
<>
436459
<Link
437460
{...targetProps}

app/src/organisms/Desktop/CalibrateDeck/index.tsx

Lines changed: 37 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -156,36 +156,43 @@ export function CalibrateDeck({
156156
/>
157157
}
158158
>
159-
{showSpinner || currentStep == null || Panel == null ? (
160-
<LoadingState />
161-
) : showConfirmExit ? (
162-
<ConfirmExit
163-
exit={confirmExit}
164-
back={cancelExit}
165-
heading={t('progress_will_be_lost', {
166-
sessionType: t('deck_calibration'),
167-
})}
168-
body={t('confirm_exit_before_completion', {
169-
sessionType: t('deck_calibration'),
170-
})}
171-
/>
172-
) : errorInfo != null ? (
173-
<CalibrationError {...errorInfo} onClose={cleanUpAndExit} />
174-
) : (
175-
<Panel
176-
sendCommands={sendCommands}
177-
cleanUpAndExit={cleanUpAndExit}
178-
tipRack={tipRack}
179-
isMulti={isMulti}
180-
mount={instrument?.mount.toLowerCase() as Mount}
181-
currentStep={currentStep}
182-
sessionType={session.sessionType}
183-
supportedCommands={supportedCommands}
184-
defaultTipracks={instrument?.defaultTipracks}
185-
calInvalidationHandler={offsetInvalidationHandler}
186-
allowChangeTipRack
187-
/>
188-
)}
159+
{(() => {
160+
if (showSpinner || currentStep == null || Panel == null) {
161+
return <LoadingState />
162+
}
163+
if (showConfirmExit) {
164+
return (
165+
<ConfirmExit
166+
exit={confirmExit}
167+
back={cancelExit}
168+
heading={t('progress_will_be_lost', {
169+
sessionType: t('deck_calibration'),
170+
})}
171+
body={t('confirm_exit_before_completion', {
172+
sessionType: t('deck_calibration'),
173+
})}
174+
/>
175+
)
176+
}
177+
if (errorInfo != null) {
178+
return <CalibrationError {...errorInfo} onClose={cleanUpAndExit} />
179+
}
180+
return (
181+
<Panel
182+
sendCommands={sendCommands}
183+
cleanUpAndExit={cleanUpAndExit}
184+
tipRack={tipRack}
185+
isMulti={isMulti}
186+
mount={instrument?.mount.toLowerCase() as Mount}
187+
currentStep={currentStep}
188+
sessionType={session.sessionType}
189+
supportedCommands={supportedCommands}
190+
defaultTipracks={instrument?.defaultTipracks}
191+
calInvalidationHandler={offsetInvalidationHandler}
192+
allowChangeTipRack
193+
/>
194+
)
195+
})()}
189196
</ModalShell>,
190197
getTopPortalEl()
191198
)

0 commit comments

Comments
 (0)