Revert "Revert "Improve copy for single errors or warnings""

This reverts commit f01e0726b9a0119bc7f8bda3a98c2c0df5026e51.

GitOrigin-RevId: fc44d227e50c46260fbedb8c80fdca24092f81eb
This commit is contained in:
Paulo Jorge Reis
2021-07-07 02:05:40 +00:00
committed by Copybot
parent db8173011e
commit 0ee18df3e4
6 changed files with 50 additions and 16 deletions
@@ -328,16 +328,19 @@
"use_your_own_machine": "",
"validation_issue_description": "",
"validation_issue_entry_description": "",
"view_all_errors": "",
"view_error": "",
"view_error_plural": "",
"view_logs": "",
"view_pdf": "",
"view_warnings": "",
"view_warning": "",
"view_warning_plural": "",
"we_cant_find_any_sections_or_subsections_in_this_file": "",
"word_count": "",
"work_offline": "",
"work_with_non_overleaf_users": "",
"your_message": "",
"your_project_has_errors": "",
"your_project_has_an_error": "",
"your_project_has_an_error_plural": "",
"zotero_groups_loading_error": "",
"zotero_is_premium": "",
"zotero_reference_loading_error": "",
@@ -6,6 +6,7 @@ import { OverlayTrigger, Tooltip } from 'react-bootstrap'
function PreviewFirstErrorPopUp({
logEntry,
nErrors,
onGoToErrorLocation,
onViewLogs,
onClose,
@@ -52,7 +53,7 @@ function PreviewFirstErrorPopUp({
>
<Icon type="file-text-o" />
&nbsp;
{t('view_all_errors')}
{t('view_error', { count: nErrors })}
</button>
</div>
</div>
@@ -82,6 +83,7 @@ function FirstErrorPopUpInfoBadge() {
PreviewFirstErrorPopUp.propTypes = {
logEntry: PropTypes.object.isRequired,
nErrors: PropTypes.number.isRequired,
onGoToErrorLocation: PropTypes.func.isRequired,
onViewLogs: PropTypes.func.isRequired,
onClose: PropTypes.func.isRequired,
@@ -119,19 +119,25 @@ function ViewPdf({ textStyle }) {
function LogsCompilationResult({ textStyle, logType, nLogs }) {
const { t } = useTranslation()
const label =
logType === 'errors' ? t('your_project_has_errors') : t('view_warnings')
const logTypeLabel =
logType === 'errors'
? t('your_project_has_an_error', { count: nLogs })
: t('view_warning', { count: nLogs })
const errorCountLabel = ` (${
nLogs > MAX_ERRORS_COUNT ? `${MAX_ERRORS_COUNT}+` : nLogs
})`
return (
<>
<Icon type="file-text-o" />
<span
className="btn-toggle-logs-label toolbar-text"
aria-label={label}
aria-label={logTypeLabel}
style={textStyle}
>
{`${label} (${
nLogs > MAX_ERRORS_COUNT ? `${MAX_ERRORS_COUNT}+` : nLogs
})`}
{`${logTypeLabel}${nLogs > 1 ? errorCountLabel : ''}`}
</span>
</>
)
@@ -117,6 +117,7 @@ function PreviewPane({
{showFirstErrorPopUp ? (
<PreviewFirstErrorPopUp
logEntry={compilerState.logEntries.errors[0]}
nErrors={nErrors}
onGoToErrorLocation={onLogEntryLocationClick}
onViewLogs={onToggleLogs}
onClose={handleFirstErrorPopUpClose}