2021-10-15 05:45:06 -04:00
|
|
|
import { useTranslation } from 'react-i18next'
|
|
|
|
import PdfLogEntryRawContent from './pdf-log-entry-raw-content'
|
|
|
|
import PropTypes from 'prop-types'
|
2024-05-08 06:36:45 -04:00
|
|
|
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
|
|
|
|
|
|
|
const pdfLogEntryComponents = importOverleafModules('pdfLogEntryComponents')
|
2021-10-15 05:45:06 -04:00
|
|
|
|
|
|
|
export default function PdfLogEntryContent({
|
|
|
|
rawContent,
|
|
|
|
formattedContent,
|
|
|
|
extraInfoURL,
|
2024-05-08 06:36:45 -04:00
|
|
|
index,
|
|
|
|
logEntry,
|
2021-10-15 05:45:06 -04:00
|
|
|
}) {
|
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="log-entry-content">
|
|
|
|
{formattedContent && (
|
|
|
|
<div className="log-entry-formatted-content">{formattedContent}</div>
|
|
|
|
)}
|
|
|
|
|
|
|
|
{extraInfoURL && (
|
|
|
|
<div className="log-entry-content-link">
|
|
|
|
<a href={extraInfoURL} target="_blank" rel="noopener">
|
|
|
|
{t('log_hint_extra_info')}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2024-05-08 06:36:45 -04:00
|
|
|
{logEntry &&
|
|
|
|
pdfLogEntryComponents.map(
|
|
|
|
({ import: { default: Component }, path }) => (
|
|
|
|
<Component key={path} index={index} logEntry={logEntry} />
|
|
|
|
)
|
|
|
|
)}
|
|
|
|
|
2021-10-15 05:45:06 -04:00
|
|
|
{rawContent && (
|
|
|
|
<PdfLogEntryRawContent rawContent={rawContent} collapsedSize={150} />
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
PdfLogEntryContent.propTypes = {
|
|
|
|
rawContent: PropTypes.string,
|
|
|
|
formattedContent: PropTypes.node,
|
|
|
|
extraInfoURL: PropTypes.string,
|
2024-05-08 06:36:45 -04:00
|
|
|
index: PropTypes.number,
|
|
|
|
logEntry: PropTypes.any,
|
2021-10-15 05:45:06 -04:00
|
|
|
}
|