diff --git a/package-lock.json b/package-lock.json index 57ad64f..2f58429 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "buffer": "^6.0.3", "classnames": "^2.3.2", "clipboard": "^2.0.11", - "hpt-validator": "1.0.0-rc.4", + "hpt-validator": "1.0.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -4444,9 +4444,9 @@ } }, "node_modules/hpt-validator": { - "version": "1.0.0-rc.4", - "resolved": "https://registry.npmjs.org/hpt-validator/-/hpt-validator-1.0.0-rc.4.tgz", - "integrity": "sha512-ypWwUj4CmNGbrdh7qW5gkrGSCF6T6JqMgENREzYb/exptZbqBRCuOqsyzY6E3MDI7iGny10ddGj8Q/A4QOvcbA==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hpt-validator/-/hpt-validator-1.0.0.tgz", + "integrity": "sha512-RO11pW2krf12rbO8LMR1XqK7lnf1CLqIGXRb3w2NOpwI9KfDL9KWTsDTWlq1C8DP23Fpo6UB4S393L78snQ3Hw==", "dependencies": { "@streamparser/json": "^0.0.17", "@types/node": "^20.2.5", @@ -6418,9 +6418,9 @@ } }, "node_modules/vite": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/vite/-/vite-4.5.2.tgz", - "integrity": "sha512-tBCZBNSBbHQkaGyhGCDUGqeo2ph8Fstyp6FMSvTtsXeZSPpSMGlviAOav2hxVTqFcx8Hj/twtWKsMJXNY0xI8w==", + "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/package.json b/package.json index 448c405..ab8e5b9 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "buffer": "^6.0.3", "classnames": "^2.3.2", "clipboard": "^2.0.11", - "hpt-validator": "1.0.0-rc.4", + "hpt-validator": "1.0.0", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", 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} + + ))} )}