rugnux live page, variant C: the checks over small square shell plots in a right panel, collection plots along the bottom

The shape of the first layout - rail, image, model, a right panel, the collection plots along the bottom - with
the right panel's two tall shell plots made small and square, one above the other under the checks. Below the
stage the right panel stands beside the image and the model from 1200 px; narrower than that the shell plots
follow the collection plots as in the layout before. For comparison with it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
leonarski_fandClaude Fable 5.1 committed 2026-11-14 08:34:48 +01:00
1 parent ea9d8e64bb
commit b351bbb32b
1 file changed
+70 -46
+70 -46
View File
@@ -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 <Division sx={{flexGrow: 1}} label="Run"><RunConsole s={s} pal={pal}/></Division>;
}
// 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<HTMLDivElement>(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 <Later text={s.stills ? "checks after the first merge" : "checks after the run"}/>;
}
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 <Later text={s.stills ? "after the first merge" : "after scaling"}/>;
return <RugnuxShellPlots shells={s.shells} d_min={s.overall?.d_min ?? s.d_min} fit={s.resolution_fit} row height={height}/>;
return <RugnuxShellPlots shells={s.shells} d_min={s.overall?.d_min ?? s.d_min} fit={s.resolution_fit} row={row} height={height}/>;
}
// 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 (
<>
<Box sx={{flex: "0 1 auto", maxHeight: "40%", overflowY: "auto", display: "flex", "& > *": {flexShrink: 0}}}>
<Checks s={s} pal={pal}/>
</Box>
<Division label={<>By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}</>} sx={sx}>
<Box sx={{display: "flex", flexGrow: 1, minHeight: 0}}>
<Box sx={{width: side, maxWidth: "100%"}}><ShellPlotsOrLater s={s} height={side}/></Box>
</Box>
</Division>
</>
);
}
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 (
<Box sx={{display: "grid", gridTemplateRows: "auto minmax(0, 1fr)", gap: 2.5, height: "100%", minHeight: 0}}>
<Header s={s} name={name} deadline_s={deadline_s} measuring={measuring} pal={pal}/>
<Box sx={{display: "grid", gap: 2.5, minHeight: 0, gridTemplateColumns: `${RAIL} auto minmax(0, 1fr)`,
gridTemplateRows: `minmax(0, 1fr) ${PLOTS}`}}>
{/* the merge's numbers, and under them what the checks made of it */}
<Division label="Merge" sx={{gridRow: "1 / 3"}}>
<Box sx={{display: "grid", gap: 2.5, minHeight: 0, gridTemplateColumns: `${RAIL} auto minmax(0, 1fr) ${RIGHT}`,
gridTemplateRows: `minmax(0, 1fr) ${STRIP}`}}>
<Division label="Merge" sx={{gridColumn: 1, gridRow: "1 / 3"}}>
<RugnuxHero s={s} modelLoaded={modelLoaded} givenCell={givenCell} column/>
<Box sx={{flexShrink: 0, mt: 2, display: "flex"}}><Checks s={s} pal={pal}/></Box>
</Division>
{/* the image, square with the row's height, in a column of its own width; the model takes the rest */}
<Division label="Image" sx={hairline}>
<Division label="Image" sx={{...hairline, gridColumn: 2, gridRow: 1}}>
<Box ref={imageRef} sx={{flexGrow: 1, minHeight: 0}}>
<Box sx={{width: `${imageHeight}px`}}>
<RugnuxImage measuring={measuring} overlays={overlaysOn(s)}/>
</Box>
</Box>
</Division>
<Box sx={{...hairline, minHeight: 0, display: "flex", flexDirection: "column"}}>
<Box sx={{...hairline, gridColumn: 3, gridRow: 1, minHeight: 0, display: "flex", flexDirection: "column"}}>
<Centre s={s} pal={pal}/>
</Box>
{/* 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 */}
<Box sx={{gridColumn: "2 / 4", minHeight: 0, display: "grid", gap: 2.5,
gridTemplateColumns: `minmax(0, 1fr) ${2 * plotHeight + 32}px`}}>
<Division label="Collection" sx={hairline}>
<Box ref={plotsRef} sx={{flexGrow: 1, minHeight: 0}}>
<RugnuxCollectionPlots s={s} height={plotHeight}/>
</Box>
</Division>
<Division label={<>By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}</>} sx={hairline}>
<Box sx={{flexGrow: 1, minHeight: 0, display: "flex", "& > *": {width: "100%"}}}>
<ShellPlotsOrLater s={s} height={plotHeight}/>
</Box>
</Division>
{/* the checks over the shell plots, small and square - a point a shell */}
<Box ref={rightRef} sx={{...hairline, gridColumn: 4, gridRow: "1 / 3", minHeight: 0, display: "flex", flexDirection: "column", gap: 2.5}}>
<RightPanel s={s} pal={pal} side={side} sx={{flex: "1 1 0", minHeight: 0}}/>
</Box>
{/* the collection image by image along the bottom, wide - a point an image */}
<Division label="Collection" sx={{...hairline, gridColumn: "2 / 4", gridRow: 2, minHeight: 0}}>
<Box ref={stripRef} sx={{flexGrow: 1, minHeight: 0}}>
<RugnuxCollectionPlots s={s} height={Math.max(130, stripHeight)}/>
</Box>
</Division>
</Box>
</Box>
);
}
// 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 (
<Stack spacing={2.5}>
<Header s={s} name={name} deadline_s={deadline_s} measuring={measuring} pal={pal}/>
<Division label="Merge"><RugnuxHero s={s} modelLoaded={modelLoaded} givenCell={givenCell}/></Division>
<Box sx={{display: "grid", gap: 2.5, gridTemplateColumns: twoUp ? "1fr 1fr" : "1fr", alignItems: "stretch"}}>
<Box sx={{display: "grid", gap: 2.5, alignItems: "stretch",
gridTemplateColumns: wide ? `1fr 1fr ${FLOW_RIGHT}px` : twoUp ? "1fr 1fr" : "1fr"}}>
<Division label="Image"><RugnuxImage measuring={measuring} overlays={overlaysOn(s)}/></Division>
{/* beside the image the model is as tall as the image; under it, as tall as Mol* needs */}
<Box sx={{display: "flex", flexDirection: "column", minHeight: twoUp ? 0 : modelShown(s) ? 480 : 0}}>
<Centre s={s} pal={pal}/>
</Box>
{/* the row grows to the panel where it is taller than the image: the model fills it */}
{wide && <Box sx={{display: "flex", flexDirection: "column", gap: 2.5}}>
<RightPanel s={s} pal={pal} side={FLOW_RIGHT}/>
</Box>}
</Box>
<Division label="Collection"><RugnuxCollectionPlots s={s} height={FLOW_STRIP}/></Division>
<Box sx={{display: "grid", gap: 2.5, gridTemplateColumns: twoUp ? "auto minmax(0, 1fr)" : "1fr", alignItems: "start"}}>
{!wide && <Box sx={{display: "grid", gap: 2.5, gridTemplateColumns: twoUp ? "auto minmax(0, 1fr)" : "1fr", alignItems: "start"}}>
<Division label={<>By resolution{s.stills && s.shells_merge && ` · ${s.shells_merge}`}</>}
sx={{width: 2 * FLOW_SQUARE + 12, maxWidth: "100%", minHeight: {xs: 120, sm: FLOW_SQUARE}}}>
<Box sx={{display: "flex", flexGrow: 1, "& > *": {width: "100%"}}}><ShellPlotsOrLater s={s} height={FLOW_SQUARE}/></Box>
<Box sx={{display: "flex", flexGrow: 1, "& > *": {width: "100%"}}}><ShellPlotsOrLater s={s} height={FLOW_SQUARE} row/></Box>
</Division>
<Division label="Checks" sx={{minHeight: 120}}>
<Box sx={{display: "flex", flexGrow: 1}}><Checks s={s} pal={pal}/></Box>
</Division>
</Box>
</Box>}
</Stack>
);
}