fix: plant steps were wrongly showing statechart output events

This commit is contained in:
Joeri Exelmans 2025-11-06 21:26:17 +01:00
parent 8ed9267cb7
commit f5c427d61b
11 changed files with 104 additions and 33 deletions

View file

@ -1,5 +1,5 @@
import { usePersistentState } from "@/App/persistent_state"
import { DetailsHTMLAttributes, PropsWithChildren } from "react";
import { DetailsHTMLAttributes, Dispatch, PropsWithChildren, SetStateAction } from "react";
type Props = {
localStorageKey: string,
@ -7,9 +7,15 @@ type Props = {
} & DetailsHTMLAttributes<HTMLDetailsElement>;
// A <details> node that remembers whether it was open or closed by storing that state in localStorage.
export function PersistentDetails({localStorageKey, initiallyOpen, children, ...rest}: PropsWithChildren<Props>) {
export function PersistentDetailsLocalStorage({localStorageKey, initiallyOpen, children, ...rest}: PropsWithChildren<Props>) {
const [open, setOpen] = usePersistentState(localStorageKey, initiallyOpen);
return <details open={open} onToggle={e => setOpen(e.newState === "open")} {...rest}>
{children}
</details>;
}
export function PersistentDetails({state, setState, children, ...rest}: PropsWithChildren<{state: boolean, setState: Dispatch<SetStateAction<boolean>>}>) {
return <details open={state} onToggle={e => setState(e.newState === "open")} {...rest}>
{children}
</details>;
}