diff --git a/frontend/src/components/RugnuxPage.tsx b/frontend/src/components/RugnuxPage.tsx index 76fc04397..4dbb400f8 100644 --- a/frontend/src/components/RugnuxPage.tsx +++ b/frontend/src/components/RugnuxPage.tsx @@ -29,11 +29,11 @@ import {lazy, Suspense, useEffect, useRef, useState} from "react"; // of the window, edged in the colour of the run's phase, that shows everything at once - images, structure, // statistics; in a narrower one the same pieces flow down the page (FlowDashboard). // Across the top, the phase, the two progress bars (the detector's and rugnux's) and the clock the run is -// judged by. Below, left to right: the hero numbers of the merge as a rail with the triage badges under them, -// the diffraction image the broker is on, and the placed model in Mol* (the run's step until there is one). -// Under the image and the model, four plots: the collection image by image - spots and background, and the -// per-image scale with the frames the merge left out - and the merge by resolution shell - completeness and -// CC1/2. Everything else - the timeline, step notes, +// judged by. Below, left to right: the hero numbers of the merge as a rail, the diffraction image the broker +// is on, the placed model in Mol* (the run's step until there is one), and the triage badges over the merge by +// resolution shell - completeness and CC1/2, small and square. Under the image and the model, the collection +// image by image: spots and background, and the per-image scale with the frames the merge left out. Everything +// else - the timeline, step notes, // summary rows, warnings, the serial pre-pass geometry - sits under a "Details" fold below the stage, and the // settings under that. @@ -185,18 +185,18 @@ function Centre({s, pal}: { s: rugnux_live_status, pal: LivePalette }) { return ; } -// Height of an element in px, kept up to date as the page resizes: the plots need theirs in pixels. -function useHeight() { +// Size of an element in px, kept up to date as the page resizes: the plots need theirs in pixels. +function useSize() { const ref = useRef(null); - const [height, setHeight] = useState(0); + const [size, setSize] = useState({width: 0, height: 0}); useEffect(() => { if (!ref.current) return; - const observer = new ResizeObserver(entries => setHeight(entries[0].contentRect.height)); + const observer = new ResizeObserver(entries => setSize({width: entries[0].contentRect.width, height: entries[0].contentRect.height})); observer.observe(ref.current); return () => observer.disconnect(); }, []); - return [ref, height] as const; + return [ref, size.width, size.height] as const; } // The checks: what the pathology checklist made of the merge, a failed run's message, or what is still to come @@ -208,10 +208,28 @@ function Checks({s, pal}: { s: rugnux_live_status, pal: LivePalette }) { return ; } -function ShellPlotsOrLater({s, height}: { s: rugnux_live_status, height: number }) { +// row: the two plots side by side; else one above the other +function ShellPlotsOrLater({s, height, row}: { s: rugnux_live_status, height: number, row?: boolean }) { if (!s.shells || s.shells.length === 0) return ; - return ; + return ; +} + +// The right panel: the checks, and under them the shell plots, small and square, one above the other +// (side: their side in px; sx: how the plots' division takes its height - on the stage, what the checks leave) +function RightPanel({s, pal, side, sx}: { s: rugnux_live_status, pal: LivePalette, side: number, sx?: object }) { + return ( + <> + *": {flexShrink: 0}}}> + + + By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}} sx={sx}> + + + + + + ); } type DashboardProps = { s: rugnux_live_status, name?: string, givenCell?: string, deadline_s: number, modelLoaded: boolean, @@ -221,89 +239,95 @@ type DashboardProps = { s: rugnux_live_status, name?: string, givenCell?: string // the pre-pass. A rotation run's images are analysed by rugnux's own passes and carry neither. const overlaysOn = (s: rugnux_live_status) => s.stills !== undefined && s.stills.images_analysed > 0; -// The height of the bottom row of plots, from the window's height so the stage holds everything without -// scrolling: the image and the model take what the header and the plots leave. -const PLOTS = "clamp(190px, 23vh, 440px)"; +// The height of the collection strip along the bottom and the width of the rail and the right panel, from the +// window so the stage holds everything without scrolling: the image and the model take what is left. +const STRIP = "clamp(150px, 14vh, 260px)"; const RAIL = "clamp(200px, 12vw, 420px)"; +const RIGHT = "clamp(220px, 15vw, 360px)"; +const AXIS_TITLE = 18; // what the lower of two stacked shell plots adds for the axis title (RugnuxShellPlots) // The stage of a wide window (xl): the height of the window, nothing scrolls. function StageDashboard({s, name, givenCell, deadline_s, modelLoaded, measuring, pal}: DashboardProps) { - const [plotsRef, plotsHeight] = useHeight(); - const [imageRef, imageHeight] = useHeight(); - const plotHeight = Math.max(150, plotsHeight); + const [stripRef, , stripHeight] = useSize(); + const [imageRef, , imageHeight] = useSize(); + const [rightRef, rightWidth, rightHeight] = useSize(); + // the shell plots, square, one above the other in the right panel: as large as its width or height allows + const side = Math.max(120, Math.min(rightWidth, (rightHeight - AXIS_TITLE) / 2)); const hairline = {borderLeft: "1px solid", borderColor: "divider", pl: 2.5}; return (
- - {/* the merge's numbers, and under them what the checks made of it */} - + + - {/* the image, square with the row's height, in a column of its own width; the model takes the rest */} - + - + - {/* four plots across the bottom: the collection image by image, wide - a point an image - and the - merge by resolution, square - a point a shell - each as wide as the row is high */} - - - - - - - By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}} sx={hairline}> - *": {width: "100%"}}}> - - - + {/* the checks over the shell plots, small and square - a point a shell */} + + + {/* the collection image by image along the bottom, wide - a point an image */} + + + + + ); } -// The side of the square shell plots and the height of the collection strip, below the stage +// The side of the square shell plots, the height of the collection strip and the width of the right panel, +// below the stage const FLOW_SQUARE = 240; const FLOW_STRIP = 200; +const FLOW_RIGHT = 220; // A narrower window (the common case: a browser beside other windows), where the page scrolls: the merge's // numbers as a row of tiles under the header, then the image and the model side by side, as large as the width -// allows - one above the other where that would leave them under 360 px - then the collection plots, wide, and -// the shell plots, square, with the checks beside them. +// allows - one above the other where that would leave them under 360 px - with the right panel (the checks over +// the shell plots, small and square) beside them from 1200 px, then the collection plots, wide. Narrower than +// that, the shell plots come after the collection, with the checks beside them. function FlowDashboard({s, name, givenCell, deadline_s, modelLoaded, measuring, pal}: DashboardProps) { const twoUp = useMediaQuery("(min-width: 1000px)"); + const wide = useMediaQuery("(min-width: 1200px)"); return (
- + {/* beside the image the model is as tall as the image; under it, as tall as Mol* needs */} + {/* the row grows to the panel where it is taller than the image: the model fills it */} + {wide && + + } - + {!wide && By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}} sx={{width: 2 * FLOW_SQUARE + 12, maxWidth: "100%", minHeight: {xs: 120, sm: FLOW_SQUARE}}}> - *": {width: "100%"}}}> + *": {width: "100%"}}}> - + } ); }