Skip to content

Commit 6e407e4

Browse files
authored
fix(protocol-designer): update Heater-shaker to Heater-Shaker (#16966)
* fix(protocol-designer): update Heater-shaker to Heater-Shaker
1 parent 038833c commit 6e407e4

File tree

6 files changed

+27
-7
lines changed

6 files changed

+27
-7
lines changed

protocol-designer/src/assets/localization/en/protocol_steps.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"open": "open"
4545
}
4646
},
47-
"heater_shaker_settings": "Heater-shaker settings",
47+
"heater_shaker_settings": "Heater-Shaker Settings",
4848
"in": "in",
4949
"into": "into",
5050
"magnetic_module": {

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepTools/HeaterShakerTools/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function HeaterShakerTools(props: StepFormProps): JSX.Element {
4141
gridGap={SPACING.spacing4}
4242
paddingX={SPACING.spacing16}
4343
>
44-
<StyledText desktopStyle="bodyDefaultRegular" color={COLORS.grey60}>
44+
<StyledText desktopStyle="bodyDefaultSemiBold">
4545
{t('protocol_steps:heater_shaker_settings')}
4646
</StyledText>
4747
<ToggleExpandStepFormField

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/__tests__/utils.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ describe('capitalizeFirstLetter', () => {
8484
'Move labware to D3 on top of Magnetic Block'
8585
)
8686
})
87+
88+
it('should capitalize the first letter of a step name and leave the rest unchanged', () => {
89+
const moduleName = 'Heater-shaker'
90+
expect(capitalizeFirstLetter(moduleName)).toBe('Heater-Shaker')
91+
})
8792
})
8893

8994
describe('getFormErrorsMappedToField', () => {

protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/utils.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,17 @@ export const getSaveStepSnackbarText = (
337337
}
338338
}
339339

340-
export const capitalizeFirstLetter = (stepName: string): string =>
341-
`${stepName.charAt(0).toUpperCase()}${stepName.slice(1)}`
340+
export const capitalizeFirstLetter = (stepName: string): string => {
341+
// Note - check is for heater-shaker
342+
if (stepName.includes('-')) {
343+
return stepName
344+
.split('-')
345+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
346+
.join('-')
347+
} else {
348+
return `${stepName.charAt(0).toUpperCase()}${stepName.slice(1)}`
349+
}
350+
}
342351

343352
type ErrorMappedToField = Record<string, FormError>
344353

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/__tests__/utils.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { capitalizeFirstLetterAfterNumber } from '../utils'
44
describe('capitalizeFirstLetterAfterNumber', () => {
55
it('should capitalize the first letter of a step type', () => {
66
expect(capitalizeFirstLetterAfterNumber('1. heater-shaker')).toBe(
7-
'1. Heater-shaker'
7+
'1. Heater-Shaker'
88
)
99
expect(capitalizeFirstLetterAfterNumber('22. thermocycler')).toBe(
1010
'22. Thermocycler'

protocol-designer/src/pages/Designer/ProtocolSteps/Timeline/utils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,14 @@ import type { StepIdType } from '../../../../form-types'
55

66
export const capitalizeFirstLetterAfterNumber = (title: string): string =>
77
title.replace(
8-
/(^[\d\W]*)([a-zA-Z])/,
9-
(match, prefix, firstLetter) => `${prefix}${firstLetter.toUpperCase()}`
8+
/(^[\d\W]*)([a-zA-Z])|(-[a-zA-Z])/g,
9+
(match, prefix, firstLetter) => {
10+
if (prefix) {
11+
return `${prefix}${firstLetter.toUpperCase()}`
12+
} else {
13+
return `${match.charAt(0)}${match.charAt(1).toUpperCase()}`
14+
}
15+
}
1016
)
1117

1218
const VOLUME_SIG_DIGITS_DEFAULT = 2

0 commit comments

Comments
 (0)