Skip to content

Commit 51c1768

Browse files
committed
Start separating common components so they're reusable
1 parent ce55c64 commit 51c1768

File tree

4 files changed

+29
-23
lines changed

4 files changed

+29
-23
lines changed

src/components/ReadOnlyInputs.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Grid2 } from "@mui/material";
2+
import { RoPvBox } from "../pv/PvComponent";
3+
4+
type RoPvAddress = {
5+
visit: string;
6+
detector: string;
7+
};
8+
9+
/**
10+
* A couple of read-only boxes showing what the visit and detector in use are.
11+
*/
12+
export function ReadOnlyInputs(props: RoPvAddress) {
13+
return (
14+
<Grid2 size={12}>
15+
<RoPvBox label="Visit" pv={props.visit} />
16+
<RoPvBox label="Detector in use" pv={props.detector} />
17+
</Grid2>
18+
);
19+
}

src/routes/Extruder.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Box, Typography, useTheme } from "@mui/material";
2+
import { ReadOnlyInputs } from "../components/ReadOnlyInputs";
23

34
export function Extruder() {
45
const theme = useTheme();
@@ -14,6 +15,10 @@ export function Extruder() {
1415
>
1516
Extruder Data Collection Setup
1617
</Typography>
18+
<ReadOnlyInputs
19+
visit="ca://BL24I-MO-IOC-13:GP1"
20+
detector="ca://BL24I-MO-IOC-13:GP15"
21+
/>
1722
</Box>
1823
);
1924
}

src/routes/FixedTarget.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Box, Typography, useTheme } from "@mui/material";
22
import { ParamsPanel } from "../screens/CollectionPanel";
3+
import { ReadOnlyInputs } from "../components/ReadOnlyInputs";
34

45
export function FixedTarget() {
56
const theme = useTheme();
@@ -15,6 +16,10 @@ export function FixedTarget() {
1516
>
1617
Fixed Target Data Collection Setup
1718
</Typography>
19+
<ReadOnlyInputs
20+
visit="ca://BL24I-MO-IOC-13:GP100"
21+
detector="ca://BL24I-MO-IOC-13:GP101"
22+
/>
1823
<ParamsPanel />
1924
</Box>
2025
);

src/screens/CollectionPanel.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,12 @@ import {
99
TextField,
1010
Tooltip,
1111
} from "@mui/material";
12-
import { PvComponent } from "../pv/PvComponent";
1312
import React from "react";
1413
import { PumpProbeOptions } from "../components/FixedTarget/PumpProbeComponents";
1514
import { MapView } from "../components/FixedTarget/FixedTargetMapComponents";
1615
import { chipTypes, MapTypes, pumpProbeMode } from "../components/params";
17-
import { forceString } from "../pv/util";
1816
import { AbortButton, RunPlanButton } from "../blueapi/BlueapiComponents";
1917

20-
/**
21-
* A couple of read-only boxes showing what the visit and detector in use are.
22-
*/
23-
function FixedInputs() {
24-
return (
25-
<Grid2 size={12}>
26-
<PvComponent
27-
label="Visit"
28-
pv="ca://ME14E-MO-IOC-01:GP100"
29-
transformValue={forceString}
30-
/>
31-
<PvComponent
32-
label="Detector in use"
33-
pv="ca://ME14E-MO-IOC-01:GP101"
34-
transformValue={forceString}
35-
/>
36-
</Grid2>
37-
);
38-
}
39-
4018
type ParametersProps = {
4119
subDir: string;
4220
chipName: string;
@@ -111,7 +89,6 @@ function CollectionInput() {
11189
return (
11290
<Box sx={{ flexGrow: 1 }}>
11391
<Grid2 container spacing={2}>
114-
<FixedInputs />
11592
<Grid2 size={4.5}>
11693
<Stack direction={"column"} spacing={1} alignItems={"center"}>
11794
<Tooltip

0 commit comments

Comments
 (0)