diff --git a/package-lock.json b/package-lock.json index c680963..f86726d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6418,9 +6418,9 @@ } }, "node_modules/vite": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.0.tgz", - "integrity": "sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==", + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.3.tgz", + "integrity": "sha512-kQL23kMeX92v3ph7IauVkXkikdDRsYMGTVl5KY2E9OY4ONLvkHf04MDTbnfo6NKxZiDLWzVpP5oTa8hQD8U3dg==", "dev": true, "dependencies": { "esbuild": "^0.18.10", diff --git a/src/components/ValidationResults.jsx b/src/components/ValidationResults.jsx index 53fd2bd..981044c 100644 --- a/src/components/ValidationResults.jsx +++ b/src/components/ValidationResults.jsx @@ -36,7 +36,8 @@ const ValidationResults = ({ }) const downloadUrl = window.URL.createObjectURL(blob) */ - const atMaxErrors = errors.length + warnings.length >= maxErrors + const atMaxErrors = errors.length >= maxErrors + const atMaxWarnings = warnings.length >= maxErrors useEffect(() => { if (didMount && !loading && resultsHeaderRef.current) { @@ -99,16 +100,36 @@ const ValidationResults = ({ ) : ( <> + There {errors.length === 1 - ? "1 error" - : `${errors.length} errors`}{" "} - found in file + ? " is 1 error" + : ` are ${atMaxErrors ? "at least " : ""}${ + errors.length + } errors`}{" "} + found in the file : {filename}
{atMaxErrors && ( - Only the first {maxErrors} errors and warnings are shown + The first {maxErrors} errors are shown below. See the{" "} + + Hospital Price Transparency Data Dictionary GitHub + Repository + {" "} + for detailed technical specifications to understand and + address these errors. + + )} + {!atMaxErrors && ( + + See the{" "} + + Hospital Price Transparency Data Dictionary GitHub + Repository + {" "} + for detailed technical specifications to understand and + address these errors. )} @@ -124,12 +145,14 @@ const ValidationResults = ({ - {errors.map(({ path, message }, index) => ( - - {path} - {message} - - ))} + {errors + .slice(0, maxErrors) + .map(({ path, message }, index) => ( + + {path} + {message} + + ))} @@ -144,16 +167,19 @@ const ValidationResults = ({ ) : ( <> + There {warnings.length === 1 - ? "1 warning" - : `${warnings.length} warnings`}{" "} - for file + ? " is 1 warning" + : ` are ${atMaxWarnings ? "at least " : ""}${ + warnings.length + } warnings`}{" "} + found in the file : {filename}
- {atMaxErrors && ( + {atMaxWarnings && ( - Only the first {maxErrors} errors and warnings are shown + The first {maxErrors} warnings are shown below. )}
@@ -173,12 +199,14 @@ const ValidationResults = ({ - {warnings.map(({ path, message }, index) => ( - - {path} - {message} - - ))} + {warnings + .slice(0, maxErrors) + .map(({ path, message }, index) => ( + + {path} + {message} + + ))} )}