Skip to content

Commit

Permalink
fix(protocol-designer): perserve uppercase letters of step name
Browse files Browse the repository at this point in the history
fixes RQA-3398
  • Loading branch information
shiyaochen authored and shiyaochen committed Oct 23, 2024
1 parent 1deeb88 commit e36930a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions protocol-designer/src/organisms/RenameStepModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
TYPOGRAPHY,
InputField,
} from '@opentrons/components'
import { i18n } from '../../assets/localization'
import { capitalizeFirstLetter } from '../../pages/Designer/ProtocolSteps/StepForm/utils'
import { getTopPortalEl } from '../../components/portals/TopPortal'
import { renameStep } from '../../labware-ingred/actions'
import type { FormData } from '../../form-types'
Expand All @@ -31,7 +31,7 @@ export function RenameStepModal(props: RenameStepModalProps): JSX.Element {
const { onClose, formData } = props
const dispatch = useDispatch()
const { t } = useTranslation(['form', 'shared', 'protocol_steps'])
const initialName = i18n.format(t(formData.stepName), 'capitalize')
const initialName = capitalizeFirstLetter(t(formData.stepName))

Check failure on line 34 in protocol-designer/src/organisms/RenameStepModal/index.tsx

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `string`

Check failure on line 34 in protocol-designer/src/organisms/RenameStepModal/index.tsx

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `string`
const [stepName, setStepName] = useState<string>(initialName)
const [stepDetails, setStepDetails] = useState<string>(
String(formData.stepDetails)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
TemperatureTools,
ThermocyclerTools,
} from './StepTools'
import { getSaveStepSnackbarText } from './utils'
import { capitalizeFirstLetter, getSaveStepSnackbarText } from './utils'
import type { StepFieldName } from '../../../../steplist/fieldLevel'
import type { FormData, StepType } from '../../../../form-types'
import type { FieldPropsByName, FocusHandlers, StepFormProps } from './types'
Expand Down Expand Up @@ -210,7 +210,7 @@ export function StepFormToolbox(props: StepFormToolboxProps): JSX.Element {
<Flex gridGap={SPACING.spacing8} alignItems={ALIGN_CENTER}>
<Icon size="1rem" name={icon} />
<StyledText desktopStyle="bodyLargeSemiBold">
{i18n.format(t(formData.stepName), 'capitalize')}
{capitalizeFirstLetter(t(formData.stepName))}

Check failure on line 213 in protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepFormToolbox.tsx

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `string`

Check failure on line 213 in protocol-designer/src/pages/Designer/ProtocolSteps/StepForm/StepFormToolbox.tsx

View workflow job for this annotation

GitHub Actions / js checks

Unsafe argument of type `any` assigned to a parameter of type `string`
</StyledText>
</Flex>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,3 +322,6 @@ export const getSaveStepSnackbarText = (
return t(`protocol_steps:save_no_errors`, { stepType: stepTypeDisplayName })
}
}

export const capitalizeFirstLetter = (stepName: string): string =>
stepName.charAt(0).toUpperCase() + stepName.slice(1)

0 comments on commit e36930a

Please sign in to comment.