Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show a message on no errors or warnings #93

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion web/src/App.tsx
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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -92,7 +109,10 @@ function App() {
</div>
</>
)
if (errorList.length === 0) {
}
} else {

validatorOutput = (
<>
<h2>
Expand All @@ -106,7 +126,6 @@ function App() {
</>
)
}

return (
<>
<h1>BIDS Validator</h1>
Expand Down
9 changes: 8 additions & 1 deletion web/src/Collapse.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ input[type='checkbox'] {
background: #D55E00;
}

.success .lbl-toggle {
background: #49E048;
}

@media (prefers-color-scheme: light) {
.lbl-toggle {
color: #000;
Expand All @@ -57,6 +61,9 @@ input[type='checkbox'] {
.error .lbl-toggle {
background: #D55E00;
}
.success .lbl-toggle {
background: #49E048;
}
}

.lbl-toggle::before {
Expand Down Expand Up @@ -98,4 +105,4 @@ input[type='checkbox'] {
border-bottom-right-radius: 7px;
padding: .5rem 1rem;
text-align: left;
}
}