Skip to content

Commit ff842e5

Browse files
committed
Start using plan ubutton for preset positions in oav
1 parent 6ef04c9 commit ff842e5

File tree

2 files changed

+37
-50
lines changed

2 files changed

+37
-50
lines changed

src/blueapi/BlueapiComponents.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Button,
66
Snackbar,
77
SnackbarCloseReason,
8+
styled,
89
Tooltip,
910
Typography,
1011
} from "@mui/material";
@@ -22,6 +23,15 @@ type RunPlanButtonProps = {
2223
btnSize?: ButtonSize;
2324
};
2425

26+
// const CustomRunButton = styled(Button)({
27+
// width: "100%",
28+
// height: "85%",
29+
// color: "var(--color)",
30+
// backgroundColor: "var(--backgroundColor)",
31+
// padding: "var(--padding)",
32+
// margin: "var(--margin)",
33+
// });
34+
2535
export function RunPlanButton(props: RunPlanButtonProps) {
2636
const [openSnackbar, setOpenSnackbar] = React.useState<boolean>(false);
2737
const [msg, setMsg] = React.useState<string>("Running plan...");

src/screens/OavMover.tsx

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ArrowUpwardRounded,
2222
Close,
2323
Help,
24+
Padding,
2425
} from "@mui/icons-material";
2526
import { useState } from "react";
2627

@@ -31,6 +32,7 @@ import { PvDescription } from "../pv/types";
3132
import { SelectionWithPlanRunner } from "../components/SelectionControl";
3233
import { BacklightPositions, ZoomLevels } from "../pv/enumPvValues";
3334
import oxfordChipDiagram from "../assets/Oxford Chip Diagram.excalidraw.svg";
35+
import { RunPlanButton } from "../blueapi/BlueapiComponents";
3436

3537
const buttonStyle = {
3638
color: "white",
@@ -205,59 +207,34 @@ export function PresetMovements() {
205207
<p>
206208
<b>Preset Positions</b>
207209
</p>
208-
<Grid2>
209-
<Tooltip title={"Move into position for collection"}>
210-
<Button
211-
style={buttonStyle}
212-
onClick={() =>
213-
submitAndRunPlanImmediately({
214-
planName: "moveto_preset",
215-
planParams: {
216-
place: "collect_position",
217-
},
218-
})
219-
}
220-
>
221-
Collect Position
222-
</Button>
223-
</Tooltip>
224-
225-
<Tooltip title={"Move hardware for sample loading"}>
226-
<Button
227-
style={buttonStyle}
228-
onClick={() =>
229-
submitAndRunPlanImmediately({
230-
planName: "moveto_preset",
231-
planParams: {
232-
place: "load_position",
233-
},
234-
})
235-
}
236-
>
237-
Load Position
238-
</Button>
239-
</Tooltip>
240-
<Tooltip title={"Align microdrop"}>
241-
<Button
242-
style={buttonStyle}
243-
onClick={() =>
244-
submitAndRunPlanImmediately({
245-
planName: "moveto_preset",
246-
planParams: {
247-
place: "microdrop_position",
248-
},
249-
})
250-
}
251-
>
252-
Microdrop Align
253-
</Button>
254-
</Tooltip>
255-
</Grid2>
210+
<Stack padding={"20px"} margin={"10px"} spacing={1}>
211+
<RunPlanButton
212+
btnLabel="Collect Position"
213+
planName="moveto_preset"
214+
planParams={{ place: "collect_position" }}
215+
title="Move into position for collection"
216+
btnSize="small"
217+
/>
218+
<RunPlanButton
219+
btnLabel="Load Position"
220+
planName="moveto_preset"
221+
planParams={{ place: "load_position" }}
222+
title="Move hardware for sample loading"
223+
btnSize="small"
224+
/>
225+
<RunPlanButton
226+
btnLabel="Microdrop align"
227+
planName="moveto_preset"
228+
planParams={{ place: "microdrop_position" }}
229+
title="Align microdrop"
230+
btnSize="small"
231+
/>
232+
</Stack>
256233
</Box>
257234
);
258235
}
259236

260-
export function SideDrawer() {
237+
export function PresetPositionsSideDrawer() {
261238
const [open, setOpen] = useState(false);
262239
const toggleDrawer = (newOpen: boolean) => () => {
263240
setOpen(newOpen);
@@ -507,7 +484,7 @@ export function OavMover() {
507484
<hr />
508485
<CoordinateSystem />
509486
<hr />
510-
<SideDrawer />
487+
<PresetPositionsSideDrawer />
511488
</Grid2>
512489
</Grid2>
513490
</div>

0 commit comments

Comments
 (0)