mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Move the compile assistant into individual log entries (#18168)
GitOrigin-RevId: 391fd9f31e637bf27f81ebee0dd33fcdfba5f22b
This commit is contained in:
parent
0d00d34e1e
commit
de353bd8aa
4 changed files with 25 additions and 9 deletions
|
@ -903,7 +903,7 @@ module.exports = {
|
|||
editorToolbarButtons: [],
|
||||
sourceEditorExtensions: [],
|
||||
sourceEditorComponents: [],
|
||||
pdfLogsComponents: [],
|
||||
pdfLogEntryComponents: [],
|
||||
sourceEditorCompletionSources: [],
|
||||
sourceEditorSymbolPalette: [],
|
||||
sourceEditorToolbarComponents: [],
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import PdfLogEntryRawContent from './pdf-log-entry-raw-content'
|
||||
import PropTypes from 'prop-types'
|
||||
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
||||
|
||||
const pdfLogEntryComponents = importOverleafModules('pdfLogEntryComponents')
|
||||
|
||||
export default function PdfLogEntryContent({
|
||||
rawContent,
|
||||
formattedContent,
|
||||
extraInfoURL,
|
||||
index,
|
||||
logEntry,
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
|
||||
|
@ -23,6 +28,13 @@ export default function PdfLogEntryContent({
|
|||
</div>
|
||||
)}
|
||||
|
||||
{logEntry &&
|
||||
pdfLogEntryComponents.map(
|
||||
({ import: { default: Component }, path }) => (
|
||||
<Component key={path} index={index} logEntry={logEntry} />
|
||||
)
|
||||
)}
|
||||
|
||||
{rawContent && (
|
||||
<PdfLogEntryRawContent rawContent={rawContent} collapsedSize={150} />
|
||||
)}
|
||||
|
@ -34,4 +46,6 @@ PdfLogEntryContent.propTypes = {
|
|||
rawContent: PropTypes.string,
|
||||
formattedContent: PropTypes.node,
|
||||
extraInfoURL: PropTypes.string,
|
||||
index: PropTypes.number,
|
||||
logEntry: PropTypes.any,
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ function PdfLogEntry({
|
|||
contentDetails,
|
||||
onSourceLocationClick,
|
||||
onClose,
|
||||
index,
|
||||
logEntry,
|
||||
}) {
|
||||
if (ruleId && HumanReadableLogsHints[ruleId]) {
|
||||
const hint = HumanReadableLogsHints[ruleId]
|
||||
|
@ -59,11 +61,14 @@ function PdfLogEntry({
|
|||
showCloseButton={showCloseButton}
|
||||
onClose={onClose}
|
||||
/>
|
||||
|
||||
{(rawContent || formattedContent) && (
|
||||
<PdfLogEntryContent
|
||||
rawContent={rawContent}
|
||||
formattedContent={formattedContent}
|
||||
extraInfoURL={extraInfoURL}
|
||||
index={index}
|
||||
logEntry={logEntry}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
@ -94,6 +99,8 @@ PdfLogEntry.propTypes = {
|
|||
contentDetails: PropTypes.arrayOf(PropTypes.string),
|
||||
onSourceLocationClick: PropTypes.func,
|
||||
onClose: PropTypes.func,
|
||||
index: PropTypes.number,
|
||||
logEntry: PropTypes.any,
|
||||
}
|
||||
|
||||
export default memo(PdfLogEntry)
|
||||
|
|
|
@ -4,12 +4,9 @@ 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'
|
||||
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
||||
|
||||
const LOG_PREVIEW_LIMIT = 100
|
||||
|
||||
const pdfLogsComponents = importOverleafModules('pdfLogsComponents')
|
||||
|
||||
function PdfLogsEntries({ entries, hasErrors }) {
|
||||
const { t } = useTranslation()
|
||||
const { syncToEntry } = useDetachCompileContext()
|
||||
|
@ -25,13 +22,11 @@ function PdfLogsEntries({ entries, hasErrors }) {
|
|||
/>
|
||||
)}
|
||||
|
||||
{pdfLogsComponents.map(({ import: { default: Component }, path }) => (
|
||||
<Component key={path} entries={entries} />
|
||||
))}
|
||||
|
||||
{logEntries.map(logEntry => (
|
||||
{logEntries.map((logEntry, index) => (
|
||||
<PdfLogEntry
|
||||
key={logEntry.key}
|
||||
index={index}
|
||||
logEntry={logEntry}
|
||||
ruleId={logEntry.ruleId}
|
||||
headerTitle={logEntry.messageComponent ?? logEntry.message}
|
||||
rawContent={logEntry.content}
|
||||
|
|
Loading…
Reference in a new issue