LAMPSUI / frontend /src /components /ConsolePanel.tsx
Ilya
hope working
e4bd399
Raw History Blame Contribute Delete
1.12 kB
import { useEffect, useRef } from "react";
import { Text } from "@mantine/core";
interface Props {
lines: string[];
}
export function ConsolePanel({ lines }: Props) {
const endRef = useRef<HTMLDivElement | null>(null);
// Auto-scroll to bottom as lines arrive
useEffect(() => {
endRef.current?.scrollIntoView({ behavior: "auto", block: "end" });
}, [lines.length]);
return (
<div
style={{
fontFamily:
"ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace",
fontSize: 12,
lineHeight: 1.45,
padding: "8px 12px",
backgroundColor: "var(--mantine-color-dark-9, #0e0f12)",
color: "var(--mantine-color-gray-3, #d8d8d8)",
minHeight: "100%",
}}
>
{lines.length === 0 ? (
<Text size="xs" c="dimmed">
Console output will appear here once a run starts…
</Text>
) : (
lines.map((line, i) => (
<div key={i} style={{ whiteSpace: "pre-wrap" }}>
{line}
</div>
))
)}
<div ref={endRef} />
</div>
);
}