/* Copyright 2026 Marimo. All rights reserved. */ import { FileTextIcon } from "lucide-react"; import React from "react"; import { ClearButton } from "@/components/buttons/clear-button"; import { useCellActions, useCellLogs } from "@/core/cells/cells"; import { type CellLog, formatLogTimestamp } from "@/core/cells/logs"; import { cn } from "@/utils/cn"; import { CellLink } from "../../links/cell-link"; import { PanelEmptyState } from "./empty-state"; interface Props { className?: string; logs: CellLog[]; } const LogsPanel: React.FC = () => { const logs = useCellLogs(); const { clearLogs } = useCellActions(); if (logs.length === 0) { return ( stdout and{" "} stderr logs will appear here. } icon={} /> ); } return (
); }; export default LogsPanel; export const LogViewer: React.FC = ({ logs, className }) => { const hover = "opacity-70 group-hover:bg-(--gray-3) group-hover:opacity-100"; return (
        
{logs.map((log, index) => (
{index + 1} {formatLog(log)}
))}
); }; function formatLog(log: CellLog) { const timestamp = formatLogTimestamp(log.timestamp); const color = levelColor[log.level]; const level = log.level.toUpperCase(); return ( <> [{timestamp}] {level} () {log.message} ); } const levelColor: Record = { stdout: "text-(--grass-9)", stderr: "text-(--red-9)", };