overleaf/services/web/frontend/js/features/preview/components/preview-logs-pane.js
Paulo Jorge Reis 01cc057f6b Add raw logs to new errors UI (#3378)
* Add raw logs to new compile UI

* Address feedback

* Update test/frontend/features/preview/components/preview-logs-pane.test.js

Co-authored-by: John Lees-Miller <jdleesmiller@gmail.com>

Co-authored-by: John Lees-Miller <jdleesmiller@gmail.com>
GitOrigin-RevId: af9c653e13d93434467b122f4c388493e786212c
2020-11-17 03:04:16 +00:00

34 lines
886 B
JavaScript

import React from 'react'
import PropTypes from 'prop-types'
import { useTranslation } from 'react-i18next'
import PreviewLogEntry from './preview-log-entry'
function PreviewLogsPane({ logEntries, rawLog, onLogEntryLocationClick }) {
const { t } = useTranslation()
return (
<div className="logs-pane">
{logEntries && logEntries.length > 0 ? (
logEntries.map((logEntry, idx) => (
<PreviewLogEntry
key={idx}
{...logEntry}
onLogEntryLocationClick={onLogEntryLocationClick}
/>
))
) : (
<div>No logs</div>
)}
<PreviewLogEntry content={rawLog} level="raw" message={t('raw_logs')} />
</div>
)
}
PreviewLogsPane.propTypes = {
logEntries: PropTypes.array,
rawLog: PropTypes.string,
onLogEntryLocationClick: PropTypes.func.isRequired
}
export default PreviewLogsPane