diff --git a/src/ui/React/LogBoxManager.tsx b/src/ui/React/LogBoxManager.tsx index 3f3937e9a..21839a23b 100644 --- a/src/ui/React/LogBoxManager.tsx +++ b/src/ui/React/LogBoxManager.tsx @@ -18,6 +18,7 @@ import { Theme } from "@mui/material"; import { findRunningScript } from "../../Script/ScriptHelpers"; import { Player } from "../../Player"; import { debounce } from "lodash"; +import { Settings } from "../../Settings/Settings"; let layerCounter = 0; @@ -77,42 +78,18 @@ interface IProps { onClose: () => void; } -const useStyles = makeStyles((theme: Theme) => +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", - display: "flex", flexDirection: "column-reverse", + whiteSpace: "pre-wrap", }, titleButton: { - padding: "1px 6px", - }, - success: { - color: theme.colors.success, - }, - error: { - color: theme.palette.error.main, - }, - primary: { - color: theme.palette.primary.main, - }, - info: { - color: theme.palette.info.main, - }, - warning: { - color: theme.palette.warning.main, + padding: "1px 0", + height: "100%", }, }), ); @@ -190,20 +167,20 @@ 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 classes.error; + return Settings.theme.error; } if (s.match(/(^\[[^\]]+\] )?SUCCESS/)) { - return classes.success; + return Settings.theme.success; } if (s.match(/(^\[[^\]]+\] )?WARN/)) { - return classes.warning; + return Settings.theme.warning; } if (s.match(/(^\[[^\]]+\] )?INFO/)) { - return classes.info; + return Settings.theme.info; } - return classes.primary; + return Settings.theme.primary; } // And trigger fakeDrag when the window is resized @@ -242,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}
), )} -
- -
-
-
+ + + + +
); }