Skip to content
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
43 changes: 19 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.2",
"react-query": "^3.39.3",
"react-router-dom": "^5.3.4",
"stream": "^0.0.3"
},
"devDependencies": {
Expand Down
114 changes: 22 additions & 92 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,103 +1,33 @@
import React from "react";
import { Tabs, Tab, useTheme, Box } from "@mui/material";
import { DetectorMotionTabPanel } from "./screens/DetectorMotion";
import { BeamlineStatsTabPanel } from "./screens/BeamlineStats";
import { OavMover } from "./screens/OavMover";
import { useTheme, Box } from "@mui/material";
import "./App.css";
import { ParamsPanel } from "./screens/CollectionPanel";
import { ColourSchemeButton, Footer } from "@diamondlightsource/sci-react-ui";

interface TabPanelProps {
children?: React.ReactNode;
index: number;
value: number;
}

function a11yProps(index: number) {
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
};
}

function CustomTabPanel(props: TabPanelProps) {
const { children, value, index, ...other } = props;

return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && <Box sx={{ p: 3 }}>{children}</Box>}
</div>
);
}

function FixedTargetPanels() {
const theme = useTheme();
const [value, setValue] = React.useState(0);
const handleChange = (_event: React.SyntheticEvent, newValue: number) => {
setValue(newValue);
};
return (
<div>
<Box
component="section"
sx={{
borderBottom: 1,
borderColor: "divider",
color: theme.palette.text.secondary,
}}
>
<Tabs
value={value}
onChange={handleChange}
aria-label="basic tabs example"
textColor="secondary"
centered
>
<Tab label="Beamline info" {...a11yProps(0)} />
<Tab label="Detector position" {...a11yProps(1)} />
<Tab label="OAV view" {...a11yProps(2)} />
<Tab label="Fixed Target Collection" {...a11yProps(3)} />
</Tabs>
</Box>
<CustomTabPanel value={value} index={0}>
<BeamlineStatsTabPanel />
</CustomTabPanel>
<CustomTabPanel value={value} index={1}>
<DetectorMotionTabPanel />
</CustomTabPanel>
<CustomTabPanel value={value} index={2}>
<OavMover />
</CustomTabPanel>
<CustomTabPanel value={value} index={3}>
<ParamsPanel />
</CustomTabPanel>
</div>
);
}
import { Switch, Route } from "react-router-dom";
import { BeamlineI24 } from "./routes/BeamlineI24";
import { FixedTarget } from "./routes/FixedTarget";
import { SerialNavBar } from "./components/SerialNavBar";

function App() {
const theme = useTheme();

return (
<Box
sx={[
() => ({
display: "flex",
justifyContent: "space-between",
flexDirection: "column",
minHeight: "100vh",
minWidth: "320px",
margin: 0,
}),
]}
sx={{
display: "flex",
justifyContent: "space-between",
flexDirection: "column",
minHeight: "100vh",
minWidth: "320px",
margin: 0,
}}
>
<FixedTargetPanels />
<SerialNavBar />
<Switch>
<Route exact path="/">
<BeamlineI24 />
</Route>
<Route path="/fixed-target">
<FixedTarget />
</Route>
</Switch>
<Footer
logo={theme.logos?.short}
color={theme.palette.primary.main}
Expand Down
4 changes: 4 additions & 0 deletions src/assets/i24ssx.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions src/components/SerialNavBar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
Navbar,
NavLinks,
NavLink,
type ImageColourSchemeSwitchType,
} from "@diamondlightsource/sci-react-ui";
import { Link } from "react-router-dom";
import i24ssx from "../assets/i24ssx.svg";

const ssxLogo: ImageColourSchemeSwitchType = {
src: i24ssx,
srcDark: i24ssx,
alt: "i24 ssx",
width: "100",
};

export function SerialNavBar() {
return (
<Navbar logo={ssxLogo} containerWidth={false} linkComponent={Link}>
<NavLinks>
<NavLink linkComponent={Link} to="/">
Home
</NavLink>
<NavLink linkComponent={Link} to="/fixed-target">
Fixed Target
</NavLink>
</NavLinks>
</Navbar>
);
}
5 changes: 4 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import "./index.css";
import App from "./App.tsx";
import { Provider } from "react-redux";
import { store } from "@diamondlightsource/cs-web-lib";
import { BrowserRouter } from "react-router-dom";

import { QueryClient, QueryClientProvider } from "react-query";
import { ThemeProvider } from "@diamondlightsource/sci-react-ui";
Expand All @@ -19,7 +20,9 @@ createRoot(document.getElementById("root")!).render(
<ThemeProvider theme={I24DiamondTheme}>
<Provider store={store}>
<QueryClientProvider client={queryClient}>
<App />
<BrowserRouter basename="/mx-daq-ui/">
<App />
</BrowserRouter>
</QueryClientProvider>
</Provider>
</ThemeProvider>
Expand Down
76 changes: 76 additions & 0 deletions src/routes/BeamlineI24.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { Box, Tab, Tabs, useTheme } from "@mui/material";
import { BeamlineStatsTabPanel } from "../screens/BeamlineStats";
import { DetectorMotionTabPanel } from "../screens/DetectorMotion";
import { OavMover } from "../screens/OavMover";
import React from "react";

interface TabPanelProps {
children?: React.ReactNode;
index: number;
value: number;
}

function a11yProps(index: number) {
return {
id: `simple-tab-${index}`,
"aria-controls": `simple-tabpanel-${index}`,
};
}

function CustomTabPanel(props: TabPanelProps) {
const { children, value, index, ...other } = props;

return (
<div
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
{value === index && <Box sx={{ p: 3 }}>{children}</Box>}
</div>
);
}

export function BeamlineI24() {
const theme = useTheme();
const [tab, setTab] = React.useState(0);

const handleChange = (_event: React.SyntheticEvent, newTab: number) => {
setTab(newTab);
};
return (
<Box>
<Box
component="section"
sx={{
borderBottom: 1,
borderColor: "divider",
color: theme.palette.text.secondary,
}}
>
<Tabs
value={tab}
onChange={handleChange}
aria-label="basic tabs example"
textColor="secondary"
centered
>
<Tab label="Beamline info" {...a11yProps(0)} />
<Tab label="Detector position" {...a11yProps(1)} />
<Tab label="OAV view" {...a11yProps(2)} />
</Tabs>
</Box>
<CustomTabPanel value={tab} index={0}>
<BeamlineStatsTabPanel />
</CustomTabPanel>
<CustomTabPanel value={tab} index={1}>
<DetectorMotionTabPanel />
</CustomTabPanel>
<CustomTabPanel value={tab} index={2}>
<OavMover />
</CustomTabPanel>
</Box>
);
}
Loading