errors in bottom panel are collapsible

This commit is contained in:
Joeri Exelmans 2025-10-21 10:51:17 +02:00
parent 297905a4af
commit 60a7d12857
6 changed files with 74 additions and 69 deletions

View file

@ -4,6 +4,8 @@ import { TraceableError } from "../statecharts/parser";
import "./BottomPanel.css";
import head from "../head.svg" ;
import { usePersistentState } from "@/util/persistent_state";
import { PersistentDetails } from "./PersistentDetails";
export function BottomPanel(props: {errors: TraceableError[]}) {
const [greeting, setGreeting] = useState(<><b><img src={head} style={{transform: "scaleX(-1)"}}/>&emsp;"Welcome to StateBuddy, buddy!"</b></>);
@ -18,7 +20,14 @@ export function BottomPanel(props: {errors: TraceableError[]}) {
<>{greeting}</>
{props.errors.length > 0 &&
<div className="errorStatus">
{props.errors.length>0 && <>{props.errors.length} errors: {props.errors.map(({message})=>message).join(', ')}</>}
</div>}
<PersistentDetails initiallyOpen={false} localStorageKey="errorsExpanded">
<summary>{props.errors.length} errors</summary>
{props.errors.map(({message})=>
<div>
{message}
</div>)}
</PersistentDetails>
</div>
}
</div>;
}