mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 22:10:02 -05:00
73bc3418a2
GitOrigin-RevId: fcc88a362c3e97c9fddf85d47c3a83a0a0b89432
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import { memo, useCallback } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
import { useTranslation } from 'react-i18next'
|
|
import PreviewLogsPaneEntry from '../../preview/components/preview-logs-pane-entry'
|
|
|
|
function PdfLogsEntries({ entries }) {
|
|
const { t } = useTranslation()
|
|
|
|
const syncToEntry = useCallback(entry => {
|
|
window.dispatchEvent(
|
|
new CustomEvent('synctex:sync-to-entry', {
|
|
detail: entry,
|
|
})
|
|
)
|
|
}, [])
|
|
|
|
return (
|
|
<>
|
|
{entries.map(logEntry => (
|
|
<PreviewLogsPaneEntry
|
|
key={logEntry.key}
|
|
headerTitle={logEntry.message}
|
|
rawContent={logEntry.content}
|
|
logType={logEntry.type}
|
|
formattedContent={logEntry.humanReadableHintComponent}
|
|
extraInfoURL={logEntry.extraInfoURL}
|
|
level={logEntry.level}
|
|
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),
|
|
}
|
|
|
|
export default memo(PdfLogsEntries)
|