Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(protocol-designer): fix layout for ProtocolSteps #16959

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export function StepFormToolbox(props: StepFormToolboxProps): JSX.Element {
/>
) : null}
<Toolbox
height="calc(100vh - 6rem)"
position={POSITION_RELATIVE}
subHeader={
isMultiStepToolbox ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ export function StepSummary(props: StepSummaryProps): JSX.Element | null {
>
{stepSummaryContent != null ? (
<ListItem type="noActive">
<Flex padding={SPACING.spacing12} height="4.75rem">
{stepSummaryContent}
</Flex>
<Flex padding={SPACING.spacing12}>{stepSummaryContent}</Flex>
</ListItem>
) : null}
{stepDetails != null && stepDetails !== '' ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function SubstepsToolbox(
substeps.commandCreatorFnName === 'mix')) ||
substeps.substepType === THERMOCYCLER_PROFILE ? (
<Toolbox
height="calc(100vh - 6rem)"
width={FLEX_MAX_CONTENT}
closeButton={<Icon size="2rem" name="close" />}
onCloseClick={handleClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const TimelineToolbox = (): JSX.Element => {
titlePadding={SPACING.spacing12}
childrenPadding={SPACING.spacing12}
confirmButton={formData != null ? undefined : <AddStepButton />}
height="calc(100vh - 6rem)"
>
<Flex
flexDirection={DIRECTION_COLUMN}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import {
getSelectedSubstep,
getSelectedTerminalItemId,
} from '../../../../ui/steps/selectors'
import { getDesignerTab } from '../../../../file-data/selectors'
import {
getDesignerTab,
getRobotStateTimeline,
} from '../../../../file-data/selectors'
import { getEnableHotKeysDisplay } from '../../../../feature-flags/selectors'
import { DeckSetupContainer } from '../../DeckSetup'
import { OffDeck } from '../../Offdeck'
Expand Down Expand Up @@ -57,6 +60,10 @@ const MOCK_STEP_FORMS = {
describe('ProtocolSteps', () => {
beforeEach(() => {
vi.mocked(getDesignerTab).mockReturnValue('protocolSteps')
vi.mocked(getRobotStateTimeline).mockReturnValue({
timeline: [],
errors: [],
})
vi.mocked(TimelineToolbox).mockReturnValue(<div>mock TimelineToolbox</div>)
vi.mocked(DeckSetupContainer).mockReturnValue(
<div>mock DeckSetupContainer</div>
Expand Down
26 changes: 16 additions & 10 deletions protocol-designer/src/pages/Designer/ProtocolSteps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
ALIGN_CENTER,
COLORS,
DIRECTION_COLUMN,
FLEX_MAX_CONTENT,
Flex,
JUSTIFY_CENTER,
JUSTIFY_FLEX_START,
JUSTIFY_SPACE_BETWEEN,
POSITION_FIXED,
SPACING,
Expand All @@ -34,7 +34,10 @@ import { TimelineToolbox, SubstepsToolbox } from './Timeline'
import { StepForm } from './StepForm'
import { StepSummary } from './StepSummary'
import { BatchEditToolbox } from './BatchEditToolbox'
import { getDesignerTab } from '../../../file-data/selectors'
import {
getDesignerTab,
getRobotStateTimeline,
} from '../../../file-data/selectors'
import { TimelineAlerts } from '../../../organisms'

const CONTENT_MAX_WIDTH = '46.9375rem'
Expand Down Expand Up @@ -64,31 +67,37 @@ export function ProtocolSteps(): JSX.Element {
? savedStepForms[currentstepIdForStepSummary]
: null

const { errors: timelineErrors } = useSelector(getRobotStateTimeline)
const hasTimelineErrors =
timelineErrors != null ? timelineErrors.length > 0 : false
const showTimelineAlerts =
hasTimelineErrors && tab === 'protocolSteps' && formData == null
const stepDetails = currentStep?.stepDetails ?? null

return (
<Flex
backgroundColor={COLORS.grey10}
height="calc(100vh - 4rem)"
minHeight={FLEX_MAX_CONTENT}
width="100%"
padding={SPACING.spacing12}
gridGap={SPACING.spacing16}
height="calc(100vh - 4rem)"
justifyContent={JUSTIFY_SPACE_BETWEEN}
padding={SPACING.spacing12}
>
<TimelineToolbox />
<Flex
alignItems={ALIGN_CENTER}
alignSelf={ALIGN_CENTER}
flexDirection={DIRECTION_COLUMN}
gridGap={SPACING.spacing16}
width="100%"
justifyContent={JUSTIFY_FLEX_START}
paddingTop={showTimelineAlerts ? '0' : SPACING.spacing24}
>
<Flex
flexDirection={DIRECTION_COLUMN}
gridGap={SPACING.spacing16}
maxWidth={CONTENT_MAX_WIDTH}
>
{tab === 'protocolSteps' ? (
{showTimelineAlerts ? (
<TimelineAlerts justifyContent={JUSTIFY_CENTER} width="100%" />
) : null}
<Flex justifyContent={JUSTIFY_SPACE_BETWEEN}>
Expand Down Expand Up @@ -128,9 +137,6 @@ export function ProtocolSteps(): JSX.Element {
stepDetails={stepDetails}
/>
) : null}
{selectedTerminalItem != null && currentHoveredStepId == null ? (
<Flex height="4.75rem" width="100%" />
) : null}
</Flex>
</Flex>
{enableHoyKeyDisplay ? (
Expand Down
3 changes: 2 additions & 1 deletion protocol-designer/src/pages/Designer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ALIGN_END,
COLORS,
DIRECTION_COLUMN,
FLEX_MAX_CONTENT,
Flex,
INFO_TOAST,
SPACING,
Expand Down Expand Up @@ -149,7 +150,7 @@ export function Designer(): JSX.Element {
}}
/>
) : null}
<Flex flexDirection={DIRECTION_COLUMN}>
<Flex flexDirection={DIRECTION_COLUMN} minHeight={FLEX_MAX_CONTENT}>
<ProtocolNavBar
hasZoomInSlot={zoomIn.slot != null || zoomIn.cutout != null}
hasTrashEntity={hasTrashEntity}
Expand Down
Loading