From d4e97d786c3a4afc0c52728b07527880095e12d5 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 9 May 2022 18:15:23 -0500 Subject: [PATCH] Various log box improvements --- src/ui/React/LogBoxManager.tsx | 130 ++++++++++++++++++--------------- 1 file changed, 73 insertions(+), 57 deletions(-) diff --git a/src/ui/React/LogBoxManager.tsx b/src/ui/React/LogBoxManager.tsx index 6b63d7891..357209ef9 100644 --- a/src/ui/React/LogBoxManager.tsx +++ b/src/ui/React/LogBoxManager.tsx @@ -80,21 +80,12 @@ interface IProps { const useStyles = makeStyles((_theme: Theme) => createStyles({ - title: { - "&.is-minimized + *": { - border: "none", - margin: 0, - "max-height": 0, - padding: 0, - "pointer-events": "none", - visibility: "hidden", - }, - }, logs: { overflowY: "scroll", overflowX: "hidden", scrollbarWidth: "auto", flexDirection: "column-reverse", + whiteSpace: "pre-wrap", }, titleButton: { padding: "1px 0", @@ -176,7 +167,7 @@ function LogWindow(props: IProps): React.ReactElement { setMinimized(!minimized); } - function lineClass(s: string): string { + function lineColor(s: string): string { if (s.match(/(^\[[^\]]+\] )?ERROR/) || s.match(/(^\[[^\]]+\] )?FAIL/)) { return Settings.theme.error; } @@ -228,74 +219,99 @@ function LogWindow(props: IProps): React.ReactElement { if (e.clientX < 0 || e.clientY < 0 || e.clientX > innerWidth || e.clientY > innerHeight) return false; }; + // Max [width, height] + const minConstraints: [number, number] = [250, 33]; + return ( - - + -
- - - - {title()} + + + + } + > + <> + + + {title(true)} - {!workerScripts.has(script.pid) ? ( - + ) : ( + + )} + - ) : ( - - )} - - - - - - + + + - - - } + sx={{ height: `calc(100% - ${minConstraints[1]}px)`, display: minimized ? "none" : "flex" }} > - + {script.logs.map( (line: string, i: number): JSX.Element => ( - + {line}
), )} -
- -
-
-
+ + + + +
); }