import { Fragment } from "react"; import { useTranslation } from "react-i18next"; // Новые импорты import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogClose, } from "@/components/ui/dialog"; import { Button } from "@/components/ui/button"; import { Badge, badgeVariants } from "@/components/ui/badge"; import { BaseEmpty } from "@/components/base"; import { cn } from "@root/lib/utils"; interface Props { open: boolean; logInfo: [string, string][]; onClose: () => void; } export const LogViewer = (props: Props) => { const { open, logInfo, onClose } = props; const { t } = useTranslation(); // Вспомогательная функция для определения варианта Badge const getLogLevelVariant = (level: string): "destructive" | "secondary" => { return level === "error" || level === "exception" ? "destructive" : "secondary"; }; return ( !isOpen && onClose()}> {t("Script Console")} {/* Контейнер для логов с прокруткой */}
{logInfo.length > 0 ? ( logInfo.map(([level, log], index) => (
{level} {/* `whitespace-pre-wrap` сохраняет переносы строк и пробелы в логах */}

{log}

)) ) : ( )}
); };