Skip to content

Commit 601929f

Browse files
committed
feat(app): add the same to the odd
1 parent 6b55bd4 commit 601929f

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

app/src/organisms/ODD/CameraSettings/index.tsx

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next'
33

44
import { InlineNotification, StyledText } from '@opentrons/components'
55

6+
import { useToaster } from '/app/organisms/ToasterOven'
67
import {
78
SOURCE_ROBOT_SETTINGS,
89
useCameraAnalytics,
@@ -17,8 +18,11 @@ import styles from './preferences.module.css'
1718
import { UsagePreferencesSettings } from './UsagePreferencesSettings'
1819

1920
import type { ReactNode } from 'react'
21+
import type { Protocol } from '@opentrons/api-client'
2022
import type { RobotStorageInfo } from '/app/resources/health/useIsImageStorageLow'
2123

24+
const TOAST_DURATION_MS = 3000
25+
2226
export interface CameraSettingsProps {
2327
/* A header element for the page content. */
2428
headerElement: ReactNode
@@ -34,6 +38,7 @@ export interface CameraSettingsProps {
3438
not general settings context. */
3539
storageInfo: RobotStorageInfo | null
3640
isCameraRequired: boolean | null
41+
protocolRecord: Protocol | null
3742
}
3843

3944
export function CameraSettings({
@@ -48,8 +53,12 @@ export function CameraSettings({
4853
toggleLiveStreamEnabled,
4954
isRecoveryCaptureEnabled,
5055
isLiveVideoEnabled,
56+
protocolRecord,
5157
}: CameraSettingsProps): JSX.Element {
58+
const { t } = useTranslation('protocol_setup')
5259
const isCameraSettingsEnabled = useFeatureFlag('camera')
60+
const isQuickTransfer = protocolRecord?.data.protocolKind === 'quick-transfer'
61+
const { makeSnackbar } = useToaster()
5362
const [showControls, setShowControls] = useState(false)
5463
const toggleShowControls = (): void => {
5564
setShowControls(!showControls)
@@ -59,14 +68,17 @@ export function CameraSettings({
5968
robotType: robotType,
6069
source: SOURCE_ROBOT_SETTINGS,
6170
})
71+
const recoveryEnabledByRunType = isQuickTransfer
72+
? false
73+
: isRecoveryCaptureEnabled
6274

6375
const handleToggleCamera = (): void => {
6476
toggleCameraEnabled()
6577
if (isCameraRequired === null) {
6678
reportCameraEnablementSettings({
6779
cameraEnabled: !isCameraEnabled,
6880
liveFeedEnabled: isLiveVideoEnabled,
69-
recoveryCaptureEnabled: isRecoveryCaptureEnabled,
81+
recoveryCaptureEnabled: recoveryEnabledByRunType,
7082
})
7183
}
7284
}
@@ -76,19 +88,26 @@ export function CameraSettings({
7688
reportCameraEnablementSettings({
7789
cameraEnabled: isCameraEnabled,
7890
liveFeedEnabled: !isLiveVideoEnabled,
79-
recoveryCaptureEnabled: isRecoveryCaptureEnabled,
91+
recoveryCaptureEnabled: recoveryEnabledByRunType,
8092
})
8193
}
8294
}
8395

8496
const handleToggleRecovery = (): void => {
85-
toggleRecoveryEnabled()
86-
if (isCameraRequired === null) {
87-
reportCameraEnablementSettings({
88-
cameraEnabled: isCameraEnabled,
89-
liveFeedEnabled: isLiveVideoEnabled,
90-
recoveryCaptureEnabled: !isRecoveryCaptureEnabled,
91-
})
97+
if (isQuickTransfer) {
98+
makeSnackbar(
99+
t('no_camera_during_quick_transfer') as string,
100+
TOAST_DURATION_MS
101+
)
102+
} else {
103+
toggleRecoveryEnabled()
104+
if (isCameraRequired === null) {
105+
reportCameraEnablementSettings({
106+
cameraEnabled: isCameraEnabled,
107+
liveFeedEnabled: isLiveVideoEnabled,
108+
recoveryCaptureEnabled: !isRecoveryCaptureEnabled,
109+
})
110+
}
92111
}
93112
}
94113
if (showControls) {
@@ -123,7 +142,7 @@ export function CameraSettings({
123142
toggleLiveVideoEnabled={handleToggleLiveStream}
124143
toggleRecoveryCaptureEnabled={handleToggleRecovery}
125144
isLiveVideoEnabled={isLiveVideoEnabled}
126-
isRecoveryCaptureEnabled={isRecoveryCaptureEnabled}
145+
isRecoveryCaptureEnabled={recoveryEnabledByRunType}
127146
robotName={robotName}
128147
/>
129148
{isCameraSettingsEnabled && (

app/src/organisms/ODD/ProtocolSetup/ProtocolSetupCamera/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import styles from './setupcamera.module.css'
2020

2121
import type { Dispatch, SetStateAction } from 'react'
22+
import type { Protocol } from '@opentrons/api-client'
2223
import type { SetupScreens } from '/app/organisms/ODD/ProtocolSetup'
2324
import type { State } from '/app/redux/types'
2425
import type { RobotStorageInfo } from '/app/resources/health/useIsImageStorageLow'
@@ -33,6 +34,7 @@ export interface ProtocolSetupCameraProps {
3334
confirmCameraSettings: () => void
3435
storageInfo: RobotStorageInfo | null
3536
setSetupScreen: Dispatch<SetStateAction<SetupScreens>>
37+
protocolRecord: Protocol | null
3638
}
3739

3840
export function ProtocolSetupCamera(

app/src/organisms/ODD/RobotSettingsDashboard/CameraPreferences.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export function CameraPreferences({
3636
toggleLiveStreamEnabled={settings.toggleLiveVideoEnabled}
3737
storageInfo={null}
3838
isCameraRequired={null}
39+
protocolRecord={null}
3940
/>
4041
)
4142
}

app/src/pages/ODD/ProtocolSetup/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,7 @@ export function ProtocolSetup(): JSX.Element {
10101010
confirmCameraSettings={confirmCameraSettings}
10111011
setSetupScreen={setSetupScreen}
10121012
storageInfo={storageInfo}
1013+
protocolRecord={protocolRecord ?? null}
10131014
/>
10141015
),
10151016
'view only parameters': (

0 commit comments

Comments
 (0)