mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 14:13:13 +00:00
9daa8f5d98
[web] rename all the JSX files to .jsx/.tsx GitOrigin-RevId: 82056ae47e017523722cf258dcc83c8a925a28f7
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
import { memo } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { useTranslation } from 'react-i18next'
|
|
import PreviewLogsPaneMaxEntries from '../../preview/components/preview-logs-pane-max-entries'
|
|
import PdfLogEntry from './pdf-log-entry'
|
|
import { useDetachCompileContext } from '../../../shared/context/detach-compile-context'
|
|
|
|
const LOG_PREVIEW_LIMIT = 100
|
|
|
|
function PdfLogsEntries({ entries, hasErrors }) {
|
|
const { t } = useTranslation()
|
|
const { syncToEntry } = useDetachCompileContext()
|
|
const logEntries = entries.slice(0, LOG_PREVIEW_LIMIT)
|
|
|
|
return (
|
|
<>
|
|
{entries.length > LOG_PREVIEW_LIMIT && (
|
|
<PreviewLogsPaneMaxEntries
|
|
totalEntries={entries.length}
|
|
entriesShown={LOG_PREVIEW_LIMIT}
|
|
hasErrors={hasErrors}
|
|
/>
|
|
)}
|
|
{logEntries.map(logEntry => (
|
|
<PdfLogEntry
|
|
key={logEntry.key}
|
|
ruleId={logEntry.ruleId}
|
|
headerTitle={logEntry.messageComponent ?? logEntry.message}
|
|
rawContent={logEntry.content}
|
|
logType={logEntry.type}
|
|
level={logEntry.level}
|
|
contentDetails={logEntry.contentDetails}
|
|
entryAriaLabel={t('log_entry_description', {
|
|
level: logEntry.level,
|
|
})}
|
|
sourceLocation={{
|
|
file: logEntry.file,
|
|
line: logEntry.line,
|
|
column: logEntry.column,
|
|
}}
|
|
onSourceLocationClick={syncToEntry}
|
|
/>
|
|
))}
|
|
</>
|
|
)
|
|
}
|
|
PdfLogsEntries.propTypes = {
|
|
entries: PropTypes.arrayOf(PropTypes.object),
|
|
hasErrors: PropTypes.bool,
|
|
}
|
|
|
|
export default memo(PdfLogsEntries)
|