Compile UI improvements for beta release (#3644)

* Increase errors cap in the new compile UI to 99

* Improve messaging for stopped compiles

GitOrigin-RevId: d34973e9ef71562d64cfc8018634753e47e4dee8
This commit is contained in:
Paulo Jorge Reis 2021-02-17 14:07:21 +00:00 committed by Copybot
parent 58b8ac3775
commit 326c63e2af
3 changed files with 10 additions and 6 deletions

View file

@ -5,6 +5,8 @@ import classNames from 'classnames'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import Icon from '../../../shared/components/icon' import Icon from '../../../shared/components/icon'
const MAX_ERRORS_COUNT = 99
function PreviewLogsToggleButton({ function PreviewLogsToggleButton({
onToggle, onToggle,
showLogs, showLogs,
@ -100,7 +102,9 @@ function LogsCompilationResultIndicator({ textStyle, logType, nLogs }) {
aria-label={label} aria-label={label}
style={textStyle} style={textStyle}
> >
{`${label} (${nLogs > 9 ? '9+' : nLogs})`} {`${label} (${
nLogs > MAX_ERRORS_COUNT ? `${MAX_ERRORS_COUNT}+` : nLogs
})`}
</span> </span>
</> </>
) )

View file

@ -637,7 +637,7 @@
"if_you_are_registered": "If you are already registered", "if_you_are_registered": "If you are already registered",
"stop_compile": "Stop compilation", "stop_compile": "Stop compilation",
"terminated": "Compilation cancelled", "terminated": "Compilation cancelled",
"compile_terminated_by_user": "The compile was cancelled using the 'Stop Compilation' button. You can view the raw logs to see where the compile stopped.", "compile_terminated_by_user": "The compile was cancelled using the 'Stop Compilation' button. You can download the raw logs to see where the compile stopped.",
"site_description": "An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.", "site_description": "An online LaTeX editor that's easy to use. No installation, real-time collaboration, version control, hundreds of LaTeX templates, and more.",
"knowledge_base": "knowledge base", "knowledge_base": "knowledge base",
"contact_message_label": "Message", "contact_message_label": "Message",

View file

@ -83,14 +83,14 @@ describe('<PreviewLogsToggleButton />', function() {
screen.getByText(`View warnings (${logsState.nWarnings})`) screen.getByText(`View warnings (${logsState.nWarnings})`)
}) })
it('should render 9+ errors when there are more than nine errors', function() { it('should render 99+ errors when there are more than 99 errors', function() {
const logsState = { const logsState = {
nErrors: 10, nErrors: 100,
nWarnings: 0, nWarnings: 0,
nLogEntries: 0 nLogEntries: 0
} }
renderPreviewLogsToggleButton(logsState, onToggleLogs, showLogs) renderPreviewLogsToggleButton(logsState, onToggleLogs, showLogs)
screen.getByText('This project has errors (9+)') screen.getByText('This project has errors (99+)')
}) })
it('should show the button text when prop showText=true', function() { it('should show the button text when prop showText=true', function() {
const logsState = { const logsState = {