Spaces:
Sleeping
Sleeping
Download frontend/src/components/ConsolePanel.tsx from ilyaRozhkovA/LAMPSUI: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/ilyaRozhkovA/LAMPSUI/resolve/main/frontend/src/components/ConsolePanel.tsx
- Command line
-
hf download hf://spaces/ilyaRozhkovA/LAMPSUI/frontend/src/components/ConsolePanel.tsx
-
curl -L -o ConsolePanel.tsx https://huggingface.co/spaces/ilyaRozhkovA/LAMPSUI/resolve/main/frontend/src/components/ConsolePanel.tsx
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> | |
| ); | |
| } | |