import React from 'react'
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 = (
<>
{t('project_too_large_please_reduce')}
{details.resources.map((resource, index) => (
-
{resource.path} — {resource.kbSize}
kb
))}
>
)
} else if (name === 'conflictedPaths') {
validationTitle = t('conflicting_paths_found')
validationContent = (
<>
{t('following_paths_conflict')}
{details.map((detail, index) => (
- /{detail.path}
))}
>
)
} else if (name === 'mainFile') {
validationTitle = t('main_file_not_found')
validationContent = <>{t('please_set_main_file')}>
}
return validationTitle ? (
) : null
}
PreviewValidationIssue.propTypes = {
name: PropTypes.string.isRequired,
details: PropTypes.oneOfType([
PropTypes.object,
PropTypes.array,
PropTypes.bool,
]),
}
export default PreviewValidationIssue