From ecd412e21ee5a110ec52d0e598e7ba58752bdb3f Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:23:53 +0100 Subject: [PATCH] Merge pull request #26990 from overleaf/dp-pdf-logs-max-entries Ensure that PreviewLogsPaneMaxEntries uses new style log entry in new editor GitOrigin-RevId: 964525a4676eeb341ce168aa3189ef59bb26b1cc --- .../preview-logs-pane-max-entries.jsx | 79 ---------------- .../preview-logs-pane-max-entries.tsx | 94 +++++++++++++++++++ 2 files changed, 94 insertions(+), 79 deletions(-) delete mode 100644 services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.jsx create mode 100644 services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx diff --git a/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.jsx b/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.jsx deleted file mode 100644 index eb28e3336a..0000000000 --- a/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.jsx +++ /dev/null @@ -1,79 +0,0 @@ -import { useCallback } from 'react' -import PropTypes from 'prop-types' -import { Trans, useTranslation } from 'react-i18next' -import OLButton from '@/features/ui/components/ol/ol-button' -import PreviewLogEntryHeader from './preview-log-entry-header' -import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' -import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' -import MaterialIcon from '@/shared/components/material-icon' - -function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) { - const { t } = useTranslation() - const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } = - useCompileContext() - const { enableStopOnFirstError } = useStopOnFirstError({ - eventSource: 'too-many-logs', - }) - - const title = t('log_entry_maximum_entries_title', { - total: totalEntries, - displayed: entriesShown, - }) - - const handleEnableStopOnFirstErrorClick = useCallback(() => { - enableStopOnFirstError() - startCompile({ stopOnFirstError: true }) - setAnimateCompileDropdownArrow(true) - }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow]) - - return ( -
- -
-
- {hasErrors && !stoppedOnFirstError ? ( - <> -

- -   - {t('tip')}: - , - // eslint-disable-next-line jsx-a11y/anchor-has-content - , - ]} - />{' '} -

-

{t('log_entry_maximum_entries_see_full_logs')}

- - ) : ( -

- -   - {t('tip')}: - {t('log_entry_maximum_entries_see_full_logs')} -

- )} -
-
-
- ) -} - -PreviewLogsPaneMaxEntries.propTypes = { - totalEntries: PropTypes.number, - entriesShown: PropTypes.number, - hasErrors: PropTypes.bool, -} - -export default PreviewLogsPaneMaxEntries diff --git a/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx b/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx new file mode 100644 index 0000000000..f0109a6c03 --- /dev/null +++ b/services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.tsx @@ -0,0 +1,94 @@ +import { useCallback } from 'react' +import { Trans, useTranslation } from 'react-i18next' +import OLButton from '@/features/ui/components/ol/ol-button' +import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context' +import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error' +import MaterialIcon from '@/shared/components/material-icon' +import PdfLogEntry from '@/features/pdf-preview/components/pdf-log-entry' + +function PreviewLogsPaneMaxEntries({ + totalEntries, + entriesShown, + hasErrors, +}: { + totalEntries: number + entriesShown: number + hasErrors?: boolean +}) { + const { t } = useTranslation() + + const title = t('log_entry_maximum_entries_title', { + total: totalEntries, + displayed: entriesShown, + }) + + return ( + + } + /> + ) +} + +function PreviewLogsPaneMaxEntriesContent({ + hasErrors, +}: { + hasErrors?: boolean +}) { + const { t } = useTranslation() + const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } = + useCompileContext() + const { enableStopOnFirstError } = useStopOnFirstError({ + eventSource: 'too-many-logs', + }) + + const handleEnableStopOnFirstErrorClick = useCallback(() => { + enableStopOnFirstError() + startCompile({ stopOnFirstError: true }) + setAnimateCompileDropdownArrow(true) + }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow]) + + if (hasErrors && !stoppedOnFirstError) { + return ( + <> +

+ +   + {t('tip')}: + , + // eslint-disable-next-line jsx-a11y/anchor-has-content + , + ]} + />{' '} +

+

{t('log_entry_maximum_entries_see_full_logs')}

+ + ) + } + + return ( +

+ +   + {t('tip')}: + {t('log_entry_maximum_entries_see_full_logs')} +

+ ) +} + +export default PreviewLogsPaneMaxEntries