diff --git a/ui/src/components/nodes/Code.tsx b/ui/src/components/nodes/Code.tsx index 4b441900..227211a0 100644 --- a/ui/src/components/nodes/Code.tsx +++ b/ui/src/components/nodes/Code.tsx @@ -75,7 +75,7 @@ function Timer({ lastExecutedAt }) { return Last executed: {timeDifference(new Date(), lastExecutedAt)}; } -export const ResultBlock = memo(function ResultBlock({ id }) { +export const ResultBlock = memo(function ResultBlock({ id, layout }) { const store = useContext(RepoContext)!; const result = useStore(store, (state) => state.pods[id].result); const error = useStore(store, (state) => state.pods[id].error); @@ -90,10 +90,43 @@ export const ResultBlock = memo(function ResultBlock({ id }) { (state) => state.pods[id].lastExecutedAt ); const [showOutput, setShowOutput] = useState(true); + const hasResult = useStore( + store, + (state) => + state.pods[id]?.running || + state.pods[id]?.result || + state.pods[id]?.error || + state.pods[id]?.stdout || + state.pods[id]?.stderr + ); + const [resultScroll, setResultScroll] = useState(false); const clearResults = useStore(store, (state) => state.clearResults); + if (!hasResult) return <>; return ( { + // e.stopPropagation(); + // }} + className={showOutput && resultScroll ? "nowheel" : ""} sx={{ + border: + showOutput && resultScroll ? "solid 1px red" : "solid 1px #d6dee6", + borderRadius: "4px", + position: "absolute", + top: layout === "right" ? 0 : "100%", + left: layout === "right" ? "100%" : 0, + ...(layout === "right" + ? { minWidth: "250px" } + : { maxWidth: "100%", minWidth: "100%" }), + boxSizing: "border-box", + backgroundColor: "white", + zIndex: 100, + padding: "0 10px", userSelect: "text", cursor: "auto", }} @@ -174,6 +207,15 @@ export const ResultBlock = memo(function ResultBlock({ id }) { variant="text" aria-label="outlined primary button group" > +