Sidebar: the range of an analysis on two lines, the days then the hours (too wide on one)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
071057dff8
commit
60d10a282c
1 file changed
+6
-4
+6
-4
@@ -51,10 +51,11 @@ function Header({ mobile, desktop, toggle }) {
|
||||
// The analyses of the Data page (labeling/auto/analyses/), read again every 3 s: one folder per station, open by default if
|
||||
// it has one running, and inside one analysis per range (a green tick: its labels validated); a click opens Data on its
|
||||
// station and its days, and shows its report there
|
||||
// The range of an analysis on one line: "01.11 · 10:30–11:40" within the day, otherwise "04.11 21:12 – 07.11 14:12" (UTC)
|
||||
// The range of an analysis on two lines, too wide for the sidebar on one: the days "04.11 – 07.11" ("01.11" within the day),
|
||||
// under them the hours "21:12 – 14:12" (UTC)
|
||||
const dayMonth = t => `${t.slice(8, 10)}.${t.slice(5, 7)}`, hour = t => t.slice(11, 16);
|
||||
const range = a => (a.start.slice(0, 10) === a.end.slice(0, 10)
|
||||
? `${dayMonth(a.start)} · ${hour(a.start)}–${hour(a.end)}` : `${dayMonth(a.start)} ${hour(a.start)} – ${dayMonth(a.end)} ${hour(a.end)}`);
|
||||
const days = a => (a.start.slice(0, 10) === a.end.slice(0, 10) ? dayMonth(a.start) : `${dayMonth(a.start)} – ${dayMonth(a.end)}`);
|
||||
const hours = a => `${hour(a.start)} – ${hour(a.end)}`;
|
||||
const STATE_COLOR = { done: "teal", error: "red", interrupted: "gray" };
|
||||
// The state: a spinning wheel while running, otherwise a coloured dot (its name in the tooltip)
|
||||
const Dot = ({ state }) => (state === "running" ? <Loader size={10} color="orange" />
|
||||
@@ -83,7 +84,8 @@ function Analyses({ open }) {
|
||||
rightSection={a.validated ? <Tooltip label={`labels validated ${a.validated}`}>
|
||||
<IconCircleCheck size={14} color="var(--mantine-color-green-6)" /></Tooltip>
|
||||
: a.state === "done" && <Tooltip label="labels to validate"><IconCircleDashed size={14} color="var(--mantine-color-dimmed)" /></Tooltip>}
|
||||
label={<Text size="xs" ff="monospace" style={{ whiteSpace: "nowrap" }}>{range(a)}</Text>} />
|
||||
label={<Text size="xs" ff="monospace" style={{ whiteSpace: "nowrap" }}>{days(a)}</Text>}
|
||||
description={<Text span size="xs" ff="monospace" c="dimmed" style={{ whiteSpace: "nowrap" }}>{hours(a)}</Text>} />
|
||||
))}
|
||||
</NavLink>
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user