Skip to content

Commit e7bf064

Browse files
committed
And maybe save everything
1 parent c4a7a6b commit e7bf064

File tree

4 files changed

+89
-63
lines changed

4 files changed

+89
-63
lines changed

src/routes/BeamlineI24.tsx

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { BeamlineStatsTabPanel } from "screens/BeamlineStats";
33
import { DetectorMotionTabPanel } from "screens/DetectorMotion";
44
import { OavMover } from "screens/OavMover/OavMover";
55
import React from "react";
6+
import { ErrorBoundary } from "react-error-boundary";
7+
import { FallbackScreen } from "screens/FallbackScreen";
68

79
interface TabPanelProps {
810
children?: React.ReactNode;
@@ -41,36 +43,38 @@ export function BeamlineI24() {
4143
setTab(newTab);
4244
};
4345
return (
44-
<Box>
45-
<Box
46-
component="section"
47-
sx={{
48-
borderBottom: 1,
49-
borderColor: "divider",
50-
color: theme.palette.text.secondary,
51-
}}
52-
>
53-
<Tabs
54-
value={tab}
55-
onChange={handleChange}
56-
aria-label="basic tabs example"
57-
textColor="secondary"
58-
centered
46+
<ErrorBoundary fallback={<FallbackScreen />}>
47+
<Box>
48+
<Box
49+
component="section"
50+
sx={{
51+
borderBottom: 1,
52+
borderColor: "divider",
53+
color: theme.palette.text.secondary,
54+
}}
5955
>
60-
<Tab label="Beamline info" {...a11yProps(0)} />
61-
<Tab label="Detector position" {...a11yProps(1)} />
62-
<Tab label="OAV view" {...a11yProps(2)} />
63-
</Tabs>
56+
<Tabs
57+
value={tab}
58+
onChange={handleChange}
59+
aria-label="basic tabs example"
60+
textColor="secondary"
61+
centered
62+
>
63+
<Tab label="Beamline info" {...a11yProps(0)} />
64+
<Tab label="Detector position" {...a11yProps(1)} />
65+
<Tab label="OAV view" {...a11yProps(2)} />
66+
</Tabs>
67+
</Box>
68+
<CustomTabPanel value={tab} index={0}>
69+
<BeamlineStatsTabPanel />
70+
</CustomTabPanel>
71+
<CustomTabPanel value={tab} index={1}>
72+
<DetectorMotionTabPanel />
73+
</CustomTabPanel>
74+
<CustomTabPanel value={tab} index={2}>
75+
<OavMover />
76+
</CustomTabPanel>
6477
</Box>
65-
<CustomTabPanel value={tab} index={0}>
66-
<BeamlineStatsTabPanel />
67-
</CustomTabPanel>
68-
<CustomTabPanel value={tab} index={1}>
69-
<DetectorMotionTabPanel />
70-
</CustomTabPanel>
71-
<CustomTabPanel value={tab} index={2}>
72-
<OavMover />
73-
</CustomTabPanel>
74-
</Box>
78+
</ErrorBoundary>
7579
);
7680
}

src/routes/FixedTarget.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
import { Box, Typography, useTheme } from "@mui/material";
22
import { ParamsPanel } from "screens/CollectionPanel";
33
import { ReadOnlyInputs } from "components/ReadOnlyInputs";
4+
import { ErrorBoundary } from "react-error-boundary";
5+
import { FallbackScreen } from "screens/FallbackScreen";
46

57
export function FixedTarget() {
68
const theme = useTheme();
79
return (
8-
<Box marginTop={2}>
9-
<Typography
10-
variant="h1"
11-
sx={{
12-
color: theme.palette.info.main,
13-
fontSize: 24,
14-
fontWeight: "fontWeightBold",
15-
}}
16-
>
17-
Fixed Target Data Collection Setup
18-
</Typography>
19-
<ReadOnlyInputs
20-
visit="ca://BL24I-MO-IOC-13:GP100"
21-
detector="ca://BL24I-MO-IOC-13:GP101"
22-
/>
23-
<ParamsPanel expt="fixed-target" />
24-
</Box>
10+
<ErrorBoundary fallback={<FallbackScreen />}>
11+
<Box marginTop={2}>
12+
<Typography
13+
variant="h1"
14+
sx={{
15+
color: theme.palette.info.main,
16+
fontSize: 24,
17+
fontWeight: "fontWeightBold",
18+
}}
19+
>
20+
Fixed Target Data Collection Setup
21+
</Typography>
22+
<ReadOnlyInputs
23+
visit="ca://BL24I-MO-IOC-13:GP100"
24+
detector="ca://BL24I-MO-IOC-13:GP101"
25+
/>
26+
<ParamsPanel expt="fixed-target" />
27+
</Box>
28+
</ErrorBoundary>
2529
);
2630
}

src/routes/JungfrauRotation.tsx

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
11
import { Box, Grid2, Typography, useTheme } from "@mui/material";
22
import { ParamsPanel } from "../screens/CollectionPanel";
33
import { CollectDarksPanel } from "../components/JungFrau/CollectDarksPanel";
4+
import { ErrorBoundary } from "react-error-boundary";
5+
import { FallbackScreen } from "screens/FallbackScreen";
46

57
export function JfRotation() {
68
const theme = useTheme();
79
return (
8-
<Box marginTop={2}>
9-
<Typography
10-
variant="h1"
11-
sx={{
12-
color: theme.palette.info.main,
13-
fontSize: 24,
14-
fontWeight: "fontWeightBold",
15-
}}
16-
>
17-
Jungfrau Rotation Scans Setup
18-
</Typography>
19-
<Grid2 container marginTop={2} spacing={2}>
20-
<Grid2 size={5}>
21-
<CollectDarksPanel />
10+
<ErrorBoundary fallback={<FallbackScreen />}>
11+
<Box marginTop={2}>
12+
<Typography
13+
variant="h1"
14+
sx={{
15+
color: theme.palette.info.main,
16+
fontSize: 24,
17+
fontWeight: "fontWeightBold",
18+
}}
19+
>
20+
Jungfrau Rotation Scans Setup
21+
</Typography>
22+
<Grid2 container marginTop={2} spacing={2}>
23+
<Grid2 size={5}>
24+
<CollectDarksPanel />
25+
</Grid2>
26+
<ParamsPanel expt="jf" />
2227
</Grid2>
23-
<ParamsPanel expt="jf" />
24-
</Grid2>
25-
</Box>
28+
</Box>
29+
</ErrorBoundary>
2630
);
2731
}

src/screens/FallbackScreen.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Box, Typography } from "@mui/material";
2+
3+
import ErrorOutlineIcon from "@mui/icons-material/ErrorOutline";
4+
5+
export function FallbackScreen() {
6+
return (
7+
<Box alignContent={"center"}>
8+
<ErrorOutlineIcon color="error" fontSize="large" />
9+
<Typography component="h1" variant="h4">
10+
Page currently unavailable
11+
</Typography>
12+
</Box>
13+
);
14+
}

0 commit comments

Comments
 (0)