Skip to content

Commit

Permalink
put behind ff
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Mar 14, 2024
1 parent ffcce62 commit 97cec55
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { i18n } from '../../../i18n'
import { useHardwareStatusText } from '../../../organisms/OnDeviceDisplay/RobotDashboard/hooks'
import { useOffsetCandidatesForAnalysis } from '../../../organisms/ApplyHistoricOffsets/hooks/useOffsetCandidatesForAnalysis'
import { useMissingProtocolHardware } from '../../Protocols/hooks'
import { useFeatureFlag } from '../../../redux/config'
import { formatTimeWithUtcLabel } from '../../../resources/runs'
import { ProtocolDetails } from '..'
import { Deck } from '../Deck'
Expand Down Expand Up @@ -52,6 +53,7 @@ vi.mock('../Deck')
vi.mock('../Hardware')
vi.mock('../Labware')
vi.mock('../Parameters')
vi.mock('../../../redux/config')

const MOCK_HOST_CONFIG = {} as HostConfig
const mockCreateRun = vi.fn((id: string) => {})
Expand Down Expand Up @@ -90,6 +92,7 @@ const render = (path = '/protocols/fakeProtocolId') => {

describe('ODDProtocolDetails', () => {
beforeEach(() => {
vi.mocked(useFeatureFlag).mockReturnValue(true)
vi.mocked(useCreateRunMutation).mockReturnValue({
createRun: mockCreateRun,
} as any)
Expand Down
24 changes: 21 additions & 3 deletions app/src/pages/ProtocolDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
getApplyHistoricOffsets,
getPinnedProtocolIds,
updateConfigValue,
useFeatureFlag,
} from '../../redux/config'
import { useOffsetCandidatesForAnalysis } from '../../organisms/ApplyHistoricOffsets/hooks/useOffsetCandidatesForAnalysis'
import { useMissingProtocolHardware } from '../Protocols/hooks'
Expand Down Expand Up @@ -163,8 +164,17 @@ const protocolSectionTabOptions = [
'Liquids',
'Deck',
] as const
const protocolSectionTabOptionsWithoutParameters = [
'Summary',
'Hardware',
'Labware',
'Liquids',
'Deck',
] as const

type TabOption = typeof protocolSectionTabOptions[number]
type TabOption =
| typeof protocolSectionTabOptions[number]
| typeof protocolSectionTabOptionsWithoutParameters[number]

interface ProtocolSectionTabsProps {
currentOption: TabOption
Expand All @@ -175,9 +185,13 @@ const ProtocolSectionTabs = ({
currentOption,
setCurrentOption,
}: ProtocolSectionTabsProps): JSX.Element => {
const enableRtpFF = useFeatureFlag('enableRunTimeParameters')
const options = enableRtpFF
? protocolSectionTabOptions
: protocolSectionTabOptionsWithoutParameters
return (
<Flex gridGap={SPACING.spacing8}>
{protocolSectionTabOptions.map(option => {
{options.map(option => {
return (
<TabbedButton
isSelected={option === currentOption}
Expand Down Expand Up @@ -290,6 +304,7 @@ export function ProtocolDetails(): JSX.Element | null {
'protocol_info',
'shared',
])
const enableRtpFF = useFeatureFlag('enableRunTimeParameters')
const { protocolId } = useParams<OnDeviceRouteParams>()
const {
missingProtocolHardware,
Expand All @@ -305,8 +320,11 @@ export function ProtocolDetails(): JSX.Element | null {
const { makeSnackbar } = useToaster()
const queryClient = useQueryClient()
const [currentOption, setCurrentOption] = React.useState<TabOption>(
protocolSectionTabOptions[0]
enableRtpFF
? protocolSectionTabOptions[0]
: protocolSectionTabOptionsWithoutParameters[0]
)

const [showMaxPinsAlert, setShowMaxPinsAlert] = React.useState<boolean>(false)
const {
data: protocolRecord,
Expand Down

0 comments on commit 97cec55

Please sign in to comment.