mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
7c97f8ab6e
* Use new JSX runtime and update Babel Node target * Update .eslintrc * Remove React imports GitOrigin-RevId: 559de0267f8f2934c56a860ea8701bb522aa861a
61 lines
1.6 KiB
JavaScript
61 lines
1.6 KiB
JavaScript
import PropTypes from 'prop-types'
|
|
import { useTranslation } from 'react-i18next'
|
|
import PreviewLogsPaneEntry from './preview-logs-pane-entry'
|
|
|
|
function PreviewValidationIssue({ name, details }) {
|
|
const { t } = useTranslation()
|
|
let validationTitle
|
|
let validationContent
|
|
|
|
if (name === 'sizeCheck') {
|
|
validationTitle = t('project_too_large')
|
|
validationContent = (
|
|
<>
|
|
<div>{t('project_too_large_please_reduce')}</div>
|
|
<ul className="list-no-margin-bottom">
|
|
{details.resources.map((resource, index) => (
|
|
<li key={index}>
|
|
{resource.path} — {resource.kbSize}
|
|
kb
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</>
|
|
)
|
|
} else if (name === 'conflictedPaths') {
|
|
validationTitle = t('conflicting_paths_found')
|
|
validationContent = (
|
|
<>
|
|
<div>{t('following_paths_conflict')}</div>
|
|
<ul className="list-no-margin-bottom">
|
|
{details.map((detail, index) => (
|
|
<li key={index}>/{detail.path}</li>
|
|
))}
|
|
</ul>
|
|
</>
|
|
)
|
|
} else if (name === 'mainFile') {
|
|
validationTitle = t('main_file_not_found')
|
|
validationContent = <>{t('please_set_main_file')}</>
|
|
}
|
|
|
|
return validationTitle ? (
|
|
<PreviewLogsPaneEntry
|
|
headerTitle={validationTitle}
|
|
formattedContent={validationContent}
|
|
entryAriaLabel={t('validation_issue_entry_description')}
|
|
level="error"
|
|
/>
|
|
) : null
|
|
}
|
|
|
|
PreviewValidationIssue.propTypes = {
|
|
name: PropTypes.string.isRequired,
|
|
details: PropTypes.oneOfType([
|
|
PropTypes.object,
|
|
PropTypes.array,
|
|
PropTypes.bool,
|
|
]),
|
|
}
|
|
|
|
export default PreviewValidationIssue
|