import PropTypes from 'prop-types' import classNames from 'classnames' import { memo, useCallback } from 'react' import PreviewLogEntryHeader from '../../preview/components/preview-log-entry-header' import PdfLogEntryContent from './pdf-log-entry-content' import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadableLogsHints' import { sendMB } from '@/infrastructure/event-tracking' function PdfLogEntry({ ruleId, headerTitle, headerIcon, rawContent, logType, formattedContent, extraInfoURL, level, sourceLocation, showSourceLocationLink = true, showCloseButton = false, entryAriaLabel = null, customClass, contentDetails, onSourceLocationClick, onClose, }) { if (ruleId && HumanReadableLogsHints[ruleId]) { const hint = HumanReadableLogsHints[ruleId] formattedContent = hint.formattedContent(contentDetails) extraInfoURL = hint.extraInfoURL } const handleLogEntryLinkClick = useCallback( event => { event.preventDefault() onSourceLocationClick(sourceLocation) const parts = sourceLocation?.file?.split('.') const extension = parts?.length > 1 ? parts.pop() : '' sendMB('log-entry-link-click', { level, ruleId, extension }) }, [level, onSourceLocationClick, ruleId, sourceLocation] ) return (