pdf-validation-issue.tsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { memo } from 'react'
  2. import { useTranslation } from 'react-i18next'
  3. import PdfLogEntry from './pdf-log-entry'
  4. function PdfValidationIssue({ issue, name }: { issue: any; name: string }) {
  5. const { t } = useTranslation()
  6. switch (name) {
  7. case 'sizeCheck':
  8. return (
  9. <PdfLogEntry
  10. headerTitle={t('project_too_large')}
  11. formattedContent={
  12. <>
  13. <div>{t('project_too_large_please_reduce')}</div>
  14. <ul className="list-no-margin-bottom">
  15. {issue.resources.map(
  16. (resource: { path: string; kbSize: number }) => (
  17. <li key={resource.path}>
  18. {resource.path} &mdash; {resource.kbSize}
  19. kb
  20. </li>
  21. )
  22. )}
  23. </ul>
  24. </>
  25. }
  26. entryAriaLabel={t('validation_issue_entry_description')}
  27. level="error"
  28. />
  29. )
  30. case 'conflictedPaths':
  31. return (
  32. <PdfLogEntry
  33. headerTitle={t('conflicting_paths_found')}
  34. formattedContent={
  35. <>
  36. <div>{t('following_paths_conflict')}</div>
  37. <ul className="list-no-margin-bottom">
  38. {issue.map((detail: { path: string }) => (
  39. <li key={detail.path}>/{detail.path}</li>
  40. ))}
  41. </ul>
  42. </>
  43. }
  44. entryAriaLabel={t('validation_issue_entry_description')}
  45. level="error"
  46. />
  47. )
  48. case 'mainFile':
  49. return (
  50. <PdfLogEntry
  51. headerTitle={t('main_file_not_found')}
  52. formattedContent={t('please_set_main_file')}
  53. entryAriaLabel={t('validation_issue_entry_description')}
  54. level="error"
  55. />
  56. )
  57. default:
  58. return null
  59. }
  60. }
  61. export default memo(PdfValidationIssue)