-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show a message on no errors or warnings (#93)
* Show a message on no errors or warnings * Remove test console.log * darken the green
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import React, { useState } from "react" | ||
import "./App.css" | ||
import { directoryOpen } from "https://esm.sh/[email protected]" | ||
import confetti, { create } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.module.mjs'; | ||
import { fileListToTree, validate } from "../dist/validator/main.js" | ||
import type { ValidationResult } from "../../src/types/validation-result.ts" | ||
import { Collapse } from "./Collapse.tsx" | ||
|
@@ -61,6 +62,7 @@ function App() { | |
if (validation) { | ||
const errorList = [] | ||
const warningList = [] | ||
let success = "" | ||
for (const [code, issues] of validation.issues.filter({ severity: 'error' }).groupBy('code')) { | ||
if (code === 'None') { | ||
continue | ||
|
@@ -73,13 +75,28 @@ function App() { | |
} | ||
warningList.push(...Issue({ data: issues })) | ||
} | ||
if (errorList.length === 0 && warningList.length === 0) { | ||
success = ( | ||
<div className="success"> | ||
<Collapse label="No Issues Detected!"> | ||
<div>Thanks for Everything. I Have No Complaints Whatsoever.</div> | ||
</Collapse> | ||
</div> | ||
) | ||
confetti({ | ||
particleCount: 500, | ||
spread: 180, | ||
ticks: 400 | ||
}); | ||
} | ||
validatorOutput = ( | ||
<> | ||
<button onClick={validateDir}>Reselect Files</button> | ||
<div> | ||
<ul className="issues-list"> | ||
{errorList} | ||
{warningList} | ||
{success} | ||
</ul> | ||
<Summary data={validation.summary} /> | ||
<a | ||
|
@@ -92,7 +109,10 @@ function App() { | |
</div> | ||
</> | ||
) | ||
if (errorList.length === 0) { | ||
} | ||
} else { | ||
|
||
validatorOutput = ( | ||
<> | ||
<h2> | ||
|
@@ -106,7 +126,6 @@ function App() { | |
</> | ||
) | ||
} | ||
|
||
return ( | ||
<> | ||
<h1>BIDS Validator</h1> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters