Skip to content

Commit 925dc21

Browse files
committed
Show a message on no errors or warnings
1 parent dbf83e5 commit 925dc21

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

web/src/App.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
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"
78
import { Summary } from "./Summary.tsx"
9+
console.log(confetti)
810

911
function Files({ issues }) {
1012
const unique = new Map(issues.map(({ location, issueMessage }) => {
@@ -61,6 +63,7 @@ function App() {
6163
if (validation) {
6264
const errorList = []
6365
const warningList = []
66+
let success = ""
6467
for (const [code, issues] of validation.issues.filter({ severity: 'error' }).groupBy('code')) {
6568
if (code === 'None') {
6669
continue
@@ -73,13 +76,28 @@ function App() {
7376
}
7477
warningList.push(...Issue({ data: issues }))
7578
}
79+
if (errorList.length === 0 && warningList.length === 0) {
80+
success = (
81+
<div className="success">
82+
<Collapse label="No Issues Detected!">
83+
<div>Thanks for Everything. I Have No Complaints Whatsoever.</div>
84+
</Collapse>
85+
</div>
86+
)
87+
confetti({
88+
particleCount: 500,
89+
spread: 180,
90+
ticks: 400
91+
});
92+
}
7693
validatorOutput = (
7794
<>
7895
<button onClick={validateDir}>Reselect Files</button>
7996
<div>
8097
<ul className="issues-list">
8198
{errorList}
8299
{warningList}
100+
{success}
83101
</ul>
84102
<Summary data={validation.summary} />
85103
<a
@@ -92,7 +110,10 @@ function App() {
92110
</div>
93111
</>
94112
)
113+
if (errorList.length === 0) {
114+
}
95115
} else {
116+
96117
validatorOutput = (
97118
<>
98119
<h2>
@@ -106,7 +127,6 @@ function App() {
106127
</>
107128
)
108129
}
109-
110130
return (
111131
<>
112132
<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: #E6E7E7
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: #E5F8E7
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)