usability thingy

This commit is contained in:
Joeri Exelmans 2025-10-24 01:17:37 +02:00
parent 913a7f1275
commit aac77b79f2

View file

@ -74,7 +74,6 @@ export const ShowAST = memo(function ShowASTx(props: {root: ConcreteState | Pseu
import BoltIcon from '@mui/icons-material/Bolt'; import BoltIcon from '@mui/icons-material/Bolt';
import { KeyInfoHidden, KeyInfoVisible } from "./KeyInfo"; import { KeyInfoHidden, KeyInfoVisible } from "./KeyInfo";
import { memo, useEffect } from "react"; import { memo, useEffect } from "react";
import { TraceState } from "./App";
export function ShowInputEvents({inputEvents, onRaise, disabled, showKeys}: {inputEvents: EventTrigger[], onRaise: (e: string, p: any) => void, disabled: boolean, showKeys: boolean}) { export function ShowInputEvents({inputEvents, onRaise, disabled, showKeys}: {inputEvents: EventTrigger[], onRaise: (e: string, p: any) => void, disabled: boolean, showKeys: boolean}) {
const raiseHandlers = inputEvents.map(({event}) => { const raiseHandlers = inputEvents.map(({event}) => {
@ -106,7 +105,8 @@ export function ShowInputEvents({inputEvents, onRaise, disabled, showKeys}: {inp
window.addEventListener("keydown", onKeyDown); window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown); return () => window.removeEventListener("keydown", onKeyDown);
}, [raiseHandlers]); }, [raiseHandlers]);
const KeyInfo = showKeys ? KeyInfoVisible : KeyInfoHidden; // const KeyInfo = showKeys ? KeyInfoVisible : KeyInfoHidden;
const KeyInfo = KeyInfoVisible; // always show keyboard shortcuts on input events, we can't expect the user to remember them
return inputEvents.map(({event, paramName}, i) => { return inputEvents.map(({event, paramName}, i) => {
const shortcut = (i+1)%10; const shortcut = (i+1)%10;
const KI = (i <= 10) ? KeyInfo : KeyInfoHidden; const KI = (i <= 10) ? KeyInfo : KeyInfoHidden;