Skip to content

Commit f4bb6e2

Browse files
authored
Show a message on no errors or warnings (#93)
* Show a message on no errors or warnings * Remove test console.log * darken the green
1 parent f41eb71 commit f4bb6e2

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

web/src/App.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, { useState } from "react"
22
import "./App.css"
33
import { directoryOpen } from "https://esm.sh/[email protected]"
4+
import confetti, { create } from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/confetti.module.mjs';
45
import { fileListToTree, validate } from "../dist/validator/main.js"
56
import type { ValidationResult } from "../../src/types/validation-result.ts"
67
import { Collapse } from "./Collapse.tsx"
@@ -61,6 +62,7 @@ function App() {
6162
if (validation) {
6263
const errorList = []
6364
const warningList = []
65+
let success = ""
6466
for (const [code, issues] of validation.issues.filter({ severity: 'error' }).groupBy('code')) {
6567
if (code === 'None') {
6668
continue
@@ -73,13 +75,28 @@ function App() {
7375
}
7476
warningList.push(...Issue({ data: issues }))
7577
}
78+
if (errorList.length === 0 && warningList.length === 0) {
79+
success = (
80+
<div className="success">
81+
<Collapse label="No Issues Detected!">
82+
<div>Thanks for Everything. I Have No Complaints Whatsoever.</div>
83+
</Collapse>
84+
</div>
85+
)
86+
confetti({
87+
particleCount: 500,
88+
spread: 180,
89+
ticks: 400
90+
});
91+
}
7692
validatorOutput = (
7793
<>
7894
<button onClick={validateDir}>Reselect Files</button>
7995
<div>
8096
<ul className="issues-list">
8197
{errorList}
8298
{warningList}
99+
{success}
83100
</ul>
84101
<Summary data={validation.summary} />
85102
<a
@@ -92,7 +109,10 @@ function App() {
92109
</div>
93110
</>
94111
)
112+
if (errorList.length === 0) {
113+
}
95114
} else {
115+
96116
validatorOutput = (
97117
<>
98118
<h2>
@@ -106,7 +126,6 @@ function App() {
106126
</>
107127
)
108128
}
109-
110129
return (
111130
<>
112131
<h1>BIDS Validator</h1>

web/src/Collapse.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ input[type='checkbox'] {
4040
background: #D55E00;
4141
}
4242

43+
.success .lbl-toggle {
44+
background: #49E048;
45+
}
46+
4347
@media (prefers-color-scheme: light) {
4448
.lbl-toggle {
4549
color: #000;
@@ -57,6 +61,9 @@ input[type='checkbox'] {
5761
.error .lbl-toggle {
5862
background: #D55E00;
5963
}
64+
.success .lbl-toggle {
65+
background: #49E048;
66+
}
6067
}
6168

6269
.lbl-toggle::before {
@@ -98,4 +105,4 @@ input[type='checkbox'] {
98105
border-bottom-right-radius: 7px;
99106
padding: .5rem 1rem;
100107
text-align: left;
101-
}
108+
}

0 commit comments

Comments
 (0)