trying to simplify things a bit more... will get rid of 'onResolve'

This commit is contained in:
Joeri Exelmans 2025-05-13 16:33:25 +02:00
parent 897824e07d
commit 9c0c2dab90
7 changed files with 85 additions and 45 deletions

View file

@ -50,11 +50,11 @@ export function App() {
window.onkeydown = onKeyDown;
}, []);
const commands = [
["call" , "[c] call" ],
["eval" , "[e] [Tab] [Enter] eval"],
["transform", "[t] [.] transform" ],
["let" , "[l] [=] let ... in ..." ],
const commands: [string, string[], string][] = [
["call" , ['c' ], "call" ],
["eval" , ['e','Tab','Enter' ], "eval" ],
["transform", ['t', '.' ], "transform" ],
["let" , ['l', '=', 'a' ], "let ... in ..."],
];
const [highlighted, setHighlighted] = useState(
@ -74,8 +74,9 @@ export function App() {
<button disabled={future.length===0} onClick={onRedo}>Redo ({future.length}) [Ctrl+Shift+Z]</button>
Commands:
{
commands.map(([_, descr], i) =>
commands.map(([_, keys, descr], i) =>
<span key={i} className={'command' + (highlighted[i] ? (' highlighted') : '')}>
{keys.map((key, j) => <kbd key={j}>{key}</kbd>)}
{descr}
</span>)
}
@ -91,6 +92,8 @@ export function App() {
filter={() => true}
/>
</CommandContext>
</main>
<footer>