Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
fbelginetw committed Nov 13, 2024
1 parent 2159158 commit 0d9e701
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"opentrons_ot2_label": "Opentrons OT-2",
"opentrons_ot2": "Opentrons OT-2",
"instruments_pipettes_title": "What pipettes would you like to use?",
"two_pipettes_label": "Two pipettes",
"two_pipettes_label": "1-Channel or 8-Channel pipettes",
"right_pipette_label": "Right mount",
"left_pipette_label": "Left mount",
"choose_pipette_placeholder": "Choose pipette",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,13 @@ export function ControlledAddTextAreaFields({
<Link
role="button"
onClick={() => {
field.onChange(values.filter((_, i) => i !== index))
const newValues = values
.filter((_, i) => i !== index)
.map(
(value, i) =>
`${t(name)} ${i + 1}: ${value.split(': ')[1]}`
)
field.onChange(newValues)
}}
css={css`
justify-content: flex-end;
Expand Down
5 changes: 4 additions & 1 deletion opentrons-ai-client/src/molecules/ExitConfirmModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export function ExitConfirmModal(): JSX.Element {
return (
<Modal type="info" title={t('exit_confirmation_title')} marginLeft="0">
<Flex flexDirection={DIRECTION_COLUMN}>
<StyledText padding={`${SPACING.spacing24} 0`}>
<StyledText
paddingTop={`${SPACING.spacing8}`}
paddingBottom={`${SPACING.spacing24}`}
>
{t('exit_confirmation_body')}
</StyledText>
<Flex justifyContent={JUSTIFY_FLEX_END} gap={SPACING.spacing8}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ describe('ApplicationSection', () => {
})
})

it('should enable confirm button when all fields are filled', async () => {
it('should update the form state to valid when all fields are filled', async () => {
render()

await waitFor(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
getAllPipetteNames,
getPipetteSpecsV2,
OT2_PIPETTES,
OT2_ROBOT_TYPE,
OT3_PIPETTES,
} from '@opentrons/shared-data'

Expand Down Expand Up @@ -81,7 +80,7 @@ export function InstrumentsSection(): JSX.Element | null {
const pipetteOptions = useMemo(() => {
const allPipetteOptions = getAllPipetteNames('maxVolume', 'channels')
.filter(name =>
(robotType === OT2_ROBOT_TYPE ? OT2_PIPETTES : OT3_PIPETTES).includes(
(robotType === OPENTRONS_OT2 ? OT2_PIPETTES : OT3_PIPETTES).includes(
name
)
)
Expand Down
16 changes: 12 additions & 4 deletions opentrons-ai-client/src/organisms/LabwareModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,18 @@ export function LabwareModal({
setValue(
LABWARES_FIELD_NAME,
[
...selectedLabwares.map(labwareURI => ({
labwareURI,
count: 1,
})),
...selectedLabwares.map(labwareURI => {
const existingLabware = labwares.find(
lw => lw.labwareURI === labwareURI
)
return {
labwareURI,
count:
existingLabware != null
? existingLabware.count
: 1,
}
}),
],
{ shouldValidate: true }
)
Expand Down
11 changes: 4 additions & 7 deletions opentrons-ai-client/src/organisms/UpdateProtocol/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
DIRECTION_COLUMN,
DIRECTION_ROW,
Flex,
InputField,
JUSTIFY_CENTER,
JUSTIFY_END,
LargeButton,
Expand All @@ -28,6 +27,7 @@ import {
import { CSSTransition } from 'react-transition-group'
import { useAtom } from 'jotai'
import { useTrackEvent } from '../../resources/hooks/useTrackEvent'
import { TextAreaField } from '../../atoms/TextAreaField'

interface UpdateOptionsDropdown extends DropdownOption {
value: UpdateOptions
Expand Down Expand Up @@ -156,7 +156,7 @@ export function UpdateProtocol(): JSX.Element {
setHeaderWithMeterAtom,
])

const handleInputChange = (event: ChangeEvent<HTMLInputElement>): void => {
const handleInputChange = (event: ChangeEvent<HTMLTextAreaElement>): void => {
setDetailsValue(event.target.value)
}

Expand All @@ -171,7 +171,6 @@ export function UpdateProtocol(): JSX.Element {

if (typeof text === 'string' && text !== '') {
setErrorText(null)
console.log('File read successfully:\n', text)
setPythonTextValue(text)
} else {
setErrorText(t('file_length_error'))
Expand All @@ -194,8 +193,6 @@ export function UpdateProtocol(): JSX.Element {

const chatPrompt = `${introText}${originalCodeText}${updateTypeText}${detailsText}`

console.log(chatPrompt)

setUpdatePromptAtom({
prompt: chatPrompt,
protocol_text: pythonText,
Expand Down Expand Up @@ -310,10 +307,10 @@ export function UpdateProtocol(): JSX.Element {
/>
</Flex>
<BodyText>{t('provide_details_of_changes')}</BodyText>
<InputField
<TextAreaField
value={detailsValue}
onChange={handleInputChange}
size="medium"
height="160px"
/>
<Flex
paddingTop="40px"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export function generatePromptPreviewLabwareLiquidsItems(
const defs = getAllDefinitions()

labwares?.forEach(labware => {
items.push(getLabwareDisplayName(defs[labware.labwareURI]) as string)
items.push(
`${labware.count} x ${
getLabwareDisplayName(defs[labware.labwareURI]) as string
}`
)
})

liquids?.forEach(liquid => {
Expand Down

0 comments on commit 0d9e701

Please sign in to comment.